[PATCH] D39031: [Analyzer] Correctly handle parameters passed by reference when bodyfarming std::call_once

Devin Coughlin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 20 11:00:37 PDT 2017


dcoughlin accepted this revision.
dcoughlin added a comment.
This revision is now accepted and ready to land.

Some nits inline, but looks good to me!



================
Comment at: lib/Analysis/BodyFarm.cpp:388
+  // reference.
+  for (unsigned int i = 2; i < D->getNumParams(); i++) {
+
----------------
Nit: 'i' doesn't match the naming conventions and it is not particularly descriptive. Perhaps "ParamIndex"?


================
Comment at: lib/Analysis/BodyFarm.cpp:391
+    const ParmVarDecl *PDecl = D->getParamDecl(i);
+    QualType PTy = PDecl->getType().getNonReferenceType();
+    Expr *ParamExpr = M.makeDeclRefExpr(PDecl);
----------------
Nit: You can move PTy inside the if block so it is not calculated when it is not needed.


https://reviews.llvm.org/D39031





More information about the cfe-commits mailing list