[PATCH] D42672: [CFG] [analyzer] Heavier CFGConstructor elements.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 5 16:48:51 PST 2018


NoQ added inline comments.


================
Comment at: include/clang/Analysis/CFG.h:153
+
+  ConstructionContext() = default;
+  ConstructionContext(CXXConstructExpr *Constructor, Stmt *Trigger)
----------------
xazax.hun wrote:
> Maybe I am getting this wrong, but I think in this case the members will be default initialized and will get indeterminate values.
> See: http://en.cppreference.com/w/cpp/language/default_initialization
> > Default initialization is performed in three situations:
> > ..
> > 3) when a base class or a non-static data member is not mentioned in a constructor initializer list and that constructor is called.
> > 
> > 
> > The effects of default initialization are:
> > 
> > if T is a non-POD (until C++11) class type ...
> > 
> > if T is an array type, every element of the array is default-initialized;
> > 
> > otherwise, nothing is done: the objects with automatic storage duration (and their subobjects) are initialized to indeterminate values. 
Ew, right. I should be more careful (no idea how it works).


================
Comment at: lib/Analysis/CFG.cpp:4402
+          stmt = SE->getStmt();
+        else if (auto CE = BI->getAs<CFGConstructor>())
+          stmt = CE->getConstructor();
----------------
xazax.hun wrote:
> So this is one of the places where subclassing would help? Could you measure the compile time regression after making `CFGStmt`'s `isKind` more complex?
Yeah, any user of the new mode would be surprised that constructors are not statements, which is indeed annoying. But i wanted to play super safe.

I'm not seeing any compile time regressions yet after making `isKind` more complex - i.e. ran "`clang sqlite3.c`" release-without-asserts 100 times before and 100 times after, mean compilation time difference around 0.04% (in the bad direction, i.e. after-time is 0.04% worse than before-time), p-value (Welch's t-test) around 0.7. I guess i could probably run llvm compilation before and after for more coverage, but that wouldn't be statistically reliable.

Do we have any more reliable benchmarks?


https://reviews.llvm.org/D42672





More information about the cfe-commits mailing list