forked from OSchip/llvm-project
[analyzer] Don't dereference the array value when binding it to a reference.
This replaces the hack in r291754, which was fixing pr31592, which was caused by r291754, with a more appropriate solution. rdar://problem/28832541 Differential revision: https://reviews.llvm.org/D28602 llvm-svn: 291781
This commit is contained in:
parent
18e165f50d
commit
1d4fb84d82
|
@ -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;
|
||||
|
|
|
@ -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()) {
|
||||
|
|
Loading…
Reference in New Issue