]> granicus.if.org Git - clang/commitdiff
Added new "NonLValue" class: SymIntConstraintVal. This class represents a binary
authorTed Kremenek <kremenek@apple.com>
Tue, 5 Feb 2008 22:10:48 +0000 (22:10 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 5 Feb 2008 22:10:48 +0000 (22:10 +0000)
contraint between a symbol and an integer constant.

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

Analysis/RValues.h

index 05ac663dd5029b01a77362ed52391baba5f743d0..ef7c82ecddbe469b1406db71fbf3a10f9802d2b7 100644 (file)
@@ -301,7 +301,7 @@ public:
 namespace nonlval {
   
   enum Kind { SymbolValKind,
-              SymIntConstraintKind,
+              SymIntConstraintValKind,
               ConcreteIntKind,
               NumKind };
 
@@ -316,8 +316,22 @@ namespace nonlval {
     }
     
     static inline bool classof(const RValue* V) {
-      return V->getSubKind() == SymbolValKind;
-    }  
+      return isa<NonLValue>(V) && V->getSubKind() == SymbolValKind;
+    }
+  };
+  
+  class SymIntConstraintVal : public NonLValue {    
+  public:
+    SymIntConstraintVal(const SymIntConstraint& C)
+    : NonLValue(SymIntConstraintValKind, reinterpret_cast<const void*>(&C)) {}
+
+    const SymIntConstraint& getConstraint() const {
+      return *reinterpret_cast<SymIntConstraint*>(getRawPtr());
+    }
+    
+    static inline bool classof(const RValue* V) {
+      return isa<NonLValue>(V) && V->getSubKind() == SymIntConstraintValKind;
+    }    
   };
 
   class ConcreteInt : public NonLValue {
@@ -387,7 +401,7 @@ namespace nonlval {
     
     // Implement isa<T> support.
     static inline bool classof(const RValue* V) {
-      return V->getSubKind() == ConcreteIntKind;
+      return isa<NonLValue>(V) && V->getSubKind() == ConcreteIntKind;
     }
   };