diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-12-05 02:27:51 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-12-05 02:27:51 +0000 |
commit | 2dabd4372c50019fa00aae223ce634e0e754a3f2 (patch) | |
tree | a1686ee69df45abb72f13772629c71977dcf435a /include/clang/Analysis/PathSensitive | |
parent | ebed7971cf47d2fc83f262e7d99cacc3d8b5f163 (diff) |
Rename SymbolID to SymbolRef. This is a precursor to some overhauling of the representation of symbolic values.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60575 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis/PathSensitive')
8 files changed, 60 insertions, 60 deletions
diff --git a/include/clang/Analysis/PathSensitive/BasicValueFactory.h b/include/clang/Analysis/PathSensitive/BasicValueFactory.h index 70fbe1de83..bf6bb8c807 100644 --- a/include/clang/Analysis/PathSensitive/BasicValueFactory.h +++ b/include/clang/Analysis/PathSensitive/BasicValueFactory.h @@ -84,7 +84,7 @@ public: return getValue(b ? 1 : 0, Ctx.getTypeSize(Ctx.IntTy), false); } - const SymIntConstraint& getConstraint(SymbolID sym, BinaryOperator::Opcode Op, + const SymIntConstraint& getConstraint(SymbolRef sym, BinaryOperator::Opcode Op, const llvm::APSInt& V); const CompoundValData* getCompoundValData(QualType T, diff --git a/include/clang/Analysis/PathSensitive/BugReporter.h b/include/clang/Analysis/PathSensitive/BugReporter.h index d62fe61f71..5613ad839b 100644 --- a/include/clang/Analysis/PathSensitive/BugReporter.h +++ b/include/clang/Analysis/PathSensitive/BugReporter.h @@ -236,7 +236,7 @@ public: class GRBugReporter : public BugReporter { GRExprEngine& Eng; - llvm::SmallSet<SymbolID, 10> NotableSymbols; + llvm::SmallSet<SymbolRef, 10> NotableSymbols; public: GRBugReporter(BugReporterData& d, GRExprEngine& eng) @@ -260,11 +260,11 @@ public: virtual void GeneratePathDiagnostic(PathDiagnostic& PD, BugReport& R); - void addNotableSymbol(SymbolID Sym) { + void addNotableSymbol(SymbolRef Sym) { NotableSymbols.insert(Sym); } - bool isNotable(SymbolID Sym) const { + bool isNotable(SymbolRef Sym) const { return (bool) NotableSymbols.count(Sym); } diff --git a/include/clang/Analysis/PathSensitive/ConstraintManager.h b/include/clang/Analysis/PathSensitive/ConstraintManager.h index 54cdecbf21..cec7f69df3 100644 --- a/include/clang/Analysis/PathSensitive/ConstraintManager.h +++ b/include/clang/Analysis/PathSensitive/ConstraintManager.h @@ -26,7 +26,7 @@ namespace clang { class GRState; class GRStateManager; class SVal; -class SymbolID; +class SymbolRef; class ConstraintManager { public: @@ -38,11 +38,11 @@ public: SVal UpperBound, bool Assumption, bool& isFeasible) = 0; - virtual const GRState* AddNE(const GRState* St, SymbolID sym, + virtual const GRState* AddNE(const GRState* St, SymbolRef sym, const llvm::APSInt& V) = 0; - virtual const llvm::APSInt* getSymVal(const GRState* St, SymbolID sym) = 0; + virtual const llvm::APSInt* getSymVal(const GRState* St, SymbolRef sym) = 0; - virtual bool isEqual(const GRState* St, SymbolID sym, + virtual bool isEqual(const GRState* St, SymbolRef sym, const llvm::APSInt& V) const = 0; virtual const GRState* RemoveDeadBindings(const GRState* St, diff --git a/include/clang/Analysis/PathSensitive/GRState.h b/include/clang/Analysis/PathSensitive/GRState.h index 6efafd6f0c..71990b0e65 100644 --- a/include/clang/Analysis/PathSensitive/GRState.h +++ b/include/clang/Analysis/PathSensitive/GRState.h @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This file defines SymbolID, ExprBindKey, and GRState* +// This file defines SymbolRef, ExprBindKey, and GRState* // //===----------------------------------------------------------------------===// @@ -535,11 +535,11 @@ public: isFeasible); } - const GRState* AddNE(const GRState* St, SymbolID sym, const llvm::APSInt& V) { + const GRState* AddNE(const GRState* St, SymbolRef sym, const llvm::APSInt& V) { return ConstraintMgr->AddNE(St, sym, V); } - const llvm::APSInt* getSymVal(const GRState* St, SymbolID sym) { + const llvm::APSInt* getSymVal(const GRState* St, SymbolRef sym) { return ConstraintMgr->getSymVal(St, sym); } @@ -605,7 +605,7 @@ public: return GRStateRef(Mgr->Unbind(St, LV), *Mgr); } - GRStateRef AddNE(SymbolID sym, const llvm::APSInt& V) { + GRStateRef AddNE(SymbolRef sym, const llvm::APSInt& V) { return GRStateRef(Mgr->AddNE(St, sym, V), *Mgr); } diff --git a/include/clang/Analysis/PathSensitive/MemRegion.h b/include/clang/Analysis/PathSensitive/MemRegion.h index 35df7df5f4..22e3bda05f 100644 --- a/include/clang/Analysis/PathSensitive/MemRegion.h +++ b/include/clang/Analysis/PathSensitive/MemRegion.h @@ -140,17 +140,17 @@ public: /// regions do not need to be typed. class SymbolicRegion : public MemRegion { protected: - const SymbolID sym; + const SymbolRef sym; public: - SymbolicRegion(const SymbolID s) : MemRegion(SymbolicRegionKind), sym(s) {} + SymbolicRegion(const SymbolRef s) : MemRegion(SymbolicRegionKind), sym(s) {} - SymbolID getSymbol() const { + SymbolRef getSymbol() const { return sym; } void Profile(llvm::FoldingSetNodeID& ID) const; - static void ProfileRegion(llvm::FoldingSetNodeID& ID, SymbolID sym); + static void ProfileRegion(llvm::FoldingSetNodeID& ID, SymbolRef sym); void print(llvm::raw_ostream& os) const; @@ -507,9 +507,9 @@ public: /// the sizes of dynamically allocated chunks of memory with variable size. class SymbolicExtent : public RegionExtent { public: - SymbolicExtent(SymbolID S) : RegionExtent(S.getNumber() << 1, Sym) {} + SymbolicExtent(SymbolRef S) : RegionExtent(S.getNumber() << 1, Sym) {} - SymbolID getSymbol() const { return SymbolID(getData() >> 1); } + SymbolRef getSymbol() const { return SymbolRef(getData() >> 1); } // Implement isa<T> support. static inline bool classof(const RegionExtent* E) { @@ -567,7 +567,7 @@ public: getCompoundLiteralRegion(const CompoundLiteralExpr* CL); /// getSymbolicRegion - Retrieve or create a "symbolic" memory region. - SymbolicRegion* getSymbolicRegion(const SymbolID sym); + SymbolicRegion* getSymbolicRegion(const SymbolRef sym); StringRegion* getStringRegion(const StringLiteral* Str); diff --git a/include/clang/Analysis/PathSensitive/SVals.h b/include/clang/Analysis/PathSensitive/SVals.h index ca78f66099..45435b0dae 100644 --- a/include/clang/Analysis/PathSensitive/SVals.h +++ b/include/clang/Analysis/PathSensitive/SVals.h @@ -102,7 +102,7 @@ public: class symbol_iterator { const enum { One, Many } HowMany; - union { uintptr_t sym; const SymbolID* sptr; }; + union { uintptr_t sym; const SymbolRef* sptr; }; public: bool operator==(const symbol_iterator& X) { @@ -122,16 +122,16 @@ public: return *this; } - SymbolID operator*() const { + SymbolRef operator*() const { if (HowMany) return *sptr; - return SymbolID(sym); + return SymbolRef(sym); } - symbol_iterator(SymbolID x) : HowMany(One), sym(x.getNumber()) {} + symbol_iterator(SymbolRef x) : HowMany(One), sym(x.getNumber()) {} symbol_iterator() : HowMany(One), sym(~0x0) {} - symbol_iterator(const SymbolID* x) : HowMany(Many), sptr(x) {} + symbol_iterator(const SymbolRef* x) : HowMany(Many), sptr(x) {} }; symbol_iterator symbol_begin() const; @@ -238,8 +238,8 @@ public: SymbolVal(unsigned SymID) : NonLoc(SymbolValKind, reinterpret_cast<void*>((uintptr_t) SymID)) {} - SymbolID getSymbol() const { - return (SymbolID) reinterpret_cast<uintptr_t>(Data); + SymbolRef getSymbol() const { + return (SymbolRef) reinterpret_cast<uintptr_t>(Data); } static inline bool classof(const SVal* V) { @@ -371,8 +371,8 @@ public: SymbolVal(unsigned SymID) : Loc(SymbolValKind, reinterpret_cast<void*>((uintptr_t) SymID)) {} - SymbolID getSymbol() const { - return (SymbolID) reinterpret_cast<uintptr_t>(Data); + SymbolRef getSymbol() const { + return (SymbolRef) reinterpret_cast<uintptr_t>(Data); } static inline bool classof(const SVal* V) { diff --git a/include/clang/Analysis/PathSensitive/Store.h b/include/clang/Analysis/PathSensitive/Store.h index a272f05867..5e654a86bd 100644 --- a/include/clang/Analysis/PathSensitive/Store.h +++ b/include/clang/Analysis/PathSensitive/Store.h @@ -35,8 +35,8 @@ class ObjCIvarDecl; class StoreManager { public: - typedef llvm::SmallSet<SymbolID, 20> LiveSymbolsTy; - typedef llvm::DenseSet<SymbolID> DeadSymbolsTy; + typedef llvm::SmallSet<SymbolRef, 20> LiveSymbolsTy; + typedef llvm::DenseSet<SymbolRef> DeadSymbolsTy; virtual ~StoreManager() {} diff --git a/include/clang/Analysis/PathSensitive/SymbolManager.h b/include/clang/Analysis/PathSensitive/SymbolManager.h index 1f548b4645..9d495bee5f 100644 --- a/include/clang/Analysis/PathSensitive/SymbolManager.h +++ b/include/clang/Analysis/PathSensitive/SymbolManager.h @@ -27,11 +27,11 @@ namespace clang { class MemRegion; class SymbolManager; -class SymbolID { +class SymbolRef { unsigned Data; public: - SymbolID() : Data(~0U - 2) {} - SymbolID(unsigned x) : Data(x) {} + SymbolRef() : Data(~0U - 2) {} + SymbolRef(unsigned x) : Data(x) {} bool isInitialized() const { return Data != (unsigned) (~0U - 2); } operator unsigned() const { return getNumber(); } @@ -46,17 +46,17 @@ public: } // end clang namespace namespace llvm { - template <> struct DenseMapInfo<clang::SymbolID> { - static inline clang::SymbolID getEmptyKey() { - return clang::SymbolID(~0U); + template <> struct DenseMapInfo<clang::SymbolRef> { + static inline clang::SymbolRef getEmptyKey() { + return clang::SymbolRef(~0U); } - static inline clang::SymbolID getTombstoneKey() { - return clang::SymbolID(~0U - 1); + static inline clang::SymbolRef getTombstoneKey() { + return clang::SymbolRef(~0U - 1); } - static unsigned getHashValue(clang::SymbolID X) { + static unsigned getHashValue(clang::SymbolRef X) { return X.getNumber(); } - static bool isEqual(clang::SymbolID X, clang::SymbolID Y) { + static bool isEqual(clang::SymbolRef X, clang::SymbolRef Y) { return X.getNumber() == Y.getNumber(); } static bool isPod() { return true; } @@ -74,17 +74,17 @@ public: private: Kind K; - SymbolID Sym; + SymbolRef Sym; protected: - SymbolData(Kind k, SymbolID sym) : K(k), Sym(sym) {} + SymbolData(Kind k, SymbolRef sym) : K(k), Sym(sym) {} public: virtual ~SymbolData() {} Kind getKind() const { return K; } - SymbolID getSymbol() const { return Sym; } + SymbolRef getSymbol() const { return Sym; } QualType getType(const SymbolManager& SymMgr) const; @@ -98,7 +98,7 @@ class SymbolDataParmVar : public SymbolData { ParmVarDecl *VD; public: - SymbolDataParmVar(SymbolID MySym, ParmVarDecl* vd) + SymbolDataParmVar(SymbolRef MySym, ParmVarDecl* vd) : SymbolData(ParmKind, MySym), VD(vd) {} ParmVarDecl* getDecl() const { return VD; } @@ -122,7 +122,7 @@ class SymbolDataGlobalVar : public SymbolData { VarDecl *VD; public: - SymbolDataGlobalVar(SymbolID MySym, VarDecl* vd) : + SymbolDataGlobalVar(SymbolRef MySym, VarDecl* vd) : SymbolData(GlobalKind, MySym), VD(vd) {} VarDecl* getDecl() const { return VD; } @@ -147,7 +147,7 @@ class SymbolDataElement : public SymbolData { const llvm::APSInt* Idx; public: - SymbolDataElement(SymbolID MySym, const MemRegion* r, const llvm::APSInt* idx) + SymbolDataElement(SymbolRef MySym, const MemRegion* r, const llvm::APSInt* idx) : SymbolData(ElementKind, MySym), R(r), Idx(idx) {} static void Profile(llvm::FoldingSetNodeID& profile, const MemRegion* R, @@ -170,7 +170,7 @@ class SymbolDataField : public SymbolData { const FieldDecl* D; public: - SymbolDataField(SymbolID MySym, const MemRegion* r, const FieldDecl* d) + SymbolDataField(SymbolRef MySym, const MemRegion* r, const FieldDecl* d) : SymbolData(FieldKind, MySym), R(r), D(d) {} static void Profile(llvm::FoldingSetNodeID& profile, const MemRegion* R, @@ -194,7 +194,7 @@ class SymbolConjured : public SymbolData { unsigned Count; public: - SymbolConjured(SymbolID Sym, Stmt* s, QualType t, unsigned count) + SymbolConjured(SymbolRef Sym, Stmt* s, QualType t, unsigned count) : SymbolData(ConjuredKind, Sym), S(s), T(t), Count(count) {} Stmt* getStmt() const { return S; } @@ -223,21 +223,21 @@ public: // Constraints on symbols. Usually wrapped by SValues. class SymIntConstraint : public llvm::FoldingSetNode { - SymbolID Symbol; + SymbolRef Symbol; BinaryOperator::Opcode Op; const llvm::APSInt& Val; public: - SymIntConstraint(SymbolID sym, BinaryOperator::Opcode op, + SymIntConstraint(SymbolRef sym, BinaryOperator::Opcode op, const llvm::APSInt& V) : Symbol(sym), Op(op), Val(V) {} BinaryOperator::Opcode getOpcode() const { return Op; } - const SymbolID& getSymbol() const { return Symbol; } + const SymbolRef& getSymbol() const { return Symbol; } const llvm::APSInt& getInt() const { return Val; } static inline void Profile(llvm::FoldingSetNodeID& ID, - SymbolID Symbol, + SymbolRef Symbol, BinaryOperator::Opcode Op, const llvm::APSInt& Val) { Symbol.Profile(ID); @@ -253,7 +253,7 @@ public: class SymbolManager { typedef llvm::FoldingSet<SymbolData> DataSetTy; - typedef llvm::DenseMap<SymbolID, SymbolData*> DataMapTy; + typedef llvm::DenseMap<SymbolRef, SymbolData*> DataMapTy; DataSetTy DataSet; DataMapTy DataMap; @@ -267,17 +267,17 @@ public: ~SymbolManager(); - SymbolID getSymbol(VarDecl* D); - SymbolID getElementSymbol(const MemRegion* R, const llvm::APSInt* Idx); - SymbolID getFieldSymbol(const MemRegion* R, const FieldDecl* D); - SymbolID getConjuredSymbol(Stmt* E, QualType T, unsigned VisitCount); - SymbolID getConjuredSymbol(Expr* E, unsigned VisitCount) { + SymbolRef getSymbol(VarDecl* D); + SymbolRef getElementSymbol(const MemRegion* R, const llvm::APSInt* Idx); + SymbolRef getFieldSymbol(const MemRegion* R, const FieldDecl* D); + SymbolRef getConjuredSymbol(Stmt* E, QualType T, unsigned VisitCount); + SymbolRef getConjuredSymbol(Expr* E, unsigned VisitCount) { return getConjuredSymbol(E, E->getType(), VisitCount); } - const SymbolData& getSymbolData(SymbolID ID) const; + const SymbolData& getSymbolData(SymbolRef ID) const; - QualType getType(SymbolID ID) const { + QualType getType(SymbolRef ID) const { return getSymbolData(ID).getType(*this); } }; |