]> granicus.if.org Git - clang/commitdiff
Enable the user to control whether CXXConstructExpr will be added as a
authorZhongxing Xu <xuzhongxing@foxmail.com>
Wed, 28 Dec 2011 04:38:46 +0000 (04:38 +0000)
committerZhongxing Xu <xuzhongxing@foxmail.com>
Wed, 28 Dec 2011 04:38:46 +0000 (04:38 +0000)
block-level expr. Currently CXXConstructExpr is always added as a block-level
expr. This caused two problems for the analyzer (and potentially for the
CFG-based codegen).
1. We have no way to know whether a ctor call is base or complete.
2. We have no way to know the destination object being contructed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147306 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/CFG.cpp

index 5bbccf53c54edae2bd64985122538f0a74841e79..df8d7011af0753caea50e51870b8cea0fea9f366 100644 (file)
@@ -2768,7 +2768,7 @@ CFGBlock *CFGBuilder::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E,
 CFGBlock *CFGBuilder::VisitCXXConstructExpr(CXXConstructExpr *C,
                                             AddStmtChoice asc) {
   autoCreateBlock();
-  if (!C->isElidable())
+  if (!C->isElidable() && asc.alwaysAdd(*this, C))
     appendStmt(Block, C);
 
   return VisitChildren(C);