Skip to content

Commit dd32ad1

Browse files
authored
[Clang][Lex][NFC] Assert getExternalSource() in updateOutOfDateIdentifier (#140137)
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 a07cc18 commit dd32ad1

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)