[llvm-branch-commits] [cfe-branch] r71340 - in /cfe/branches/Apple/Dib: include/clang/Analysis/PathSensitive/GRState.h include/clang/Analysis/PathSensitive/MemRegion.h lib/Analysis/BasicObjCFoundationChecks.cpp lib/Analysis/BasicStore.cpp lib/Analysis/CFRefCount.cpp lib/Analysis/GRExprEngine.cpp lib/Analysis/MemRegion.cpp lib/Analysis/RegionStore.cpp lib/Analysis/SVals.cpp lib/Analysis/Store.cpp lib/Analysis/SymbolManager.cpp

Mike Stump mrs at apple.com
Fri May 8 23:22:20 PDT 2009


Author: mrs
Date: Sat May  9 01:22:19 2009
New Revision: 71340

URL: http://llvm.org/viewvc/llvm-project?rev=71340&view=rev
Log:
Merge in 71304:

rename: MemRegion:
 RValueType => ObjectType
 LValueType => LocationType

No functionality change.

Modified:
    cfe/branches/Apple/Dib/include/clang/Analysis/PathSensitive/GRState.h
    cfe/branches/Apple/Dib/include/clang/Analysis/PathSensitive/MemRegion.h
    cfe/branches/Apple/Dib/lib/Analysis/BasicObjCFoundationChecks.cpp
    cfe/branches/Apple/Dib/lib/Analysis/BasicStore.cpp
    cfe/branches/Apple/Dib/lib/Analysis/CFRefCount.cpp
    cfe/branches/Apple/Dib/lib/Analysis/GRExprEngine.cpp
    cfe/branches/Apple/Dib/lib/Analysis/MemRegion.cpp
    cfe/branches/Apple/Dib/lib/Analysis/RegionStore.cpp
    cfe/branches/Apple/Dib/lib/Analysis/SVals.cpp
    cfe/branches/Apple/Dib/lib/Analysis/Store.cpp
    cfe/branches/Apple/Dib/lib/Analysis/SymbolManager.cpp

Modified: cfe/branches/Apple/Dib/include/clang/Analysis/PathSensitive/GRState.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/include/clang/Analysis/PathSensitive/GRState.h?rev=71340&r1=71339&r2=71340&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/include/clang/Analysis/PathSensitive/GRState.h (original)
+++ cfe/branches/Apple/Dib/include/clang/Analysis/PathSensitive/GRState.h Sat May  9 01:22:19 2009
@@ -513,7 +513,7 @@
       return UnknownVal();
     
     if (const TypedRegion *TR = dyn_cast<TypedRegion>(R)) {
-      QualType T = TR->getRValueType(getContext());
+      QualType T = TR->getObjectType(getContext());
       if (Loc::IsLocType(T) || T->isIntegerType())
         return GetSVal(state, R);
     }

Modified: cfe/branches/Apple/Dib/include/clang/Analysis/PathSensitive/MemRegion.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/include/clang/Analysis/PathSensitive/MemRegion.h?rev=71340&r1=71339&r2=71340&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/include/clang/Analysis/PathSensitive/MemRegion.h (original)
+++ cfe/branches/Apple/Dib/include/clang/Analysis/PathSensitive/MemRegion.h Sat May  9 01:22:19 2009
@@ -148,24 +148,24 @@
   TypedRegion(const MemRegion* sReg, Kind k) : SubRegion(sReg, k) {}
   
 public:
-  virtual QualType getRValueType(ASTContext &C) const = 0;
+  virtual QualType getObjectType(ASTContext &C) const = 0;
   
