]> granicus.if.org Git - clang/commitdiff
Remove loc::StringLiteralVal. Now we allocate regions for string literals in the...
authorZhongxing Xu <xuzhongxing@gmail.com>
Sun, 26 Oct 2008 02:27:21 +0000 (02:27 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Sun, 26 Oct 2008 02:27:21 +0000 (02:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58182 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/SVals.h
lib/Analysis/BasicConstraintManager.cpp
lib/Analysis/BasicStore.cpp
lib/Analysis/GRSimpleVals.cpp
lib/Analysis/RegionStore.cpp
lib/Analysis/SVals.cpp

index e3ca9689fe76c8b2838091a796996b20adfe4df2..b37233c35f676e02de7524094797b60ac904d9e4 100644 (file)
@@ -290,7 +290,7 @@ public:
 namespace loc {
   
 enum Kind { SymbolValKind, GotoLabelKind, MemRegionKind, FuncValKind,
-            ConcreteIntKind, StringLiteralValKind };
+            ConcreteIntKind };
 
 class SymbolVal : public Loc {
 public:
@@ -412,23 +412,6 @@ public:
   }
 };
   
-class StringLiteralVal : public Loc {
-public:
-  StringLiteralVal(StringLiteral* L) : Loc(StringLiteralValKind, L) {}
-  
-  StringLiteral* getLiteral() const { return (StringLiteral*) Data; }
-  
-  // Implement isa<T> support.
-  static inline bool classof(const SVal* V) {
-    return V->getBaseKind() == LocKind &&
-           V->getSubKind() == StringLiteralValKind;
-  }
-  
-  static inline bool classof(const Loc* V) {
-    return V->getSubKind() == StringLiteralValKind;
-  }
-};  
-  
 } // end clang::loc namespace
 } // end clang namespace  
 
index 8617ba650f381a4978a3513816bd568e426d2d26..ea13ea30f2c5b6bf42b78b46ba4f1aab0797286d 100644 (file)
@@ -151,7 +151,6 @@ const GRState* BasicConstraintManager::AssumeAux(const GRState* St, Loc Cond,
       
   case loc::FuncValKind:
   case loc::GotoLabelKind:
-  case loc::StringLiteralValKind:
     isFeasible = Assumption;
     return St;
 
index 67d919a6d6cb30dbab134d97df484bed4a9f534b..88959545028b45f7a65d3229cd2bf6f34b27d511 100644 (file)
@@ -125,7 +125,6 @@ SVal BasicStoreManager::getLValueField(const GRState* St, SVal Base,
       break;
       
     case loc::ConcreteIntKind:
-    case loc::StringLiteralValKind:
       // While these seem funny, this can happen through casts.
       // FIXME: What we should return is the field offset.  For example,
       //  add the field offset to the integer value.  That way funny things
@@ -178,10 +177,6 @@ SVal BasicStoreManager::Retrieve(Store St, Loc LV, QualType T) {
     case loc::FuncValKind:
       return LV;
       
-    case loc::StringLiteralValKind:
-      // FIXME: Implement better support for fetching characters from strings.
-      return UnknownVal();
-      
     default:
       assert (false && "Invalid Loc.");
       break;
index d0055e566514067af5956b70e8f9c32e21079fb5..a2a59f3e929b27d393fba5867c522b158fc170bb 100644 (file)
@@ -285,7 +285,6 @@ SVal GRSimpleVals::EvalEQ(GRExprEngine& Eng, Loc L, Loc R) {
     case loc::MemRegionKind:
     case loc::FuncValKind:
     case loc::GotoLabelKind:
-    case loc::StringLiteralValKind:
       return NonLoc::MakeIntTruthVal(BasicVals, L == R);
   }
   
@@ -344,7 +343,6 @@ SVal GRSimpleVals::EvalNE(GRExprEngine& Eng, Loc L, Loc R) {
     case loc::MemRegionKind:
     case loc::FuncValKind:
     case loc::GotoLabelKind:
-    case loc::StringLiteralValKind:
       return NonLoc::MakeIntTruthVal(BasicVals, L != R);
   }
   
index 84f543ede4505572be3f9f23bc1b33de4e5fafd3..0a31bc8f5d7710249eabc6b0f36ffd63b6c42463 100644 (file)
@@ -149,7 +149,6 @@ SVal RegionStoreManager::getLValueField(const GRState* St, SVal Base,
     return UndefinedVal();
 
   case loc::ConcreteIntKind:
-  case loc::StringLiteralValKind:
     // While these seem funny, this can happen through casts.
     // FIXME: What we should return is the field offset.  For example,
     //  add the field offset to the integer value.  That way funny things
@@ -227,9 +226,6 @@ SVal RegionStoreManager::Retrieve(Store S, Loc L, QualType T) {
   case loc::FuncValKind:
     return L;
 
-  case loc::StringLiteralValKind:
-    return UnknownVal();
-
   default:
     assert(false && "Invalid Location");
     break;
index 2382b759e578b05745ffb507dfb51a3ae71b83b3..236d857450c702c0a21f3e939463eb129540f90d 100644 (file)
@@ -261,10 +261,6 @@ SVal SVal::GetSymbolValue(SymbolManager& SymMgr, VarDecl* D) {
 
 Loc Loc::MakeVal(AddrLabelExpr* E) { return loc::GotoLabel(E->getLabel()); }
 
-Loc Loc::MakeVal(StringLiteral* S) {
-  return loc::StringLiteralVal(S);
-}
-
 //===----------------------------------------------------------------------===//
 // Pretty-Printing.
 //===----------------------------------------------------------------------===//
@@ -386,12 +382,6 @@ void Loc::print(std::ostream& Out) const {
           << cast<loc::FuncVal>(this)->getDecl()->getIdentifier()->getName();
       break;
       
-    case loc::StringLiteralValKind:
-      Out << "literal \""
-          << cast<loc::StringLiteralVal>(this)->getLiteral()->getStrData()
-          << "\"";
-      break;
-      
     default:
       assert (false && "Pretty-printing not implemented for this Loc.");
       break;
@@ -517,12 +507,6 @@ void Loc::print(llvm::raw_ostream& Out) const {
           << cast<loc::FuncVal>(this)->getDecl()->getIdentifier()->getName();
       break;
       
-    case loc::StringLiteralValKind:
-      Out << "literal \""
-          << cast<loc::StringLiteralVal>(this)->getLiteral()->getStrData()
-          << "\"";
-      break;
-      
     default:
       assert (false && "Pretty-printing not implemented for this Loc.");
       break;