[PATCH] D153589: [NFC] Initialize pointer fields and remove a needless null check.

Sindhu Chittireddy via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 22 14:49:49 PDT 2023


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


================
Comment at: clang/lib/Analysis/CFG.cpp:4156
   // CFG generation for unevaluated operands.
-  if (S && !S->isTypeDependent() && S->isPotentiallyEvaluated())
+  if (!S->isTypeDependent() && S->isPotentiallyEvaluated())
     return VisitChildren(S);
----------------
erichkeane wrote:
> I get that we're counting on the dereference on 4145 to have made this check irrelevant, but are we sure that we KNOW that "S" is non-null here otherwise?  That is, is the bug actually 4145 doing 'alwaysAdd' without checking vs the unnecessary check here?
VisitCXXTypeidExpr is used only in one place - here https://github.com/llvm/llvm-project/blob/a89c9b35be08b665cc1a01d840bc20349ba1308f/clang/lib/Analysis/CFG.cpp#L2288 where S is not null. Null check for S already happens at the beginning of the method where VisitCXXTypeidExpr is called. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153589



More information about the cfe-commits mailing list