[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
Mon Jun 26 13:33:06 PDT 2023


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);
----------------
schittir wrote:
> erichkeane wrote:
> > schittir wrote:
> > > erichkeane wrote:
> > > > schittir wrote:
> > > > > 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. 
> > > > SG, an assert is perhaps not a bad idea, but LGTM.  I don't know very much about the CFG stuff, so aaron might wish to take a final look.
> > > What is SG? 
> > "Sounds Good"
> Haha! 
> Thanks for the review. 
> SG, an assert is perhaps not a bad idea, but LGTM.  I don't know very much about the CFG stuff, so aaron might wish to take a final look.

Hi @aaron.ballman, could you please comment on this? Thank you!


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

https://reviews.llvm.org/D153589



More information about the cfe-commits mailing list