summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
diff options
context:
space:
mode:
authorEnrico Pertoso <epertoso@google.com>2015-06-03 10:12:40 +0000
committerEnrico Pertoso <epertoso@google.com>2015-06-03 10:12:40 +0000
commitfaed801f6e718fa2ec2f062b734c2f37f3d00dd0 (patch)
tree9eb07d58e87a4ee62286b7a57399b14db872c7e8 /clang/lib/Analysis
parentc85ed8567c07156564e2c267d80440b613316c0d (diff)
downloadbcm5719-llvm-faed801f6e718fa2ec2f062b734c2f37f3d00dd0.tar.gz
bcm5719-llvm-faed801f6e718fa2ec2f062b734c2f37f3d00dd0.zip
Append CXXDefaultInitExpr's wrapped expression to the CFG when visiting a constructor initializer
Summary: This patch is part of http://llvm-reviews.chandlerc.com/D2181. In-class initializers are appended to the CFG when CFGBuilder::addInitializer is called. Reviewers: jordan_rose, rsmith Reviewed By: jordan_rose Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D2370 llvm-svn: 238913
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r--clang/lib/Analysis/CFG.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp
index 6f624ee4060..b2fdd278798 100644
--- a/clang/lib/Analysis/CFG.cpp
+++ b/clang/lib/Analysis/CFG.cpp
@@ -1095,6 +1095,19 @@ CFGBlock *CFGBuilder::addInitializer(CXXCtorInitializer *I) {
// generating destructors for the second time.
return Visit(cast<ExprWithCleanups>(Init)->getSubExpr());
}
+ if (BuildOpts.AddCXXDefaultInitExprInCtors) {
+ if (CXXDefaultInitExpr *Default = dyn_cast<CXXDefaultInitExpr>(Init)) {
+ // In general, appending the expression wrapped by a CXXDefaultInitExpr
+ // may cause the same Expr to appear more than once in the CFG. Doing it
+ // here is safe because there's only one initializer per field.
+ autoCreateBlock();
+ appendStmt(Block, Default);
+ if (Stmt *Child = Default->getExpr())
+ if (CFGBlock *R = Visit(Child))
+ Block = R;
+ return Block;
+ }
+ }
return Visit(Init);
}
OpenPOWER on IntegriCloud