Skip to content

Commit aefb176

Browse files
committed
[clang][AST] Temporarily disable assert in getInjectedClassNameType
When LLDB ASTImports a class declaration it will create a new default-constructed RecordDecl. Such a default-constructerd decl doesn't have its `TypeForDecl` set correctly yet. To determine the `TypeForDecl`, ASTImporter calls DeclContext::lookup() on the new decl. If we have an external source like the ASTReader installed on the ASTContext, we can end up calling into getInjectedClassNameType. If the external source created a redeclaration chain between this new ASTImporter decl and the external one, we can end up temporarily setting the `TypeForDecl` to one that is not an `InjectedClassNameType`. This invariant is only briefly violated and later corrected by the ASTImporter. But at that point we already tripped this assert during `DeclContext::lookup()`. Because this potentially requires significant/risky changes to LLDB, disable this assert for now in order to unblock swift compiler devs working with nightly (i.e., assert-enabled) builds of LLDB. rdar://109876539
1 parent 6cad9c0 commit aefb176

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang/lib/AST/ASTContext.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4612,7 +4612,8 @@ QualType ASTContext::getInjectedClassNameType(CXXRecordDecl *Decl,
46124612
} else if (CXXRecordDecl *PrevDecl = Decl->getPreviousDecl()) {
46134613
assert(PrevDecl->TypeForDecl && "previous declaration has no type");
46144614
Decl->TypeForDecl = PrevDecl->TypeForDecl;
4615-
assert(isa<InjectedClassNameType>(Decl->TypeForDecl));
4615+
// FIXME: rdar://109876539
4616+
// assert(isa<InjectedClassNameType>(Decl->TypeForDecl));
46164617
} else {
46174618
Type *newType =
46184619
new (*this, TypeAlignment) InjectedClassNameType(Decl, TST);

0 commit comments

Comments
 (0)