Manna updated this revision to Diff 552347.
Manna retitled this revision from "[NFC][CLANG] Fix potential dereferencing of 
null return values" to "[NFC][Clang] Fix static code analyzer concern about 
null value dereference".
Manna added a comment.
Herald added subscribers: manas, ASDenysPetrov, dkrupp, donat.nagy, Szelethus, 
a.sidorin, baloghadamsoftware.

CurLexer is dereferenced and should not be null in 
clang::​Preprocessor::​SkipExcludedConditionalBlock(clang::​SourceLocation, 
clang::​SourceLocation, bool, bool, clang::​SourceLocation)

This patch adds  NULL value check for pointer CurLexer.


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
@@ -547,7 +547,7 @@
   } SkippingRangeState(*this);
 
   while (true) {
-    if (CurLexer->isDependencyDirectivesLexer()) {
+    if (CurLexer && CurLexer->isDependencyDirectivesLexer()) {
       CurLexer->LexDependencyDirectiveTokenWhileSkipping(Tok);
     } else {
       SkippingRangeState.beginLexPass();


Index: clang/lib/Lex/PPDirectives.cpp
===================================================================
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -547,7 +547,7 @@
   } SkippingRangeState(*this);
 
   while (true) {
-    if (CurLexer->isDependencyDirectivesLexer()) {
+    if (CurLexer && CurLexer->isDependencyDirectivesLexer()) {
       CurLexer->LexDependencyDirectiveTokenWhileSkipping(Tok);
     } else {
       SkippingRangeState.beginLexPass();
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to