From 48a3410e25beb5277bfaad914f40aa9b22dc89d8 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Wed, 12 Mar 2008 02:00:37 +0000 Subject: [PATCH] Fixed regression in SymbolManager introduced in r48272. llvm-svn: 48273 --- .../Analysis/PathSensitive/SymbolManager.h | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/clang/include/clang/Analysis/PathSensitive/SymbolManager.h b/clang/include/clang/Analysis/PathSensitive/SymbolManager.h index e3eedd736b49..a740302c8dd6 100644 --- a/clang/include/clang/Analysis/PathSensitive/SymbolManager.h +++ b/clang/include/clang/Analysis/PathSensitive/SymbolManager.h @@ -24,24 +24,23 @@ 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);