diff options
| author | Artem Dergachev <artem.dergachev@gmail.com> | 2018-03-22 21:37:39 +0000 |
|---|---|---|
| committer | Artem Dergachev <artem.dergachev@gmail.com> | 2018-03-22 21:37:39 +0000 |
| commit | 317291e34031d61f0ac6a91647df3ac23d82f2a0 (patch) | |
| tree | 4d5a4a93b135aef048628d2a80de82074849b97d /clang/lib/StaticAnalyzer | |
| parent | d2e77472d1a3c5637c0056eaf2466e3512dc08ec (diff) | |
| download | bcm5719-llvm-317291e34031d61f0ac6a91647df3ac23d82f2a0.tar.gz bcm5719-llvm-317291e34031d61f0ac6a91647df3ac23d82f2a0.zip | |
[CFG] [analyzer] Add C++17-specific variable and return construction contexts.
In C++17 copy elision is mandatory for variable and return value constructors
(as long as it doesn't involve type conversion) which results in AST that does
not contain elidable constructors in their usual places. In order to provide
construction contexts in this scenario we need to cover more AST patterns.
This patch makes the CFG prepared for these scenarios by:
- Fork VariableConstructionContext and ReturnedValueConstructionContext into
two different sub-classes (each) one of which indicates the C++17 case and
contains a reference to an extra CXXBindTemporaryExpr.
- Allow CFGCXXRecordTypedCall element to accept VariableConstructionContext and
ReturnedValueConstructionContext as its context.
Differential Revision: https://reviews.llvm.org/D44597
llvm-svn: 328248
Diffstat (limited to 'clang/lib/StaticAnalyzer')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp index 7cf6896aa8b..07515b36470 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp @@ -196,7 +196,7 @@ ExprEngine::getRegionForConstructedObject(const CXXConstructExpr *CE, CallOpts.IsTemporaryCtorOrDtor = true; return MRMgr.getCXXTempObjectRegion(CE, LCtx); } - case ConstructionContext::ReturnedValueKind: { + case ConstructionContext::SimpleReturnedValueKind: { // The temporary is to be managed by the parent stack frame. // So build it in the parent stack frame if we're not in the // top frame of the analysis. @@ -211,6 +211,10 @@ ExprEngine::getRegionForConstructedObject(const CXXConstructExpr *CE, CallOpts.IsTemporaryCtorOrDtor = true; return MRMgr.getCXXTempObjectRegion(CE, TempLCtx); } + case ConstructionContext::CXX17ElidedCopyVariableKind: + case ConstructionContext::CXX17ElidedCopyReturnedValueKind: + // Not implemented yet. + break; } } // If we couldn't find an existing region to construct into, assume we're |

