[cfe-commits] r57739 - in /cfe/trunk/lib/Analysis: CFRefCount.cpp GRExprEngine.cpp GRSimpleVals.cpp
Ted Kremenek
kremenek at apple.com
Fri Oct 17 15:23:12 PDT 2008
Author: kremenek
Date: Fri Oct 17 17:23:12 2008
New Revision: 57739
URL: http://llvm.org/viewvc/llvm-project?rev=57739&view=rev
Log:
When conjuring symbols to recover path-sensitivity, don't conjure symbols that represent an entire struct. We need to implement struct temporaries as an actual "region", and then bind symbols to the FieldRegion of those temporaries.
Modified:
cfe/trunk/lib/Analysis/CFRefCount.cpp
cfe/trunk/lib/Analysis/GRExprEngine.cpp
cfe/trunk/lib/Analysis/GRSimpleVals.cpp
Modified: cfe/trunk/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFRefCount.cpp?rev=57739&r1=57738&r2=57739&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Fri Oct 17 17:23:12 2008
@@ -1518,13 +1518,20 @@
// Set the value of the variable to be a conjured symbol.
unsigned Count = Builder.getCurrentBlockCount();
QualType T = R->getType();
- SymbolID NewSym =
- Eng.getSymbolManager().getConjuredSymbol(*I, T, Count);
- state = state.SetSVal(*MR,
- Loc::IsLocType(T)
- ? cast<SVal>(loc::SymbolVal(NewSym))
- : cast<SVal>(nonloc::SymbolVal(NewSym)));
+ // FIXME: handle structs.
+ if (T->isIntegerType() || Loc::IsLocType(T)) {
+ SymbolID NewSym =
+ Eng.getSymbolManager().getConjuredSymbol(*I, T, Count);
+
+ state = state.SetSVal(*MR,
+ Loc::IsLocType(T)
+ ? cast<SVal>(loc::SymbolVal(NewSym))
+ : cast<SVal>(nonloc::SymbolVal(NewSym)));
+ }
+ else {
+ state = state.SetSVal(*MR, UnknownVal());
+ }
}
else
state = state.SetSVal(*MR, UnknownVal());
@@ -1566,13 +1573,18 @@
default:
assert (false && "Unhandled RetEffect."); break;
- case RetEffect::NoRet:
+ case RetEffect::NoRet: {
// Make up a symbol for the return value (not reference counted).
// FIXME: This is basically copy-and-paste from GRSimpleVals. We
// should compose behavior, not copy it.
- if (Ex->getType() != Eng.getContext().VoidTy) {
+ // FIXME: We eventually should handle structs and other compound types
+ // that are returned by value.
+
+ QualType T = Ex->getType();
+
+ if (T->isIntegerType() || Loc::IsLocType(T)) {
unsigned Count = Builder.getCurrentBlockCount();
SymbolID Sym = Eng.getSymbolManager().getConjuredSymbol(Ex, Count);
@@ -1584,6 +1596,7 @@
}
break;
+ }
case RetEffect::Alias: {
unsigned idx = RE.getIndex();
Modified: cfe/trunk/lib/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngine.cpp?rev=57739&r1=57738&r2=57739&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Fri Oct 17 17:23:12 2008
@@ -2038,8 +2038,10 @@
case BinaryOperator::Assign: {
// EXPERIMENTAL: "Conjured" symbols.
+ // FIXME: Handle structs.
+ QualType T = RHS->getType();
- if (RightV.isUnknown()) {
+ if (RightV.isUnknown() && (T->isIntegerType() || Loc::IsLocType(T))) {
unsigned Count = Builder->getCurrentBlockCount();
SymbolID Sym = SymMgr.getConjuredSymbol(B->getRHS(), Count);
Modified: cfe/trunk/lib/Analysis/GRSimpleVals.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRSimpleVals.cpp?rev=57739&r1=57738&r2=57739&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/GRSimpleVals.cpp (original)
+++ cfe/trunk/lib/Analysis/GRSimpleVals.cpp Fri Oct 17 17:23:12 2008
@@ -379,9 +379,11 @@
}
- // Make up a symbol for the return value of this function.
-
- if (CE->getType() != Eng.getContext().VoidTy) {
+ // Make up a symbol for the return value of this function.
+ // FIXME: We eventually should handle structs and other compound types
+ // that are returned by value.
+ QualType T = CE->getType();
+ if (T->isIntegerType() || Loc::IsLocType(T)) {
unsigned Count = Builder.getCurrentBlockCount();
SymbolID Sym = Eng.getSymbolManager().getConjuredSymbol(CE, Count);
More information about the cfe-commits
mailing list