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

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 22 14:54:51 PDT 2023


erichkeane 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:
> > 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.


================
Comment at: clang/lib/CodeGen/CGObjCGNU.cpp:58
   /// used as arguments will necessarily be available at construction time.
-  LazyRuntimeFunction()
-      : CGM(nullptr), FunctionName(nullptr), Function(nullptr) {}
+  LazyRuntimeFunction() {}
 
----------------



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

https://reviews.llvm.org/D153589



More information about the cfe-commits mailing list