diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2018-02-15 03:13:36 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2018-02-15 03:13:36 +0000 |
commit | 1f68d9d39ea3c095063d5bab0f13c28bff367c79 (patch) | |
tree | e45c6b7ab8a21d18a48d15cd045f5a11e8ac41a1 /clang/lib/Analysis/CFG.cpp | |
parent | 168e29f6af138ccd1d8919164cae71a15ae735d1 (diff) | |
download | bcm5719-llvm-1f68d9d39ea3c095063d5bab0f13c28bff367c79.tar.gz bcm5719-llvm-1f68d9d39ea3c095063d5bab0f13c28bff367c79.zip |
[CFG] Provide construction contexts for temproary objects.
Constructors of C++ temporary objects that have destructors now can be queried
to discover that they're indeed constructing temporary objects.
The respective CXXBindTemporaryExpr, which is also repsonsible for destroying
the temporary at the end of full-expression, is now available at the
construction site in the CFG. This is all the context we need to provide for
temporary objects that are not lifetime extended. For lifetime-extended
temporaries, more context is necessary.
Differential Revision: https://reviews.llvm.org/D43056
llvm-svn: 325210
Diffstat (limited to 'clang/lib/Analysis/CFG.cpp')
-rw-r--r-- | clang/lib/Analysis/CFG.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp index 9fe9ad11bf3..d2d1917c468 100644 --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -3923,6 +3923,8 @@ CFGBlock *CFGBuilder::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E, autoCreateBlock(); appendStmt(Block, E); + EnterConstructionContextIfNecessary(E, E->getSubExpr()); + // We do not want to propagate the AlwaysAdd property. asc = asc.withAlwaysAdd(false); } @@ -3992,7 +3994,7 @@ CFGBlock *CFGBuilder::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E, CFGBlock *CFGBuilder::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *C, AddStmtChoice asc) { autoCreateBlock(); - appendStmt(Block, C); + appendConstructor(Block, C); return VisitChildren(C); } |