[cfe-commits] r122396 - in /cfe/trunk: lib/Checker/GRExprEngine.cpp test/Analysis/misc-ps-region-store.cpp
Zhongxing Xu
xuzhongxing at gmail.com
Wed Dec 22 00:38:14 PST 2010
Author: zhongxingxu
Date: Wed Dec 22 02:38:13 2010
New Revision: 122396
URL: http://llvm.org/viewvc/llvm-project?rev=122396&view=rev
Log:
If the unary operator is prefix and an lvalue (in C++), bind
the location (l-value) to it.
Modified:
cfe/trunk/lib/Checker/GRExprEngine.cpp
cfe/trunk/test/Analysis/misc-ps-region-store.cpp
Modified: cfe/trunk/lib/Checker/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRExprEngine.cpp?rev=122396&r1=122395&r2=122396&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Checker/GRExprEngine.cpp Wed Dec 22 02:38:13 2010
@@ -2918,11 +2918,11 @@
for (ExplodedNodeSet::iterator I = Tmp.begin(), E = Tmp.end(); I!=E; ++I) {
const GRState* state = GetState(*I);
- SVal V1 = state->getSVal(Ex);
+ SVal loc = state->getSVal(Ex);
// Perform a load.
ExplodedNodeSet Tmp2;
- evalLoad(Tmp2, Ex, *I, state, V1);
+ evalLoad(Tmp2, Ex, *I, state, loc);
for (ExplodedNodeSet::iterator I2=Tmp2.begin(), E2=Tmp2.end();I2!=E2;++I2) {
@@ -2964,7 +2964,7 @@
// propagate that constraint.
if (Loc::IsLocType(U->getType())) {
DefinedOrUnknownSVal Constraint =
- svalBuilder.evalEQ(state, V2, svalBuilder.makeZeroVal(U->getType()));
+ svalBuilder.evalEQ(state, V2,svalBuilder.makeZeroVal(U->getType()));
if (!state->assume(Constraint, true)) {
// It isn't feasible for the original value to be null.
@@ -2979,10 +2979,15 @@
}
}
- state = state->BindExpr(U, U->isPostfix() ? V2 : Result);
+ // Since the lvalue-to-rvalue conversion is explicit in the AST,
+ // we bind an l-value if the operator is prefix and an lvalue (in C++).
+ if (U->isPrefix() && U->isLValue())
+ state = state->BindExpr(U, loc);
+ else
+ state = state->BindExpr(U, V2);
// Perform the store.
- evalStore(Dst, NULL, U, *I2, state, V1, Result);
+ evalStore(Dst, NULL, U, *I2, state, loc, Result);
}
}
}
Modified: cfe/trunk/test/Analysis/misc-ps-region-store.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps-region-store.cpp?rev=122396&r1=122395&r2=122396&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps-region-store.cpp (original)
+++ cfe/trunk/test/Analysis/misc-ps-region-store.cpp Wed Dec 22 02:38:13 2010
@@ -1,6 +1,5 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
-// XFAIL: *
// Test basic handling of references.
char &test1_aux();
More information about the cfe-commits
mailing list