Re: [PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-11-12 Thread Jordan Rose via cfe-commits
jordan_rose accepted this revision. jordan_rose added a comment. This revision is now accepted and ready to land. Let's just go with your simple version that makes the common case better. There are a lot of problems with `throw`, so I wouldn't worry about that right now. (By the way, we don't

Re: [PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-11-06 Thread Manuel Klimek via cfe-commits
klimek added a comment. > I currently see the following ways forward: > > 1. Extend this patch to cover also "throw", fixing case B) > 2. Do 1) plus loop over the whole body to also fix case C) > 3. Drop this patch and instead remove unreachable blocks after the whole CFG > has been

Re: [PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-11-02 Thread Jordan Rose via cfe-commits
jordan_rose added a subscriber: dcoughlin. jordan_rose added a comment. Hm. On the one hand, getting this right seems like a nice property, and even adding another loop wouldn't change the order of growth. On the other hand, not having the extra destructors seems like the same sort of property

Re: [PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-11-02 Thread Matthias Gehre via cfe-commits
mgehre added a comment. Basically, there are the following cases: A) void f() { S s; } Everything OK, only one (reachable) destructor is generated B) int f() { S s; return 1; } In current trunk, this first generates dtor in a block when visiting the CompoundStmt, and then

Re: [PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-11-01 Thread Manuel Klimek via cfe-commits
klimek added inline comments. Comment at: lib/Analysis/CFG.cpp:1949-1952 @@ +1948,6 @@ + } + if(!C->body_empty() && !dyn_cast(*C->body_rbegin())) { +// If the body ends with a ReturnStmt, the dtors will be added in VisitReturnStmt +addAutomaticObjDtors(ScopePos,

Re: [PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-11-01 Thread Manuel Klimek via cfe-commits
klimek added a reviewer: jordan_rose. klimek added a comment. +jordan for an opinion on whether we want to fix the more general case. My main problem is that while we're at it we need to fully understand the change anyway, and if somebody runs into this later, they'll need a long time

Re: [PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-11-01 Thread Matthias Gehre via cfe-commits
mgehre added inline comments. Comment at: lib/Analysis/CFG.cpp:1949-1952 @@ +1948,6 @@ + } + if (!C->body_empty() && !isa(*C->body_rbegin())) { +// If the body ends with a ReturnStmt, the dtors will be added in VisitReturnStmt +addAutomaticObjDtors(ScopePos,

Re: [PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-11-01 Thread Matthias Gehre via cfe-commits
mgehre added a comment. I see. Thinking about this, the same issue should also apply to a throw inside the compound stmt. And it's not only about suppressing the dtors but any CFG entries after return/throw. I'll prepare an updated patch. Manuel Klimek schrieb am So., 1. Nov.

Re: [PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-10-25 Thread Matthias Gehre via cfe-commits
mgehre updated this revision to Diff 38359. mgehre added a comment. Update for review comments http://reviews.llvm.org/D13973 Files: lib/Analysis/CFG.cpp test/Analysis/no-unreachable-dtors.cpp Index: test/Analysis/no-unreachable-dtors.cpp

Re: [PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-10-25 Thread Manuel Klimek via cfe-commits
klimek added inline comments. Comment at: lib/Analysis/CFG.cpp:1949-1952 @@ +1948,6 @@ + } + if(!C->body_empty() && !dyn_cast(*C->body_rbegin())) { +// If the body ends with a ReturnStmt, the dtors will be added in VisitReturnStmt +addAutomaticObjDtors(ScopePos,

Re: [PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-10-25 Thread Matthias Gehre via cfe-commits
mgehre added inline comments. Comment at: lib/Analysis/CFG.cpp:1949-1952 @@ +1948,6 @@ + } + if(!C->body_empty() && !dyn_cast(*C->body_rbegin())) { +// If the body ends with a ReturnStmt, the dtors will be added in VisitReturnStmt +addAutomaticObjDtors(ScopePos,

Re: [PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-10-25 Thread David Majnemer via cfe-commits
majnemer added a subscriber: majnemer. Comment at: lib/Analysis/CFG.cpp:1949 @@ +1948,3 @@ + } + if(!C->body_empty() && !dyn_cast(*C->body_rbegin())) { +// If the body ends with a ReturnStmt, the dtors will be added in VisitReturnStmt mgehre wrote: >

Re: [PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-10-23 Thread Manuel Klimek via cfe-commits
klimek added inline comments. Comment at: lib/Analysis/CFG.cpp:1949-1952 @@ +1948,6 @@ + } + if(!C->body_empty() && !dyn_cast(*C->body_rbegin())) { +// If the body ends with a ReturnStmt, the dtors will be added in VisitReturnStmt +addAutomaticObjDtors(ScopePos,

Re: [PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-10-22 Thread Matthias Gehre via cfe-commits
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 @@

Re: [PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-10-22 Thread Matthias Gehre via cfe-commits
mgehre updated this revision to Diff 38157. mgehre added a comment. Add test case http://reviews.llvm.org/D13973 Files: lib/Analysis/CFG.cpp test/Analysis/no-unreachable-dtors.cpp Index: test/Analysis/no-unreachable-dtors.cpp

Re: [PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-10-22 Thread Manuel Klimek via cfe-commits
klimek added a subscriber: klimek. klimek added a comment. A test that fails before this patch and passes afterwards is needed :) If you need help writing that test, let me know. http://reviews.llvm.org/D13973 ___ cfe-commits mailing list

[PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

2015-10-22 Thread Matthias Gehre via cfe-commits
mgehre created this revision. mgehre added a reviewer: krememek. mgehre added a subscriber: cfe-commits. VisitReturnStmt would create a new block with including Dtors, so the Dtors created in VisitCompoundStmts would be in an unreachable block. Example: struct S { ~S(); } void f() { S s;