зеркало из https://github.com/microsoft/clang-1.git
When creating LVals for array entries, canonicalize entries with a 0 index.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50497 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
c0c3f5dbc9
Коммит
c52c89a5eb
|
@ -803,7 +803,15 @@ void GRExprEngine::VisitArraySubscriptExpr(ArraySubscriptExpr* A, NodeTy* Pred,
|
|||
ValueState* St = GetState(*I2);
|
||||
RVal BaseV = GetRVal(St, Base);
|
||||
RVal IdxV = GetRVal(St, Idx);
|
||||
RVal V = lval::ArrayOffset::Make(BasicVals, BaseV, IdxV);
|
||||
|
||||
// If IdxV is 0, return just BaseV.
|
||||
|
||||
bool useBase = false;
|
||||
|
||||
if (nonlval::ConcreteInt* IdxInt = dyn_cast<nonlval::ConcreteInt>(&IdxV))
|
||||
useBase = IdxInt->getValue() == 0;
|
||||
|
||||
RVal V = useBase ? BaseV : lval::ArrayOffset::Make(BasicVals, BaseV,IdxV);
|
||||
|
||||
if (asLVal)
|
||||
MakeNode(Dst, A, *I2, SetRVal(St, A, V));
|
||||
|
|
Загрузка…
Ссылка в новой задаче