From 3e31c26f8195b2fd61b05e58ceb8a2d6ca43a4a4 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 26 Mar 2009 03:35:11 +0000 Subject: analyzer infrastructure: make a bunch of changes to symbolic expressions that Zhongxing and I discussed by email. Main changes: - Removed SymIntConstraintVal and SymIntConstraint - Added SymExpr as a parent class to SymbolData, SymSymExpr, SymIntExpr - Added nonloc::SymExprVal to wrap SymExpr - SymbolRef is now just a typedef of 'const SymbolData*' - Bunch of minor code cleanups in how some methods were invoked (no functionality change) This changes are part of a long-term plan to have full symbolic expression trees. This will be useful for lazily evaluating complicated expressions. llvm-svn: 67731 --- clang/lib/Analysis/MemRegion.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'clang/lib/Analysis/MemRegion.cpp') diff --git a/clang/lib/Analysis/MemRegion.cpp b/clang/lib/Analysis/MemRegion.cpp index 5bfc989eb80..738e8c67d69 100644 --- a/clang/lib/Analysis/MemRegion.cpp +++ b/clang/lib/Analysis/MemRegion.cpp @@ -112,10 +112,8 @@ void ElementRegion::Profile(llvm::FoldingSetNodeID& ID) const { //===----------------------------------------------------------------------===// QualType SymbolicRegion::getRValueType(ASTContext& C) const { - const SymbolData& data = SymMgr.getSymbolData(sym); - // Get the type of the symbol. - QualType T = data.getType(C); + QualType T = sym->getType(C); if (const PointerType* PTy = T->getAsPointerType()) return PTy->getPointeeType(); @@ -132,8 +130,7 @@ QualType SymbolicRegion::getRValueType(ASTContext& C) const { } QualType SymbolicRegion::getLValueType(ASTContext& C) const { - const SymbolData& data = SymMgr.getSymbolData(sym); - return data.getType(C); + return sym->getType(C); } QualType ElementRegion::getRValueType(ASTContext& C) const { @@ -332,12 +329,9 @@ MemRegionManager::getElementRegion(SVal Idx, const TypedRegion* superRegion){ } /// getSymbolicRegion - Retrieve or create a "symbolic" memory region. -SymbolicRegion* MemRegionManager::getSymbolicRegion(const SymbolRef sym, - const SymbolManager& mgr) { - +SymbolicRegion* MemRegionManager::getSymbolicRegion(SymbolRef sym) { llvm::FoldingSetNodeID ID; SymbolicRegion::ProfileRegion(ID, sym); - void* InsertPos; MemRegion* data = Regions.FindNodeOrInsertPos(ID, InsertPos); SymbolicRegion* R = cast_or_null(data); @@ -345,7 +339,7 @@ SymbolicRegion* MemRegionManager::getSymbolicRegion(const SymbolRef sym, if (!R) { R = (SymbolicRegion*) A.Allocate(); // SymbolicRegion's storage class is usually unknown. - new (R) SymbolicRegion(sym, mgr, getUnknownRegion()); + new (R) SymbolicRegion(sym, getUnknownRegion()); Regions.InsertNode(R, InsertPos); } -- cgit v1.2.3