Skip to content

Commit 41549d3

Browse files
committed
[CHERI] Fix an assertion failure when in containsCapabilities when a member is an incomplete record.
This can only arise when an error has already occurred earlier in parsing.
1 parent 346072c commit 41549d3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

clang/lib/AST/ASTContext.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13558,9 +13558,14 @@ bool ASTContext::containsCapabilities(const RecordDecl *RD) const {
1355813558
const QualType Ty = i->getType();
1355913559
if (Ty->isCHERICapabilityType(*this))
1356013560
return true;
13561-
if (const RecordType *RT = Ty->getAs<RecordType>())
13561+
if (const RecordType *RT = Ty->getAs<RecordType>()) {
13562+
if (RT->isIncompleteType())
13563+
// This can only occur when an error has occurred earlier, so it
13564+
// isn't too important what we return.
13565+
return false;
1356213566
if (containsCapabilities(RT->getDecl()))
1356313567
return true;
13568+
}
1356413569
if (Ty->isArrayType() && containsCapabilities(Ty))
1356513570
return true;
1356613571
}

0 commit comments

Comments
 (0)