summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp6
-rw-r--r--lib/StaticAnalyzer/Core/ExprEngine.cpp5
2 files changed, 3 insertions, 8 deletions
diff --git a/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp b/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp
index a98d379bb8..152b937bb0 100644
--- a/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp
@@ -253,12 +253,6 @@ void DereferenceChecker::checkBind(SVal L, SVal V, const Stmt *S,
if (!TVR->getValueType()->isReferenceType())
return;
- // FIXME: This is a hotfix for https://llvm.org/bugs/show_bug.cgi?id=31592
- // A proper fix is very much necessary. Otherwise we would never normally bind
- // a NonLoc to a reference.
- if (V.getAs<NonLoc>())
- return;
-
ProgramStateRef State = C.getState();
ProgramStateRef StNonNull, StNull;
diff --git a/lib/StaticAnalyzer/Core/ExprEngine.cpp b/lib/StaticAnalyzer/Core/ExprEngine.cpp
index 0dd8469f27..d563f8e9ea 100644
--- a/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -515,8 +515,9 @@ void ExprEngine::ProcessInitializer(const CFGInitializer Init,
Init = ASE->getBase()->IgnoreImplicit();
SVal LValue = State->getSVal(Init, stackFrame);
- if (Optional<Loc> LValueLoc = LValue.getAs<Loc>())
- InitVal = State->getSVal(*LValueLoc);
+ if (!Field->getType()->isReferenceType())
+ if (Optional<Loc> LValueLoc = LValue.getAs<Loc>())
+ InitVal = State->getSVal(*LValueLoc);
// If we fail to get the value for some reason, use a symbolic value.
if (InitVal.isUnknownOrUndef()) {