]> granicus.if.org Git - clang/commitdiff
Implemented "getType()" for symbolic values representing the "contents" of
authorTed Kremenek <kremenek@apple.com>
Tue, 19 Feb 2008 20:51:40 +0000 (20:51 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 19 Feb 2008 20:51:40 +0000 (20:51 +0000)
another symbolic value.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47339 91177308-0d34-0410-b5e6-96231b3b80d8

Analysis/SymbolManager.cpp
include/clang/Analysis/PathSensitive/SymbolManager.h

index bdda0e6eed341f84b5e7e28f9a230b32f6919b0b..ced5741f447d8b569fa5107f2f611d9d6d09f0a9 100644 (file)
@@ -38,7 +38,7 @@ SymbolID SymbolManager::getContentsOfSymbol(SymbolID sym) {
   return X;  
 }
 
-QualType SymbolData::getType() const {
+QualType SymbolData::getType(const SymbolManager& SymMgr) const {
   switch (getKind()) {
     default:
       assert (false && "getType() not implemented for this symbol.");
@@ -46,6 +46,11 @@ QualType SymbolData::getType() const {
     case ParmKind:
       return cast<SymbolDataParmVar>(this)->getDecl()->getType();
       
+    case ContentsOfKind: {
+      SymbolID x = cast<SymbolDataContentsOf>(this)->getSymbol();
+      QualType T = SymMgr.getSymbolData(x).getType(SymMgr);
+      return T->getAsPointerType()->getPointeeType();
+    }
   }
 }
 
index 2114dc60333696f7b3c7a0f65684395bd81fe7fd..d29e0e08b9c57b0090ba114e797215c68345e90e 100644 (file)
@@ -24,6 +24,8 @@
 
 namespace clang {
   
+class SymbolManager;
+  
 class SymbolID {
   unsigned Data;
 public:
@@ -76,7 +78,7 @@ public:
     return K == R.K && Data == R.Data;
   }
   
-  QualType getType() const;
+  QualType getType(const SymbolManager& SymMgr) const;
   
   // Implement isa<T> support.
   static inline bool classof(const SymbolData*) { return true; }
@@ -164,7 +166,7 @@ public:
   }
   
   inline QualType getType(SymbolID ID) const {
-    return getSymbolData(ID).getType();
+    return getSymbolData(ID).getType(*this);
   }
 };