Skip to content

Commit b7f6f54

Browse files
committed
[Clang][Lex][NFC] Assert getExternalSource() in updateOutOfDateIdentifier
Static analysis flagged the unconditional access of getExternalSource(). We don't initialize ExternalSource during construction but via setExternalSource(). If this is not set it will violate the invariant covered by the assert.
1 parent 99e8d22 commit b7f6f54

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

clang/lib/Lex/Preprocessor.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,8 @@ void Preprocessor::HandlePoisonedIdentifier(Token & Identifier) {
759759

760760
void Preprocessor::updateOutOfDateIdentifier(const IdentifierInfo &II) const {
761761
assert(II.isOutOfDate() && "not out of date");
762+
assert(getExternalSource() &&
763+
"getExternalSource() should not return nullptr");
762764
getExternalSource()->updateOutOfDateIdentifier(II);
763765
}
764766

0 commit comments

Comments
 (0)