Skip to content

Commit e74aeed

Browse files
committed
Add an assertion that verifies the size of cached debug info types.
Not yet enabled since it triggers when building Concurrency. rdar://102367872
1 parent 8921b10 commit e74aeed

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,8 +1780,16 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
17801780
return createType(DbgTy, "", TheCU, MainFile);
17811781

17821782
// Look in the cache first.
1783-
if (auto *DITy = getTypeOrNull(DbgTy.getType()))
1783+
if (auto *DITy = getTypeOrNull(DbgTy.getType())) {
1784+
// FIXME: Enable this assertion.
1785+
#if SWIFT_DEBUGINFO_CACHE_VERIFICATION
1786+
if (auto CachedSize = DbgTy.getTypeSize()) {
1787+
if (unsigned Size = getSizeInBits(DITy))
1788+
assert(llvm::alignTo(Size, 8) / 8 == CachedSize->getValue());
1789+
}
1790+
#endif
17841791
return DITy;
1792+
}
17851793

17861794
// Second line of defense: Look up the mangled name. TypeBase*'s are
17871795
// not necessarily unique, but name mangling is too expensive to do
@@ -2084,7 +2092,6 @@ void IRGenDebugInfoImpl::setCurrentLoc(IRBuilder &Builder,
20842092
Scope = DBuilder.createLexicalBlockFile(Scope, File);
20852093
}
20862094

2087-
// FIXME: Enable this assertion.
20882095
assert(lineEntryIsSane(L, DS) &&
20892096
"non-contiguous debug location in same scope at -Onone");
20902097
LastFilenameAndLocation = L;

0 commit comments

Comments
 (0)