diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2018-04-19 23:09:22 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2018-04-19 23:09:22 +0000 |
commit | 72da02fc30cd7ce6344107c8b33e48e6322f4d7e (patch) | |
tree | 198a1f89eef521f96e44d4366fb445b0eb9ada81 /clang/lib/Analysis/ConstructionContext.cpp | |
parent | 1707fa337468645d379048526f552fcfcf80eb01 (diff) | |
download | bcm5719-llvm-72da02fc30cd7ce6344107c8b33e48e6322f4d7e.tar.gz bcm5719-llvm-72da02fc30cd7ce6344107c8b33e48e6322f4d7e.zip |
[CFG] [analyzer] Don't treat argument constructors as temporary constructors.
Function argument constructors (that are used for passing objects into functions
by value) are completely unlike temporary object constructors, but we were
treating them as such because they are also wrapped into a CXXBindTemporaryExpr.
This patch adds a partial construction context layer for call argument values,
but doesn't proceed to transform it into an actual construction context yet.
This is tells the clients that we aren't supporting these constructors yet.
Differential Revision: https://reviews.llvm.org/D45650
llvm-svn: 330377
Diffstat (limited to 'clang/lib/Analysis/ConstructionContext.cpp')
-rw-r--r-- | clang/lib/Analysis/ConstructionContext.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Analysis/ConstructionContext.cpp b/clang/lib/Analysis/ConstructionContext.cpp index 9f3c00b2bc9..8656a1bbe09 100644 --- a/clang/lib/Analysis/ConstructionContext.cpp +++ b/clang/lib/Analysis/ConstructionContext.cpp @@ -79,6 +79,9 @@ const ConstructionContext *ConstructionContext::createFromLayers( ParentLayer->getTriggerStmt()))) { return create<TemporaryObjectConstructionContext>(C, BTE, MTE); } + // This is a constructor into a function argument. Not implemented yet. + if (auto *CE = dyn_cast<CallExpr>(ParentLayer->getTriggerStmt())) + return nullptr; // This is C++17 copy-elided construction into return statement. if (auto *RS = dyn_cast<ReturnStmt>(ParentLayer->getTriggerStmt())) { assert(!RS->getRetValue()->getType().getCanonicalType() @@ -114,6 +117,9 @@ const ConstructionContext *ConstructionContext::createFromLayers( assert(TopLayer->isLast()); return create<SimpleReturnedValueConstructionContext>(C, RS); } + // This is a constructor into a function argument. Not implemented yet. + if (auto *CE = dyn_cast<CallExpr>(TopLayer->getTriggerStmt())) + return nullptr; llvm_unreachable("Unexpected construction context with statement!"); } else if (const CXXCtorInitializer *I = TopLayer->getTriggerInit()) { assert(TopLayer->isLast()); |