-  virtual QualType getLValueType(ASTContext& C) const {
+  virtual QualType getLocationType(ASTContext& C) const {
     // FIXME: We can possibly optimize this later to cache this value.
-    return C.getPointerType(getRValueType(C));
+    return C.getPointerType(getObjectType(C));
   }
   
-  QualType getDesugaredRValueType(ASTContext& C) const {
-    QualType T = getRValueType(C);
+  QualType getDesugaredObjectType(ASTContext& C) const {
+    QualType T = getObjectType(C);
     return T.getTypePtr() ? T->getDesugaredType() : T;
   }
   
-  QualType getDesugaredLValueType(ASTContext& C) const {
-    return getLValueType(C)->getDesugaredType();
+  QualType getDesugaredLocationType(ASTContext& C) const {
+    return getLocationType(C)->getDesugaredType();
   }
 
   bool isBoundable(ASTContext &C) const {
-    return !getRValueType(C).isNull();
+    return !getObjectType(C).isNull();
   }
 
   static bool classof(const MemRegion* R) {
@@ -206,13 +206,13 @@
       Data(sym),
       LocationType(t) {}
 
-  QualType getRValueType(ASTContext &C) const {
+  QualType getObjectType(ASTContext &C) const {
     // Do not get the object type of a CodeTextRegion.
     assert(0);
     return QualType();
   }
 
-  QualType getLValueType(ASTContext &C) const {
+  QualType getLocationType(ASTContext &C) const {
     return LocationType;
   }
 
@@ -287,7 +287,9 @@
 
   const StringLiteral* getStringLiteral() const { return Str; }
     
-  QualType getRValueType(ASTContext& C) const;
+  QualType getObjectType(ASTContext& C) const {
+    return Str->getType();
+  }
 
   void Profile(llvm::FoldingSetNodeID& ID) const {
     ProfileRegion(ID, Str, superRegion);
@@ -314,11 +316,11 @@
 
   void print(llvm::raw_ostream& os) const;
   
-  QualType getLValueType(ASTContext&) const {
+  QualType getLocationType(ASTContext&) const {
     return LValueType;
   }
 
-  QualType getRValueType(ASTContext&) const {
+  QualType getObjectType(ASTContext&) const {
     const PointerType* PTy = LValueType->getAsPointerType();
     assert(PTy);
     return PTy->getPointeeType();
@@ -355,7 +357,7 @@
                             const CompoundLiteralExpr* CL,
                             const MemRegion* superRegion);
 public:
-  QualType getRValueType(ASTContext& C) const {
+  QualType getObjectType(ASTContext& C) const {
     return C.getCanonicalType(CL->getType());
   }
   
@@ -384,8 +386,6 @@
   const Decl* getDecl() const { return D; }
   void Profile(llvm::FoldingSetNodeID& ID) const;
       
-  QualType getRValueType(ASTContext& C) const = 0;
-  
   static bool classof(const MemRegion* R) {
     unsigned k = R->getKind();
     return k > BEG_DECL_REGIONS && k < END_DECL_REGIONS;
@@ -406,7 +406,7 @@
 public:  
   const VarDecl* getDecl() const { return cast<VarDecl>(D); }  
   
-  QualType getRValueType(ASTContext& C) const { 
+  QualType getObjectType(ASTContext& C) const { 
     // FIXME: We can cache this if needed.
     return C.getCanonicalType(getDecl()->getType());
   }    
@@ -430,7 +430,7 @@
   
   const FieldDecl* getDecl() const { return cast<FieldDecl>(D); }
     
-  QualType getRValueType(ASTContext& C) const { 
+  QualType getObjectType(ASTContext& C) const { 
     // FIXME: We can cache this if needed.
     return C.getCanonicalType(getDecl()->getType());
   }    
@@ -462,7 +462,7 @@
     return cast<ObjCInterfaceDecl>(D);
   }
   
-  QualType getRValueType(ASTContext& C) const {
+  QualType getObjectType(ASTContext& C) const {
     return C.getObjCInterfaceType(getInterface());
   }
   
@@ -485,7 +485,7 @@
   
 public:
   const ObjCIvarDecl* getDecl() const { return cast<ObjCIvarDecl>(D); }
-  QualType getRValueType(ASTContext&) const { return getDecl()->getType(); }
+  QualType getObjectType(ASTContext&) const { return getDecl()->getType(); }
   
   static bool classof(const MemRegion* R) {
     return R->getKind() == ObjCIvarRegionKind;
@@ -513,7 +513,7 @@
 
   SVal getIndex() const { return Index; }
 
-  QualType getRValueType(ASTContext&) const {
+  QualType getObjectType(ASTContext&) const {
     return ElementType;
   }
   

Modified: cfe/branches/Apple/Dib/lib/Analysis/BasicObjCFoundationChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Analysis/BasicObjCFoundationChecks.cpp?rev=71340&r1=71339&r2=71340&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Analysis/BasicObjCFoundationChecks.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Analysis/BasicObjCFoundationChecks.cpp Sat May  9 01:22:19 2009
@@ -417,7 +417,7 @@
     if (!R) return false;
   }
   
-  QualType T = Ctx.getCanonicalType(R->getRValueType(Ctx));
+  QualType T = Ctx.getCanonicalType(R->getObjectType(Ctx));
   
   // FIXME: If the pointee isn't an integer type, should we flag a warning?
   //  People can do weird stuff with pointers.

Modified: cfe/branches/Apple/Dib/lib/Analysis/BasicStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Analysis/BasicStore.cpp?rev=71340&r1=71339&r2=71340&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Analysis/BasicStore.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Analysis/BasicStore.cpp Sat May  9 01:22:19 2009
@@ -290,7 +290,7 @@
         // Just support void**, void***, intptr_t*, intptr_t**, etc., for now.
         // This is needed to handle OSCompareAndSwapPtr() and friends.
         ASTContext &Ctx = StateMgr.getContext();
-        QualType T = ER->getLValueType(Ctx);
+        QualType T = ER->getLocationType(Ctx);
 
         if (!isHigherOrderRawPtr(T, Ctx))
           return UnknownVal();
@@ -334,7 +334,7 @@
       if (isa<Loc>(V) || isa<nonloc::LocAsInteger>(V))
         if (const ElementRegion *ER = dyn_cast<ElementRegion>(R)) {
           // FIXME: Should check for index 0.
-          QualType T = ER->getLValueType(C);
+          QualType T = ER->getLocationType(C);
         
           if (isHigherOrderRawPtr(T, C))
             R = ER->getSuperRegion();
@@ -357,7 +357,7 @@
         // elsewhere. Food for thought.
         if (const TypedRegion *TyR = dyn_cast<TypedRegion>(R)) {
           if (TyR->isBoundable(C) &&
-              Loc::IsLocType(TyR->getRValueType(C)))              
+              Loc::IsLocType(TyR->getObjectType(C)))              
             V = X->getLoc();
         }
       }

Modified: cfe/branches/Apple/Dib/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Analysis/CFRefCount.cpp?rev=71340&r1=71339&r2=71340&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Analysis/CFRefCount.cpp Sat May  9 01:22:19 2009
@@ -2612,7 +2612,7 @@
           if (R->isBoundable(Ctx)) {
             // Set the value of the variable to be a conjured symbol.
             unsigned Count = Builder.getCurrentBlockCount();
-            QualType T = R->getRValueType(Ctx);
+            QualType T = R->getObjectType(Ctx);
           
             if (Loc::IsLocType(T) || (T->isIntegerType() && T->isScalarType())){
               ValueManager &ValMgr = Eng.getValueManager();

Modified: cfe/branches/Apple/Dib/lib/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Analysis/GRExprEngine.cpp?rev=71340&r1=71339&r2=71340&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Analysis/GRExprEngine.cpp Sat May  9 01:22:19 2009
@@ -1785,7 +1785,7 @@
       // FIXME: The proper thing to do is to really iterate over the
       //  container.  We will do this with dispatch logic to the store.
       //  For now, just 'conjure' up a symbolic value.
-      QualType T = R->getRValueType(getContext());
+      QualType T = R->getObjectType(getContext());
       assert (Loc::IsLocType(T));
       unsigned Count = Builder->getCurrentBlockCount();
       SymbolRef Sym = SymMgr.getConjuredSymbol(elem, T, Count);

Modified: cfe/branches/Apple/Dib/lib/Analysis/MemRegion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Analysis/MemRegion.cpp?rev=71340&r1=71339&r2=71340&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Analysis/MemRegion.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Analysis/MemRegion.cpp Sat May  9 01:22:19 2009
@@ -121,14 +121,6 @@
 }
 
 //===----------------------------------------------------------------------===//
-// getLValueType() and getRValueType()
-//===----------------------------------------------------------------------===//
-
-QualType StringRegion::getRValueType(ASTContext& C) const {
-  return Str->getType();
-}
-
-//===----------------------------------------------------------------------===//
 // Region pretty-printing.
 //===----------------------------------------------------------------------===//
 

Modified: cfe/branches/Apple/Dib/lib/Analysis/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Analysis/RegionStore.cpp?rev=71340&r1=71339&r2=71340&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Analysis/RegionStore.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Analysis/RegionStore.cpp Sat May  9 01:22:19 2009
@@ -492,7 +492,7 @@
                                            const MemRegion* R) {
   if (const VarRegion* VR = dyn_cast<VarRegion>(R)) {
     // Get the type of the variable.
-    QualType T = VR->getDesugaredRValueType(getContext());
+    QualType T = VR->getDesugaredObjectType(getContext());
 
     // FIXME: Handle variable-length arrays.
     if (isa<VariableArrayType>(T))
@@ -510,7 +510,7 @@
     // that type.
     if (CastTy) {
       QualType EleTy =cast<PointerType>(CastTy->getTypePtr())->getPointeeType();
-      QualType VarTy = VR->getRValueType(getContext());
+      QualType VarTy = VR->getObjectType(getContext());
       uint64_t EleSize = getContext().getTypeSize(EleTy);
       uint64_t VarSize = getContext().getTypeSize(VarTy);
       return NonLoc::MakeIntVal(getBasicVals(), VarSize / EleSize, false);
@@ -545,7 +545,7 @@
     llvm::APSInt SSize = cast<nonloc::ConcreteInt>(*Extent).getValue();
 
     // Get the size of the element in bits.
-    QualType LvT = ATR->getLValueType(getContext());
+    QualType LvT = ATR->getLocationType(getContext());
     QualType ElemTy = cast<PointerType>(LvT.getTypePtr())->getPointeeType();
 
     uint64_t X = getContext().getTypeSize(ElemTy);
@@ -605,8 +605,8 @@
   if (!ArrayR)
     return UnknownVal();
   
-  // Strip off typedefs from the ArrayRegion's RvalueType.
-  QualType T = ArrayR->getRValueType(getContext())->getDesugaredType();
+  // Strip off typedefs from the ArrayRegion's ObjectType.
+  QualType T = ArrayR->getObjectType(getContext())->getDesugaredType();
   ArrayType *AT = cast<ArrayType>(T);
   T = AT->getElementType();
   
@@ -643,7 +643,7 @@
 
   // Return the same region if the region types are compatible.
   if (const TypedRegion* TR = dyn_cast<TypedRegion>(R)) {
-    QualType Ta = Ctx.getCanonicalType(TR->getLValueType(Ctx));
+    QualType Ta = Ctx.getCanonicalType(TR->getLocationType(Ctx));
 
     if (Ta == ToTy)
       return CastResult(state, R);
@@ -676,7 +676,7 @@
         return CastResult(state, R);
     }
 
-    QualType ObjTy = cast<TypedRegion>(R)->getRValueType(getContext());
+    QualType ObjTy = cast<TypedRegion>(R)->getObjectType(getContext());
     uint64_t PointeeTySize = getContext().getTypeSize(PointeeTy);
     uint64_t ObjTySize = getContext().getTypeSize(ObjTy);
 
@@ -722,7 +722,7 @@
     // p += 3;
     // Note that p binds to a TypedViewRegion(SymbolicRegion).
     nonloc::ConcreteInt Idx(getBasicVals().getZeroWithPtrWidth(false));
-    ER = MRMgr.getElementRegion(TR->getRValueType(getContext()), Idx, TR);
+    ER = MRMgr.getElementRegion(TR->getObjectType(getContext()), Idx, TR);
   }
 
   SVal Idx = ER->getIndex();
@@ -782,7 +782,7 @@
   //
   // Such funny addressing will occur due to layering of regions.
 
-  QualType RTy = R->getRValueType(getContext());
+  QualType RTy = R->getObjectType(getContext());
 
   if (RTy->isStructureType())
     return RetrieveStruct(St, R);
@@ -868,8 +868,7 @@
 }
 
 SVal RegionStoreManager::RetrieveStruct(const GRState* St,const TypedRegion* R){
-  // FIXME: Verify we want getRValueType instead of getLValueType.
-  QualType T = R->getRValueType(getContext());
+  QualType T = R->getObjectType(getContext());
   assert(T->isStructureType());
 
   const RecordType* RT = cast<RecordType>(T.getTypePtr());
@@ -894,7 +893,7 @@
 }
 
 SVal RegionStoreManager::RetrieveArray(const GRState* St, const TypedRegion* R){
-  QualType T = R->getRValueType(getContext());
+  QualType T = R->getObjectType(getContext());
   ConstantArrayType* CAT = cast<ConstantArrayType>(T.getTypePtr());
 
   llvm::ImmutableList<SVal> ArrayVal = getBasicVals().getEmptySValList();
@@ -904,7 +903,7 @@
 
   for (; i < Size; ++i) {
     SVal Idx = NonLoc::MakeVal(getBasicVals(), i);
-    ElementRegion* ER = MRMgr.getElementRegion(R->getRValueType(getContext()),
+    ElementRegion* ER = MRMgr.getElementRegion(R->getObjectType(getContext()),
                                                Idx, R);
     QualType ETy = ER->getElementType();
     SVal ElementVal = Retrieve(St, loc::MemRegionVal(ER), ETy);
@@ -921,8 +920,7 @@
 
   // Check if the region is a struct region.
   if (const TypedRegion* TR = dyn_cast<TypedRegion>(R))
-    // FIXME: Verify we want getRValueType().
-    if (TR->getRValueType(getContext())->isStructureType())
+    if (TR->getObjectType(getContext())->isStructureType())
       return BindStruct(St, TR, V);
 
   Store store = St->getStore();
@@ -1156,9 +1154,7 @@
 
 const GRState* RegionStoreManager::BindArray(const GRState* St, 
                                              const TypedRegion* R, SVal Init) {
-  
-  // FIXME: Verify we should use getLValueType or getRValueType.
-  QualType T = R->getRValueType(getContext());
+  QualType T = R->getObjectType(getContext());
   assert(T->isArrayType());
 
   // When we are binding the whole array, it always has default value 0.
@@ -1223,8 +1219,7 @@
 
 const GRState*
 RegionStoreManager::BindStruct(const GRState* St, const TypedRegion* R, SVal V){
-  // FIXME: Verify that we should use getRValueType or getLValueType.
-  QualType T = R->getRValueType(getContext());
+  QualType T = R->getObjectType(getContext());
   assert(T->isStructureType());
 
   const RecordType* RT = T->getAsRecordType();

Modified: cfe/branches/Apple/Dib/lib/Analysis/SVals.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Analysis/SVals.cpp?rev=71340&r1=71339&r2=71340&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Analysis/SVals.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Analysis/SVals.cpp Sat May  9 01:22:19 2009
@@ -301,7 +301,7 @@
   SymbolRef sym = SymMgr.getRegionRValueSymbol(R);
                                 
   if (const TypedRegion* TR = dyn_cast<TypedRegion>(R)) {
-    QualType T = TR->getRValueType(SymMgr.getContext());
+    QualType T = TR->getObjectType(SymMgr.getContext());
 
     // If T is of function pointer type, create a CodeTextRegion wrapping a
     // symbol.

Modified: cfe/branches/Apple/Dib/lib/Analysis/Store.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Analysis/Store.cpp?rev=71340&r1=71339&r2=71340&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Analysis/Store.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Analysis/Store.cpp Sat May  9 01:22:19 2009
@@ -32,7 +32,7 @@
 
   // Return the same region if the region types are compatible.
   if (const TypedRegion* TR = dyn_cast<TypedRegion>(R)) {
-    QualType Ta = Ctx.getCanonicalType(TR->getLValueType(Ctx));
+    QualType Ta = Ctx.getCanonicalType(TR->getLocationType(Ctx));
 
     if (Ta == ToTy)
       return CastResult(state, R);

Modified: cfe/branches/Apple/Dib/lib/Analysis/SymbolManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Analysis/SymbolManager.cpp?rev=71340&r1=71339&r2=71340&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Analysis/SymbolManager.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Analysis/SymbolManager.cpp Sat May  9 01:22:19 2009
@@ -167,7 +167,7 @@
 
 QualType SymbolRegionRValue::getType(ASTContext& C) const {
   if (const TypedRegion* TR = dyn_cast<TypedRegion>(R))
-    return TR->getRValueType(C);
+    return TR->getObjectType(C);
   
   return QualType();
 }





More information about the llvm-branch-commits mailing list