[PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt
Matthias Gehre via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 21 23:12:16 PDT 2015
mgehre updated this revision to Diff 38090.
mgehre added a comment.
Fix formatting
http://reviews.llvm.org/D13973
Files:
lib/Analysis/CFG.cpp
Index: lib/Analysis/CFG.cpp
===================================================================
--- lib/Analysis/CFG.cpp
+++ lib/Analysis/CFG.cpp
@@ -1942,7 +1942,15 @@
CFGBlock *CFGBuilder::VisitCompoundStmt(CompoundStmt *C) {
- addLocalScopeAndDtors(C);
+ LocalScope::const_iterator scopeBeginPos = ScopePos;
+ if (BuildOpts.AddImplicitDtors) {
+ addLocalScopeForStmt(C);
+ }
+ if(!C->body_empty() && !dyn_cast<ReturnStmt>(*C->body_rbegin())) {
+ // If the body ends with a ReturnStmt, the dtors will be added in VisitReturnStmt
+ addAutomaticObjDtors(ScopePos, scopeBeginPos, C);
+ }
+
CFGBlock *LastBlock = Block;
for (CompoundStmt::reverse_body_iterator I=C->body_rbegin(), E=C->body_rend();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13973.38090.patch
Type: text/x-patch
Size: 725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151022/05f9c75f/attachment.bin>
More information about the cfe-commits
mailing list