Skip to content

Commit d0c1d77

Browse files
shafikgithub-actions[bot]
authored andcommitted
Automerge: [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.
2 parents 556e871 + dd32ad1 commit d0c1d77

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)