[PATCH] D43689: [analyzer] Disable constructor inlining when lifetime extension through fields occurs.

Devin Coughlin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 24 11:08:49 PST 2018


dcoughlin accepted this revision.
dcoughlin added inline comments.
This revision is now accepted and ready to land.


================
Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h:70
+    /// by binding a smaller object within it to a reference.
+    bool IsTemporaryLifetimeExtendedViaSubobject = false;
 
----------------
Would you be willing to add a tiny code example to the comment? I.e., `const int &x = C().x`


================
Comment at: lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:177
+          assert(VD->getType()->isReferenceType());
+          if (VD->getType()->getPointeeType().getCanonicalType() !=
+              MTE->GetTemporaryExpr()->getType().getCanonicalType()) {
----------------
I *think* this is safe. But it seems like it would be more direct to use skipRValueSubobjectAdjustments() and check for sub-object adjustments since ultimately that is what you care about, right?


Repository:
  rC Clang

https://reviews.llvm.org/D43689





More information about the cfe-commits mailing list