[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 23 07:34:20 PDT 2023


Manna marked an inline comment as done.
Manna added inline comments.


================
Comment at: clang/lib/Lex/PPDirectives.cpp:555
       while (true) {
         CurLexer->Lex(Tok);
 
----------------
tahonermann wrote:
> I don't think this change is sufficient. If `CurLexer` is null, then the `else` branch will be entered and an unconditional dereference occurs there as well. It looks like more analysis is needed, but perhaps the correct fix is to add a non-null assertion somewhere above.
Thank you @tahonermann for review and feedback. Yes, my analysis was wrong. 

>>perhaps the correct fix is to add a non-null assertion somewhere above.

It sounds reasonable to me. I have added an assert above.


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

https://reviews.llvm.org/D158293



More information about the cfe-commits mailing list