[PATCH] D158293: [NFC][Clang] Fix static code analyzer concern about null value dereference

Soumi Manna via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 30 12:55:19 PDT 2023


Manna updated this revision to Diff 554810.
Manna added a comment.

This patch splits all predicates and updates assert messages.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158293/new/

https://reviews.llvm.org/D158293

Files:
  clang/lib/Lex/PPDirectives.cpp


Index: clang/lib/Lex/PPDirectives.cpp
===================================================================
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -491,7 +491,9 @@
   llvm::SaveAndRestore SARSkipping(SkippingExcludedConditionalBlock, true);
 
   ++NumSkipped;
-  assert(!CurTokenLexer && CurPPLexer && "Lexing a macro, not a file?");
+  assert(!CurTokenLexer && "Conditional PP block cannot appear in a macro!");
+  assert(CurPPLexer && "Conditional PP block must be in a file!");
+  assert(CurLexer && "Conditional PP block but no current lexer set!");
 
   if (PreambleConditionalStack.reachedEOFWhileSkipping())
     PreambleConditionalStack.clearSkipInfo();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158293.554810.patch
Type: text/x-patch
Size: 694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230830/3abeb666/attachment.bin>


More information about the cfe-commits mailing list