diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-01-28 22:25:21 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-01-28 22:25:21 +0000 |
commit | f264562c26b7fe754e064ee6dac06092976c471b (patch) | |
tree | c58fe50beb7f21462890a454df58940493f59a04 /Analysis/GRConstants.cpp | |
parent | bd03f1d66d62434244deaa435fbbed3174edcf01 (diff) |
Minor tweaking with hierarchy of NonLValue objects: SymbolValue is
now SymbolicNonLValue.
Cleaned up some casts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46467 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Analysis/GRConstants.cpp')
-rw-r--r-- | Analysis/GRConstants.cpp | 53 |
1 files changed, 24 insertions, 29 deletions
diff --git a/Analysis/GRConstants.cpp b/Analysis/GRConstants.cpp index 1b2545a3fd..d28140287b 100644 --- a/Analysis/GRConstants.cpp +++ b/Analysis/GRConstants.cpp @@ -48,7 +48,7 @@ using llvm::APSInt; //===----------------------------------------------------------------------===// namespace { -typedef uintptr_t SymbolID; +typedef unsigned SymbolID; class VISIBILITY_HIDDEN ValueKey { uintptr_t Raw; @@ -70,7 +70,7 @@ public: inline SymbolID getSymbolID() const { assert (getKind() == IsSymbol); - return Raw >> 2; + return (SymbolID) (Raw >> 2); } ValueKey(const ValueDecl* VD) @@ -94,7 +94,7 @@ public: ID.AddInteger(isSymbol() ? 1 : 0); if (isSymbol()) - ID.AddInteger((uint64_t) getSymbolID()); + ID.AddInteger(getSymbolID()); else ID.AddPointer(getPtr()); } @@ -204,32 +204,24 @@ namespace { class VISIBILITY_HIDDEN RValue { public: enum BaseKind { InvalidKind=0x0, LValueKind=0x1, NonLValueKind=0x2, - SymbolKind=0x3, BaseFlags = 0x3 }; + BaseFlags = 0x3 }; private: - uintptr_t Data; + void* Data; unsigned Kind; protected: RValue(const void* d, bool isLValue, unsigned ValKind) - : Data(reinterpret_cast<uintptr_t>(const_cast<void*>(d))), + : Data(const_cast<void*>(d)), Kind((isLValue ? LValueKind : NonLValueKind) | (ValKind << 2)) {} explicit RValue() : Data(0), Kind(InvalidKind) {} - - explicit RValue(unsigned SymID) - : Data(SymID), Kind(SymbolKind) {} - + void* getRawPtr() const { - assert (getBaseKind() != InvalidKind && getBaseKind() != SymbolKind); return reinterpret_cast<void*>(Data); } - uintptr_t getRawData() const { - return Data; - } - public: ~RValue() {}; @@ -267,19 +259,6 @@ public: } }; -class VISIBILITY_HIDDEN SymbolValue : public RValue { -public: - SymbolValue(unsigned SymID) : RValue(SymID) {} - - unsigned getID() const { - return (unsigned) getRawData(); - } - - static inline bool classof(const RValue* V) { - return V->getBaseKind() == SymbolKind; - } -}; - class VISIBILITY_HIDDEN LValue : public RValue { protected: LValue(unsigned SubKind, void* D) : RValue(D, true, SubKind) {} @@ -347,7 +326,23 @@ public: namespace { -enum { ConcreteIntKind, ConstrainedIntegerKind, NumNonLValueKind }; +enum { SymbolicNonLValueKind, ConcreteIntKind, ConstrainedIntegerKind, + NumNonLValueKind }; + +class VISIBILITY_HIDDEN SymbolicNonLValue : public NonLValue { +public: + SymbolicNonLValue(unsigned SymID) + : NonLValue(SymbolicNonLValueKind, + reinterpret_cast<void*>((uintptr_t) SymID)) {} + + SymbolID getSymbolID() const { + return (SymbolID) reinterpret_cast<uintptr_t>(getRawPtr()); + } + + static inline bool classof(const RValue* V) { + return V->getSubKind() == SymbolicNonLValueKind; + } +}; class VISIBILITY_HIDDEN ConcreteInt : public NonLValue { public: |