diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-11-14 15:23:50 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-11-14 15:23:50 +0000 |
commit | 249c9458e2cc5b671634baefe8517d7598883a20 (patch) | |
tree | 4e96f8d8f3384d5731c3c8c43a143360e3354324 /lib/Analysis/CFG.cpp | |
parent | ff624c195e3a3f8dc697ead40bae78e84ca72c12 (diff) |
Revert r118991.
Elidable CXXConstructExpr should inhibit calling destructor for temporary
that is copied, not the one created. This is because eliding copy constructor
means that the object that was to be copied will be constructed directly in
memory the copy would be constructed in.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119044 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFG.cpp')
-rw-r--r-- | lib/Analysis/CFG.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index 42e081628d..ef67d3b957 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -2579,18 +2579,11 @@ CFGBlock *CFGBuilder::VisitBinaryOperatorForTemporaryDtors(BinaryOperator *E) { return RHSBlock ? RHSBlock : LHSBlock; } -static bool hasElidableCXXConstructExpr(CXXBindTemporaryExpr *E) { - if (CXXConstructExpr *CE = dyn_cast<CXXConstructExpr>(E->getSubExpr())) - if (CE->isElidable()) - return true; - return false; -} - CFGBlock *CFGBuilder::VisitCXXBindTemporaryExprForTemporaryDtors( CXXBindTemporaryExpr *E, bool BindToTemporary) { // First add destructors for temporaries in subexpression. CFGBlock *B = VisitForTemporaryDtors(E->getSubExpr()); - if (!BindToTemporary && !hasElidableCXXConstructExpr(E)) { + if (!BindToTemporary) { // If lifetime of temporary is not prolonged (by assigning to constant // reference) add destructor for it. autoCreateBlock(); |