[clang] [ClangScanDeps] Avoid use-of-uninitialized-memory for end-of-directive edge case (PR #188590)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 26 08:57:54 PDT 2026
================
@@ -466,6 +466,9 @@ SourceLocation
Preprocessor::CheckEndOfDirective(StringRef DirType, bool EnableMacros,
SmallVectorImpl<Token> *ExtraToks) {
Token Tmp;
+ // Avoid use-of-uninitialized-memory for edge case(s) where there is no extra
+ // token to be parsed.
+ Tmp.setKind(tok::eod);
----------------
yronglin wrote:
This fix looks make sense. Can we use `Tmp.startToken();` instead? Then other members in `Token` will be initialized too. WDYT?
https://github.com/llvm/llvm-project/pull/188590
More information about the cfe-commits
mailing list