Skip to content

Commit abbff8b

Browse files
committed
Update copy operator for AddrSpaceToSentinelValueMap and sentinelValueDefined
1 parent 8e1aea0 commit abbff8b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

llvm/include/llvm/IR/DataLayout.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ class DataLayout {
166166
SmallVector<unsigned, 8> NonIntegralAddressSpaces;
167167

168168
DenseMap<unsigned, int64_t> AddrSpaceToSentinelValueMap;
169+
bool sentinelValueDefined = false;
169170

170171
/// Attempts to set the alignment of the given type. Returns an error
171172
/// description on failure.
@@ -222,6 +223,8 @@ class DataLayout {
222223
StructAlignment = DL.StructAlignment;
223224
Pointers = DL.Pointers;
224225
NonIntegralAddressSpaces = DL.NonIntegralAddressSpaces;
226+
AddrSpaceToSentinelValueMap = DL.AddrSpaceToSentinelValueMap;
227+
sentinelValueDefined = DL.isSentinelValueDefined();
225228
return *this;
226229
}
227230

@@ -302,7 +305,7 @@ class DataLayout {
302305
return ManglingMode == MM_WinCOFFX86;
303306
}
304307

305-
int64_t getSentinelPointerValue(unsigned AddrSpace) {
308+
int64_t getSentinelPointerValue(unsigned AddrSpace) const {
306309
auto It = AddrSpaceToSentinelValueMap.find(AddrSpace);
307310
if (It == AddrSpaceToSentinelValueMap.end())
308311
return 0;
@@ -313,6 +316,8 @@ class DataLayout {
313316
AddrSpaceToSentinelValueMap[AddrSpace] = Value;
314317
}
315318

319+
bool isSentinelValueDefined() const { return sentinelValueDefined; }
320+
316321
/// Returns true if symbols with leading question marks should not receive IR
317322
/// mangling. True for Windows mangling modes.
318323
bool doNotMangleLeadingQuestionMark() const {

llvm/lib/IR/DataLayout.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ Error DataLayout::parseSpecifier(StringRef Desc) {
521521
break;
522522
}
523523
case 'z': {
524+
sentinelValueDefined = true;
524525
unsigned AddrSpace = 0;
525526
int64_t Value;
526527
// for unlisted address spaces e.g., z:0
@@ -748,6 +749,7 @@ class StructLayoutMap {
748749
} // end anonymous namespace
749750

750751
void DataLayout::clear() {
752+
751753
LegalIntWidths.clear();
752754
IntAlignments.clear();
753755
FloatAlignments.clear();

0 commit comments

Comments
 (0)