]> granicus.if.org Git - clang/commitdiff
Fixed regression in SymbolManager introduced in r48272.
authorTed Kremenek <kremenek@apple.com>
Wed, 12 Mar 2008 02:00:37 +0000 (02:00 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 12 Mar 2008 02:00:37 +0000 (02:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48273 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/SymbolManager.h

index e3eedd736b495c9f9bd9707aabad1743423b6afd..a740302c8dd6b0a33434fa329dc3b5f48f062bf6 100644 (file)
 
 namespace clang {
   
+
 class SymbolManager;
-  
+
 class SymbolID {
   unsigned Data;
-  
 public:
+  SymbolID() : Data(~0U - 2) {}
   SymbolID(unsigned x) : Data(x) {}
-  
-  operator unsigned() const { return Data; }
-  unsigned getNumber() const { return Data; }
-  
+    
+  bool isInitialized() const { return Data != (unsigned) (~0U - 2); }
+  operator unsigned() const { return getNumber(); }
+  unsigned getNumber() const { assert (isInitialized()); return Data; }
+    
   void Profile(llvm::FoldingSetNodeID& ID) const { 
+    assert (isInitialized());
     ID.AddInteger(Data);
   }
-  
-  static inline void Profile(llvm::FoldingSetNodeID& ID, SymbolID X) {
-    X.Profile(ID);
-  }
 };
   
 } // end clang namespace
@@ -208,11 +207,11 @@ public:
   Op(op), Val(V) {}
   
   BinaryOperator::Opcode getOpcode() const { return Op; }
-  SymbolID getSymbol() const { return Symbol; }
+  const SymbolID& getSymbol() const { return Symbol; }
   const llvm::APSInt& getInt() const { return Val; }
   
   static inline void Profile(llvm::FoldingSetNodeID& ID,
-                             const SymbolID& Symbol,
+                             SymbolID Symbol,
                              BinaryOperator::Opcode Op,
                              const llvm::APSInt& Val) {
     Symbol.Profile(ID);