diff options
author | Shafik Yaghmour <shafik.yaghmour@intel.com> | 2025-05-16 06:26:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-16 06:26:56 -0700 |
commit | dd32ad1c3787c51e72d496c03ab7948c98f93e06 (patch) | |
tree | 282668786213967dc8c614f9e26cb6008d22f520 /clang/lib/Lex/Preprocessor.cpp | |
parent | a07cc181cced04850a9e93fc9b57321c8b6ff408 (diff) | |
download | llvm-dd32ad1c3787c51e72d496c03ab7948c98f93e06.zip llvm-dd32ad1c3787c51e72d496c03ab7948c98f93e06.tar.gz llvm-dd32ad1c3787c51e72d496c03ab7948c98f93e06.tar.bz2 |
[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.
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 9ea7b95..4c2dbbe 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -759,6 +759,8 @@ void Preprocessor::HandlePoisonedIdentifier(Token & Identifier) { void Preprocessor::updateOutOfDateIdentifier(const IdentifierInfo &II) const { assert(II.isOutOfDate() && "not out of date"); + assert(getExternalSource() && + "getExternalSource() should not return nullptr"); getExternalSource()->updateOutOfDateIdentifier(II); } |