diff options
Diffstat (limited to 'lib/StaticAnalyzer/Core/ExprEngineCXX.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/ExprEngineCXX.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp b/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp index 84001d3a0c..d3d2837fe5 100644 --- a/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp +++ b/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp @@ -34,9 +34,10 @@ void ExprEngine::CreateCXXTemporaryObject(const MaterializeTemporaryExpr *ME, // the expression to the location of the object. SVal V = state->getSVal(tempExpr, LCtx); - // If the object is a record, the constructor will have already created - // a temporary object region. If it is not, we need to copy the value over. - if (!ME->getType()->isRecordType()) { + // If the value is already a CXXTempObjectRegion, it is fine as it is. + // Otherwise, create a new CXXTempObjectRegion, and copy the value into it. + const MemRegion *MR = V.getAsRegion(); + if (!MR || !isa<CXXTempObjectRegion>(MR)) { const MemRegion *R = svalBuilder.getRegionManager().getCXXTempObjectRegion(ME, LCtx); |