diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index b6aed88c600..37e13801bda 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -1867,7 +1867,7 @@ void ExprEngine::VisitCommonDeclRefExpr(const Expr *Ex, const NamedDecl *D, const auto *MD = D ? dyn_cast<CXXMethodDecl>(D) : nullptr; const auto *DeclRefEx = dyn_cast<DeclRefExpr>(Ex); SVal V; - bool CaptureByReference = false; + bool IsReference; if (AMgr.options.shouldInlineLambdas() && DeclRefEx && DeclRefEx->refersToEnclosingVariableOrCapture() && MD && MD->getParent()->isLambda()) { @@ -1882,22 +1882,22 @@ void ExprEngine::VisitCommonDeclRefExpr(const Expr *Ex, const NamedDecl *D, // created in the lambda object. assert(VD->getType().isConstQualified()); V = state->getLValue(VD, LocCtxt); + IsReference = false; } else { Loc CXXThis = svalBuilder.getCXXThis(MD, LocCtxt->getCurrentStackFrame()); SVal CXXThisVal = state->getSVal(CXXThis); V = state->getLValue(FD, CXXThisVal); - if (FD->getType()->isReferenceType() && - !VD->getType()->isReferenceType()) - CaptureByReference = true; + IsReference = FD->getType()->isReferenceType(); } } else { V = state->getLValue(VD, LocCtxt); + IsReference = VD->getType()->isReferenceType(); } // For references, the 'lvalue' is the pointer address stored in the // reference region. - if (VD->getType()->isReferenceType() || CaptureByReference) { + if (IsReference) { if (const MemRegion *R = V.getAsRegion()) V = state->getSVal(R); else |