Skip to content

Commit 4e01ced

Browse files
authored
Merge pull request #62587 from adrian-prantl/bitsvsbytes
Fix a bit versus byte confusion.
2 parents 93653c7 + 8921b10 commit 4e01ced

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2918,9 +2918,11 @@ void IRGenDebugInfoImpl::emitTypeMetadata(IRGenFunction &IGF,
29182918
static const char *Tau = u8"\u03C4";
29192919
llvm::raw_svector_ostream OS(Buf);
29202920
OS << '$' << Tau << '_' << Depth << '_' << Index;
2921+
uint64_t PtrWidthInBits = CI.getTargetInfo().getPointerWidth(0);
2922+
assert(PtrWidthInBits % 8 == 0);
29212923
auto DbgTy = DebugTypeInfo::getTypeMetadata(
29222924
getMetadataType(Name)->getDeclaredInterfaceType().getPointer(),
2923-
Metadata->getType(), Size(CI.getTargetInfo().getPointerWidth(0)),
2925+
Metadata->getType(), Size(PtrWidthInBits / 8),
29242926
Alignment(CI.getTargetInfo().getPointerAlign(0)));
29252927
emitVariableDeclaration(IGF.Builder, Metadata, DbgTy, IGF.getDebugScope(),
29262928
{}, {OS.str().str(), 0, false},
@@ -2931,7 +2933,8 @@ void IRGenDebugInfoImpl::emitTypeMetadata(IRGenFunction &IGF,
29312933
ArtificialValue);
29322934
}
29332935

2934-
SILLocation::FilenameAndLocation IRGenDebugInfoImpl::decodeSourceLoc(SourceLoc SL) {
2936+
SILLocation::FilenameAndLocation
2937+
IRGenDebugInfoImpl::decodeSourceLoc(SourceLoc SL) {
29352938
auto &Cached = FilenameAndLocationCache[SL.getOpaquePointerValue()];
29362939
if (Cached.filename.empty())
29372940
Cached = sanitizeCodeViewFilenameAndLocation(SILLocation::decode(SL, SM));

test/DebugInfo/EagerTypeMetadata.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ public class C<T>
88
// CHECK: define {{.*}} @"$s17EagerTypeMetadata1CC1cyyxF"
99
// CHECK: %T = load %swift.type*, %swift.type**
1010
// CHECK-SAME: !dbg ![[LOC:[0-9]+]], !invariant.load
11-
// CHECK: ![[LOC]] = !DILocation(line: 0,
1211
var x = [i]
1312
}
1413
}
14+
// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "T",
15+
// CHECK-SAME: baseType: ![[PTRTY:[0-9]+]]
16+
// CHECK: ![[PTRTY]] = !DIDerivedType(tag: DW_TAG_pointer_type, name: "$sBpD", baseType: null, size: {{64|32}})
17+
// CHECK: ![[LOC]] = !DILocation(line: 0,
1518

0 commit comments

Comments
 (0)