[cfe-commits] r111099 - in /cfe/trunk/lib/Checker: BasicStore.cpp RegionStore.cpp
Zhongxing Xu
xuzhongxing at gmail.com
Sun Aug 15 03:08:38 PDT 2010
Author: zhongxingxu
Date: Sun Aug 15 05:08:38 2010
New Revision: 111099
URL: http://llvm.org/viewvc/llvm-project?rev=111099&view=rev
Log:
Remove redundant method.
Modified:
cfe/trunk/lib/Checker/BasicStore.cpp
cfe/trunk/lib/Checker/RegionStore.cpp
Modified: cfe/trunk/lib/Checker/BasicStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/BasicStore.cpp?rev=111099&r1=111098&r2=111099&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/BasicStore.cpp (original)
+++ cfe/trunk/lib/Checker/BasicStore.cpp Sun Aug 15 05:08:38 2010
@@ -103,8 +103,6 @@
private:
SVal LazyRetrieve(Store store, const TypedRegion *R);
-
- ASTContext& getContext() { return StateMgr.getContext(); }
};
} // end anonymous namespace
@@ -228,8 +226,6 @@
return VBFactory.Add(B, R, V).getRoot();
}
- ASTContext &C = StateMgr.getContext();
-
// Special case: handle store of pointer values (Loc) to pointers via
// a cast to intXX_t*, void*, etc. This is needed to handle
// OSCompareAndSwap32Barrier/OSCompareAndSwap64Barrier.
@@ -238,7 +234,7 @@
// FIXME: Should check for index 0.
QualType T = ER->getLocationType();
- if (isHigherOrderRawPtr(T, C))
+ if (isHigherOrderRawPtr(T, Ctx))
R = ER->getSuperRegion();
}
Modified: cfe/trunk/lib/Checker/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/RegionStore.cpp?rev=111099&r1=111098&r2=111099&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/RegionStore.cpp (original)
+++ cfe/trunk/lib/Checker/RegionStore.cpp Sun Aug 15 05:08:38 2010
@@ -386,9 +386,6 @@
}
}
}
-
- // FIXME: Remove.
- ASTContext& getContext() { return StateMgr.getContext(); }
};
} // end anonymous namespace
@@ -758,7 +755,7 @@
return UnknownVal();
CharUnits RegionSize = CharUnits::fromQuantity(SizeInt->getSExtValue());
- CharUnits EleSize = getContext().getTypeSizeInChars(EleTy);
+ CharUnits EleSize = Ctx.getTypeSizeInChars(EleTy);
// If a variable is reinterpreted as a type that doesn't fit into a larger
// type evenly, round it down.
@@ -792,8 +789,7 @@
T = AT->getElementType();
SVal ZeroIdx = ValMgr.makeZeroArrayIndex();
- return loc::MemRegionVal(MRMgr.getElementRegion(T, ZeroIdx, ArrayR,
- getContext()));
+ return loc::MemRegionVal(MRMgr.getElementRegion(T, ZeroIdx, ArrayR, Ctx));
}
//===----------------------------------------------------------------------===//
@@ -826,7 +822,7 @@
case MemRegion::SymbolicRegionKind: {
const SymbolicRegion *SR = cast<SymbolicRegion>(MR);
SymbolRef Sym = SR->getSymbol();
- QualType T = Sym->getType(getContext());
+ QualType T = Sym->getType(Ctx);
QualType EleTy;
if (const PointerType *PT = T->getAs<PointerType>())
@@ -835,14 +831,14 @@
EleTy = T->getAs<ObjCObjectPointerType>()->getPointeeType();
SVal ZeroIdx = ValMgr.makeZeroArrayIndex();
- ER = MRMgr.getElementRegion(EleTy, ZeroIdx, SR, getContext());
+ ER = MRMgr.getElementRegion(EleTy, ZeroIdx, SR, Ctx);
break;
}
case MemRegion::AllocaRegionKind: {
const AllocaRegion *AR = cast<AllocaRegion>(MR);
- QualType EleTy = getContext().CharTy; // Create an ElementRegion of bytes.
+ QualType EleTy = Ctx.CharTy; // Create an ElementRegion of bytes.
SVal ZeroIdx = ValMgr.makeZeroArrayIndex();
- ER = MRMgr.getElementRegion(EleTy, ZeroIdx, AR, getContext());
+ ER = MRMgr.getElementRegion(EleTy, ZeroIdx, AR, Ctx);
break;
}
@@ -897,13 +893,13 @@
cast<nonloc::ConcreteInt>(ValMgr.convertToArrayIndex(*Offset)));
const MemRegion* NewER =
MRMgr.getElementRegion(ER->getElementType(), NewIdx,
- ER->getSuperRegion(), getContext());
+ ER->getSuperRegion(), Ctx);
return ValMgr.makeLoc(NewER);
}
if (0 == Base->getValue()) {
const MemRegion* NewER =
MRMgr.getElementRegion(ER->getElementType(), R,
- ER->getSuperRegion(), getContext());
+ ER->getSuperRegion(), Ctx);
return ValMgr.makeLoc(NewER);
}
}
@@ -983,7 +979,7 @@
if (isa<AllocaRegion>(MR) || isa<SymbolicRegion>(MR)) {
if (T.isNull()) {
const SymbolicRegion *SR = cast<SymbolicRegion>(MR);
- T = SR->getSymbol()->getType(getContext());
+ T = SR->getSymbol()->getType(Ctx);
}
MR = GetElementZeroRegion(MR, T);
}
@@ -1127,7 +1123,6 @@
if (const StringRegion *StrR=dyn_cast<StringRegion>(superR)) {
// FIXME: Handle loads from strings where the literal is treated as
// an integer, e.g., *((unsigned int*)"hello")
- ASTContext &Ctx = getContext();
QualType T = Ctx.getAsArrayType(StrR->getValueType())->getElementType();
if (T != Ctx.getCanonicalType(R->getElementType()))
return UnknownVal();
@@ -1384,7 +1379,6 @@
if (ER->getIndex().isZeroConstant()) {
if (const TypedRegion *superR =
dyn_cast<TypedRegion>(ER->getSuperRegion())) {
- ASTContext &Ctx = getContext();
QualType superTy = superR->getValueType();
QualType erTy = ER->getValueType();
@@ -1403,7 +1397,7 @@
else if (const SymbolicRegion *SR = dyn_cast<SymbolicRegion>(R)) {
// Binding directly to a symbolic region should be treated as binding
// to element 0.
- QualType T = SR->getSymbol()->getType(getContext());
+ QualType T = SR->getSymbol()->getType(Ctx);
// FIXME: Is this the right way to handle symbols that are references?
if (const PointerType *PT = T->getAs<PointerType>())
@@ -1455,7 +1449,7 @@
else if (T->isStructureOrClassType() || T->isArrayType()) {
// Set the default value to a zero constant when it is a structure
// or array. The type doesn't really matter.
- V = ValMgr.makeZeroVal(ValMgr.getContext().IntTy);
+ V = ValMgr.makeZeroVal(Ctx.IntTy);
}
else {
return store;
@@ -1467,7 +1461,6 @@
Store RegionStoreManager::BindArray(Store store, const TypedRegion* R,
SVal Init) {
- ASTContext &Ctx = getContext();
const ArrayType *AT =cast<ArrayType>(Ctx.getCanonicalType(R->getValueType()));
QualType ElementTy = AT->getElementType();
Optional<uint64_t> Size;
@@ -1504,7 +1497,7 @@
break;
SVal Idx = ValMgr.makeArrayIndex(i);
- const ElementRegion *ER = MRMgr.getElementRegion(ElementTy, Idx, R, getContext());
+ const ElementRegion *ER = MRMgr.getElementRegion(ElementTy, Idx, R, Ctx);
if (ElementTy->isStructureOrClassType())
store = BindStruct(store, ER, *VI);
More information about the cfe-commits
mailing list