diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-04-13 16:31:46 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-04-13 16:31:46 +0000 |
commit | 87e154c09bbb060a0620bc988d7723bee64fb79c (patch) | |
tree | 8c78ea5379aebabc7c8f2ef38827302614a94601 /include | |
parent | b20c46ea980b5aed7b480761ea1daf2f26c23b2d (diff) |
Remove the unused, unmaintained, incomplete 'Index' library.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154672 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Frontend/ASTUnit.h | 10 | ||||
-rw-r--r-- | include/clang/Index/ASTLocation.h | 173 | ||||
-rw-r--r-- | include/clang/Index/Analyzer.h | 56 | ||||
-rw-r--r-- | include/clang/Index/DeclReferenceMap.h | 50 | ||||
-rw-r--r-- | include/clang/Index/Entity.h | 149 | ||||
-rw-r--r-- | include/clang/Index/GlobalCallGraph.h | 149 | ||||
-rw-r--r-- | include/clang/Index/GlobalSelector.h | 100 | ||||
-rw-r--r-- | include/clang/Index/Handlers.h | 82 | ||||
-rw-r--r-- | include/clang/Index/IndexProvider.h | 38 | ||||
-rw-r--r-- | include/clang/Index/Indexer.h | 71 | ||||
-rw-r--r-- | include/clang/Index/Program.h | 45 | ||||
-rw-r--r-- | include/clang/Index/STLExtras.h | 63 | ||||
-rw-r--r-- | include/clang/Index/SelectorMap.h | 57 | ||||
-rw-r--r-- | include/clang/Index/TranslationUnit.h | 41 | ||||
-rw-r--r-- | include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h | 17 |
15 files changed, 0 insertions, 1101 deletions
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h index 5e4ecadd69..041eabb5b9 100644 --- a/include/clang/Frontend/ASTUnit.h +++ b/include/clang/Frontend/ASTUnit.h @@ -14,7 +14,6 @@ #ifndef LLVM_CLANG_FRONTEND_ASTUNIT_H #define LLVM_CLANG_FRONTEND_ASTUNIT_H -#include "clang/Index/ASTLocation.h" #include "clang/Serialization/ASTBitCodes.h" #include "clang/Sema/Sema.h" #include "clang/Sema/CodeCompleteConsumer.h" @@ -57,8 +56,6 @@ class SourceManager; class TargetInfo; class ASTFrontendAction; -using namespace idx; - /// \brief Utility class for loading a ASTContext from an AST file. /// class ASTUnit : public ModuleLoader { @@ -134,9 +131,6 @@ private: /// The name of the original source file used to generate this ASTUnit. std::string OriginalSourceFile; - // Critical optimization when using clang_getCursor(). - ASTLocation LastLoc; - /// \brief The set of diagnostics produced when creating the preamble. SmallVector<StoredDiagnostic, 4> PreambleDiagnostics; @@ -474,10 +468,6 @@ public: bool getOwnsRemappedFileBuffers() const { return OwnsRemappedFileBuffers; } void setOwnsRemappedFileBuffers(bool val) { OwnsRemappedFileBuffers = val; } - void setLastASTLocation(ASTLocation ALoc) { LastLoc = ALoc; } - ASTLocation getLastASTLocation() const { return LastLoc; } - - StringRef getMainFileName() const; typedef std::vector<Decl *>::iterator top_level_iterator; diff --git a/include/clang/Index/ASTLocation.h b/include/clang/Index/ASTLocation.h deleted file mode 100644 index 45097cc5c3..0000000000 --- a/include/clang/Index/ASTLocation.h +++ /dev/null @@ -1,173 +0,0 @@ -//===--- ASTLocation.h - A <Decl, Stmt> pair --------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// ASTLocation is Decl or a Stmt and its immediate Decl parent. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_INDEX_ASTLOCATION_H -#define LLVM_CLANG_INDEX_ASTLOCATION_H - -#include "clang/AST/TypeLoc.h" -#include "llvm/ADT/PointerIntPair.h" -#include "llvm/Support/Compiler.h" - -namespace clang { - class Decl; - class Stmt; - class NamedDecl; - -namespace idx { - class TranslationUnit; - -/// \brief Represents a Decl or a Stmt and its immediate Decl parent. It's -/// immutable. -/// -/// ASTLocation is intended to be used as a "pointer" into the AST. It is either -/// just a Decl, or a Stmt and its Decl parent. Since a single Stmt is devoid -/// of context, its parent Decl provides all the additional missing information -/// like the declaration context, ASTContext, etc. -/// -class ASTLocation { -public: - enum NodeKind { - N_Decl, N_NamedRef, N_Stmt, N_Type - }; - - struct NamedRef { - NamedDecl *ND; - SourceLocation Loc; - - NamedRef() : ND(0) { } - NamedRef(NamedDecl *nd, SourceLocation loc) : ND(nd), Loc(loc) { } - }; - -private: - llvm::PointerIntPair<Decl *, 2, NodeKind> ParentDecl; - - union { - Decl *D; - Stmt *Stm; - struct { - NamedDecl *ND; - unsigned RawLoc; - } NDRef; - struct { - void *TyPtr; - void *Data; - } Ty; - }; - -public: - ASTLocation() { } - - explicit ASTLocation(const Decl *d) - : ParentDecl(const_cast<Decl*>(d), N_Decl), D(const_cast<Decl*>(d)) { } - - ASTLocation(const Decl *parentDecl, const Stmt *stm) - : ParentDecl(const_cast<Decl*>(parentDecl), N_Stmt), - Stm(const_cast<Stmt*>(stm)) { - if (!stm) ParentDecl.setPointer(0); - } - - ASTLocation(const Decl *parentDecl, NamedDecl *ndRef, SourceLocation loc) - : ParentDecl(const_cast<Decl*>(parentDecl), N_NamedRef) { - if (ndRef) { - NDRef.ND = ndRef; - NDRef.RawLoc = loc.getRawEncoding(); - } else - ParentDecl.setPointer(0); - } - - ASTLocation(const Decl *parentDecl, TypeLoc tyLoc) - : ParentDecl(const_cast<Decl*>(parentDecl), N_Type) { - if (tyLoc) { - Ty.TyPtr = tyLoc.getType().getAsOpaquePtr(); - Ty.Data = tyLoc.getOpaqueData(); - } else - ParentDecl.setPointer(0); - } - - bool isValid() const { return ParentDecl.getPointer() != 0; } - bool isInvalid() const { return !isValid(); } - - NodeKind getKind() const { - assert(isValid()); - return (NodeKind)ParentDecl.getInt(); - } - - Decl *getParentDecl() const { return ParentDecl.getPointer(); } - - Decl *AsDecl() const { - assert(getKind() == N_Decl); - return D; - } - Stmt *AsStmt() const { - assert(getKind() == N_Stmt); - return Stm; - } - NamedRef AsNamedRef() const { - assert(getKind() == N_NamedRef); - return NamedRef(NDRef.ND, SourceLocation::getFromRawEncoding(NDRef.RawLoc)); - } - TypeLoc AsTypeLoc() const { - assert(getKind() == N_Type); - return TypeLoc(QualType::getFromOpaquePtr(Ty.TyPtr), Ty.Data); - } - - Decl *dyn_AsDecl() const { return isValid() && getKind() == N_Decl ? D : 0; } - Stmt *dyn_AsStmt() const { - return isValid() && getKind() == N_Stmt ? Stm : 0; - } - NamedRef dyn_AsNamedRef() const { - return getKind() == N_Type ? AsNamedRef() : NamedRef(); - } - TypeLoc dyn_AsTypeLoc() const { - return getKind() == N_Type ? AsTypeLoc() : TypeLoc(); - } - - bool isDecl() const { return isValid() && getKind() == N_Decl; } - bool isStmt() const { return isValid() && getKind() == N_Stmt; } - bool isNamedRef() const { return isValid() && getKind() == N_NamedRef; } - bool isType() const { return isValid() && getKind() == N_Type; } - - /// \brief Returns the declaration that this ASTLocation references. - /// - /// If this points to a Decl, that Decl is returned. - /// If this points to an Expr that references a Decl, that Decl is returned, - /// otherwise it returns NULL. - Decl *getReferencedDecl(); - const Decl *getReferencedDecl() const { - return const_cast<ASTLocation*>(this)->getReferencedDecl(); - } - - SourceRange getSourceRange() const LLVM_READONLY; - - void print(raw_ostream &OS) const; -}; - -/// \brief Like ASTLocation but also contains the TranslationUnit that the -/// ASTLocation originated from. -class TULocation : public ASTLocation { - TranslationUnit *TU; - -public: - TULocation(TranslationUnit *tu, ASTLocation astLoc) - : ASTLocation(astLoc), TU(tu) { - assert(tu && "Passed null translation unit"); - } - - TranslationUnit *getTU() const { return TU; } -}; - -} // namespace idx - -} // namespace clang - -#endif diff --git a/include/clang/Index/Analyzer.h b/include/clang/Index/Analyzer.h deleted file mode 100644 index f6b5465148..0000000000 --- a/include/clang/Index/Analyzer.h +++ /dev/null @@ -1,56 +0,0 @@ -//===--- Analyzer.h - Analysis for indexing information ---------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file declares the Analyzer interface. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_INDEX_ANALYZER_H -#define LLVM_CLANG_INDEX_ANALYZER_H - -namespace clang { - class Decl; - class ObjCMessageExpr; - -namespace idx { - class Program; - class IndexProvider; - class TULocationHandler; - -/// \brief Provides indexing information, like finding all references of an -/// Entity across translation units. -class Analyzer { - Program &Prog; - IndexProvider &Idxer; - - Analyzer(const Analyzer&); // do not implement - Analyzer &operator=(const Analyzer &); // do not implement - -public: - explicit Analyzer(Program &prog, IndexProvider &idxer) - : Prog(prog), Idxer(idxer) { } - - /// \brief Find all TULocations for declarations of the given Decl and pass - /// them to Handler. - void FindDeclarations(Decl *D, TULocationHandler &Handler); - - /// \brief Find all TULocations for references of the given Decl and pass - /// them to Handler. - void FindReferences(Decl *D, TULocationHandler &Handler); - - /// \brief Find methods that may respond to the given message and pass them - /// to Handler. - void FindObjCMethods(ObjCMessageExpr *MsgE, TULocationHandler &Handler); -}; - -} // namespace idx - -} // namespace clang - -#endif diff --git a/include/clang/Index/DeclReferenceMap.h b/include/clang/Index/DeclReferenceMap.h deleted file mode 100644 index 73f2fe50b3..0000000000 --- a/include/clang/Index/DeclReferenceMap.h +++ /dev/null @@ -1,50 +0,0 @@ -//===--- DeclReferenceMap.h - Map Decls to their references -----*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// DeclReferenceMap creates a mapping from Decls to the ASTLocations that -// reference them. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_INDEX_DECLREFERENCEMAP_H -#define LLVM_CLANG_INDEX_DECLREFERENCEMAP_H - -#include "clang/Index/ASTLocation.h" -#include "clang/Index/STLExtras.h" -#include <map> - -namespace clang { - class ASTContext; - class NamedDecl; - -namespace idx { - -/// \brief Maps NamedDecls with the ASTLocations that reference them. -/// -/// References are mapped and retrieved using the canonical decls. -class DeclReferenceMap { -public: - explicit DeclReferenceMap(ASTContext &Ctx); - - typedef std::multimap<NamedDecl*, ASTLocation> MapTy; - typedef pair_value_iterator<MapTy::iterator> astlocation_iterator; - - astlocation_iterator refs_begin(NamedDecl *D) const; - astlocation_iterator refs_end(NamedDecl *D) const; - bool refs_empty(NamedDecl *D) const; - -private: - mutable MapTy Map; -}; - -} // end idx namespace - -} // end clang namespace - -#endif diff --git a/include/clang/Index/Entity.h b/include/clang/Index/Entity.h deleted file mode 100644 index d104458ec2..0000000000 --- a/include/clang/Index/Entity.h +++ /dev/null @@ -1,149 +0,0 @@ -//===--- Entity.h - Cross-translation-unit "token" for decls ----*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Entity is a ASTContext-independent way to refer to declarations that are -// visible across translation units. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_INDEX_ENTITY_H -#define LLVM_CLANG_INDEX_ENTITY_H - -#include "clang/Basic/LLVM.h" -#include "llvm/ADT/PointerUnion.h" -#include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/StringRef.h" -#include <string> - -namespace clang { - class ASTContext; - class Decl; - -namespace idx { - class Program; - class EntityImpl; - -/// \brief A ASTContext-independent way to refer to declarations. -/// -/// Entity is basically the link for declarations that are semantically the same -/// in multiple ASTContexts. A client will convert a Decl into an Entity and -/// later use that Entity to find the "same" Decl into another ASTContext. -/// Declarations that are semantically the same and visible across translation -/// units will be associated with the same Entity. -/// -/// An Entity may also refer to declarations that cannot be visible across -/// translation units, e.g. static functions with the same name in multiple -/// translation units will be associated with different Entities. -/// -/// Entities can be checked for equality but note that the same Program object -/// should be used when getting Entities. -/// -class Entity { - /// \brief Stores the Decl directly if it is not visible outside of its own - /// translation unit, otherwise it stores the associated EntityImpl. - llvm::PointerUnion<Decl *, EntityImpl *> Val; - - explicit Entity(Decl *D); - explicit Entity(EntityImpl *impl) : Val(impl) { } - friend class EntityGetter; - -public: - Entity() { } - - /// \brief Find the Decl that can be referred to by this entity. - Decl *getDecl(ASTContext &AST) const; - - /// \brief If this Entity represents a declaration that is internal to its - /// translation unit, getInternalDecl() returns it. - Decl *getInternalDecl() const { - assert(isInternalToTU() && "This Entity is not internal!"); - return Val.get<Decl *>(); - } - - /// \brief Get a printable name for debugging purpose. - std::string getPrintableName() const; - - /// \brief Get an Entity associated with the given Decl. - /// \returns invalid Entity if an Entity cannot refer to this Decl. - static Entity get(Decl *D, Program &Prog); - - /// \brief Get an Entity associated with a name in the global namespace. - static Entity get(StringRef Name, Program &Prog); - - /// \brief true if the Entity is not visible outside the trasnlation unit. - bool isInternalToTU() const { - assert(isValid() && "This Entity is not valid!"); - return Val.is<Decl *>(); - } - - bool isValid() const { return !Val.isNull(); } - bool isInvalid() const { return !isValid(); } - - void *getAsOpaquePtr() const { return Val.getOpaqueValue(); } - static Entity getFromOpaquePtr(void *Ptr) { - Entity Ent; - Ent.Val = llvm::PointerUnion<Decl *, EntityImpl *>::getFromOpaqueValue(Ptr); - return Ent; - } - - friend bool operator==(const Entity &LHS, const Entity &RHS) { - return LHS.getAsOpaquePtr() == RHS.getAsOpaquePtr(); - } - - // For use in a std::map. - friend bool operator < (const Entity &LHS, const Entity &RHS) { - return LHS.getAsOpaquePtr() < RHS.getAsOpaquePtr(); - } - - // For use in DenseMap/DenseSet. - static Entity getEmptyMarker() { - Entity Ent; - Ent.Val = - llvm::PointerUnion<Decl *, EntityImpl *>::getFromOpaqueValue((void*)-1); - return Ent; - } - static Entity getTombstoneMarker() { - Entity Ent; - Ent.Val = - llvm::PointerUnion<Decl *, EntityImpl *>::getFromOpaqueValue((void*)-2); - return Ent; - } -}; - -} // namespace idx - -} // namespace clang - -namespace llvm { -/// Define DenseMapInfo so that Entities can be used as keys in DenseMap and -/// DenseSets. -template<> -struct DenseMapInfo<clang::idx::Entity> { - static inline clang::idx::Entity getEmptyKey() { - return clang::idx::Entity::getEmptyMarker(); - } - - static inline clang::idx::Entity getTombstoneKey() { - return clang::idx::Entity::getTombstoneMarker(); - } - - static unsigned getHashValue(clang::idx::Entity); - - static inline bool - isEqual(clang::idx::Entity LHS, clang::idx::Entity RHS) { - return LHS == RHS; - } -}; - -template <> -struct isPodLike<clang::idx::Entity> { static const bool value = true; }; - -} // end namespace llvm - -#endif diff --git a/include/clang/Index/GlobalCallGraph.h b/include/clang/Index/GlobalCallGraph.h deleted file mode 100644 index 7ba1cceac1..0000000000 --- a/include/clang/Index/GlobalCallGraph.h +++ /dev/null @@ -1,149 +0,0 @@ -//== GlobalCallGraph.h - Call graph building --------------------*- C++ -*--==// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defined the CallGraph and CallGraphNode classes. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_INDEX_CALLGRAPH -#define LLVM_CLANG_INDEX_CALLGRAPH - -#include "clang/Index/ASTLocation.h" -#include "clang/Index/Entity.h" -#include "clang/Index/Program.h" -#include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/GraphTraits.h" -#include "llvm/ADT/STLExtras.h" -#include <vector> -#include <map> - -using namespace clang; - -namespace clang { -namespace idx { - -class CallGraphNode { - Entity F; - typedef std::pair<ASTLocation, CallGraphNode*> CallRecord; - std::vector<CallRecord> CalledFunctions; - -public: - CallGraphNode(Entity f) : F(f) {} - - typedef std::vector<CallRecord>::iterator iterator; - typedef std::vector<CallRecord>::const_iterator const_iterator; - - iterator begin() { return CalledFunctions.begin(); } - iterator end() { return CalledFunctions.end(); } - const_iterator begin() const { return CalledFunctions.begin(); } - const_iterator end() const { return CalledFunctions.end(); } - - void addCallee(ASTLocation L, CallGraphNode *Node) { - CalledFunctions.push_back(std::make_pair(L, Node)); - } - - bool hasCallee() const { return begin() != end(); } - - std::string getName() const { return F.getPrintableName(); } - - Decl *getDecl(ASTContext &Ctx) const { return F.getDecl(Ctx); } -}; - -class CallGraph { - /// Program manages all Entities. - Program &Prog; - - typedef std::map<Entity, CallGraphNode *> FunctionMapTy; - - /// FunctionMap owns all CallGraphNodes. - FunctionMapTy FunctionMap; - - /// CallerCtx maps a caller to its ASTContext. - llvm::DenseMap<CallGraphNode *, ASTContext *> CallerCtx; - - /// Root node is the 'main' function or 0. - CallGraphNode *Root; - - /// ExternalCallingNode has edges to all external functions. - CallGraphNode *ExternalCallingNode; - -public: - CallGraph(Program &P); - ~CallGraph(); - - typedef FunctionMapTy::iterator iterator; - typedef FunctionMapTy::const_iterator const_iterator; - - iterator begin() { return FunctionMap.begin(); } - iterator end() { return FunctionMap.end(); } - const_iterator begin() const { return FunctionMap.begin(); } - const_iterator end() const { return FunctionMap.end(); } - - CallGraphNode *getRoot() { return Root; } - - CallGraphNode *getExternalCallingNode() { return ExternalCallingNode; } - - void addTU(ASTContext &AST); - - Program &getProgram() { return Prog; } - - CallGraphNode *getOrInsertFunction(idx::Entity F); - - Decl *getDecl(CallGraphNode *Node); - - void print(raw_ostream &os); - void dump(); - - void ViewCallGraph() const; -}; - -}} // end clang idx namespace - -namespace llvm { - -template <> struct GraphTraits<clang::idx::CallGraph> { - typedef clang::idx::CallGraph GraphType; - typedef clang::idx::CallGraphNode NodeType; - - typedef std::pair<clang::idx::ASTLocation, NodeType*> CGNPairTy; - typedef std::pointer_to_unary_function<CGNPairTy, NodeType*> CGNDerefFun; - - typedef mapped_iterator<NodeType::iterator, CGNDerefFun> ChildIteratorType; - - static NodeType *getEntryNode(GraphType *CG) { - return CG->getExternalCallingNode(); - } - - static ChildIteratorType child_begin(NodeType *N) { - return map_iterator(N->begin(), CGNDerefFun(CGNDeref)); - } - static ChildIteratorType child_end(NodeType *N) { - return map_iterator(N->end(), CGNDerefFun(CGNDeref)); - } - - typedef std::pair<clang::idx::Entity, NodeType*> PairTy; - typedef std::pointer_to_unary_function<PairTy, NodeType*> DerefFun; - - typedef mapped_iterator<GraphType::const_iterator, DerefFun> nodes_iterator; - - static nodes_iterator nodes_begin(const GraphType &CG) { - return map_iterator(CG.begin(), DerefFun(CGDeref)); - } - static nodes_iterator nodes_end(const GraphType &CG) { - return map_iterator(CG.end(), DerefFun(CGDeref)); - } - - static NodeType *CGNDeref(CGNPairTy P) { return P.second; } - - static NodeType *CGDeref(PairTy P) { return P.second; } -}; - -} // end llvm namespace - -#endif diff --git a/include/clang/Index/GlobalSelector.h b/include/clang/Index/GlobalSelector.h deleted file mode 100644 index 9cd83a8595..0000000000 --- a/include/clang/Index/GlobalSelector.h +++ /dev/null @@ -1,100 +0,0 @@ -//===--- GlobalSelector.h - Cross-translation-unit "token" for selectors --===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// GlobalSelector is a ASTContext-independent way to refer to selectors. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_INDEX_GLOBALSELECTOR_H -#define LLVM_CLANG_INDEX_GLOBALSELECTOR_H - -#include "llvm/ADT/DenseMap.h" -#include <string> - -namespace clang { - class ASTContext; - class Selector; - -namespace idx { - class Program; - -/// \brief A ASTContext-independent way to refer to selectors. -class GlobalSelector { - void *Val; - - explicit GlobalSelector(void *val) : Val(val) { } - -public: - GlobalSelector() : Val(0) { } - - /// \brief Get the ASTContext-specific selector. - Selector getSelector(ASTContext &AST) const; - - bool isValid() const { return Val != 0; } - bool isInvalid() const { return !isValid(); } - - /// \brief Get a printable name for debugging purpose. - std::string getPrintableName() const; - - /// \brief Get a GlobalSelector for the ASTContext-specific selector. - static GlobalSelector get(Selector Sel, Program &Prog); - - void *getAsOpaquePtr() const { return Val; } - - static GlobalSelector getFromOpaquePtr(void *Ptr) { - return GlobalSelector(Ptr); - } - - friend bool operator==(const GlobalSelector &LHS, const GlobalSelector &RHS) { - return LHS.getAsOpaquePtr() == RHS.getAsOpaquePtr(); - } - - // For use in a std::map. - friend bool operator< (const GlobalSelector &LHS, const GlobalSelector &RHS) { - return LHS.getAsOpaquePtr() < RHS.getAsOpaquePtr(); - } - - // For use in DenseMap/DenseSet. - static GlobalSelector getEmptyMarker() { return GlobalSelector((void*)-1); } - static GlobalSelector getTombstoneMarker() { - return GlobalSelector((void*)-2); - } -}; - -} // namespace idx - -} // namespace clang - -namespace llvm { -/// Define DenseMapInfo so that GlobalSelectors can be used as keys in DenseMap -/// and DenseSets. -template<> -struct DenseMapInfo<clang::idx::GlobalSelector> { - static inline clang::idx::GlobalSelector getEmptyKey() { - return clang::idx::GlobalSelector::getEmptyMarker(); - } - - static inline clang::idx::GlobalSelector getTombstoneKey() { - return clang::idx::GlobalSelector::getTombstoneMarker(); - } - - static unsigned getHashValue(clang::idx::GlobalSelector); - - static inline bool - isEqual(clang::idx::GlobalSelector LHS, clang::idx::GlobalSelector RHS) { - return LHS == RHS; - } -}; - -template <> -struct isPodLike<clang::idx::GlobalSelector> { static const bool value = true;}; - -} // end namespace llvm - -#endif diff --git a/include/clang/Index/Handlers.h b/include/clang/Index/Handlers.h deleted file mode 100644 index 1e017f8a7c..0000000000 --- a/include/clang/Index/Handlers.h +++ /dev/null @@ -1,82 +0,0 @@ -//===--- Handlers.h - Interfaces for receiving information ------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Abstract interfaces for receiving information. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_INDEX_HANDLERS_H -#define LLVM_CLANG_INDEX_HANDLERS_H - -#include "clang/Basic/LLVM.h" -#include "llvm/ADT/SmallVector.h" - -namespace clang { - -namespace idx { - class Entity; - class TranslationUnit; - class TULocation; - -/// \brief Abstract interface for receiving Entities. -class EntityHandler { -public: - typedef Entity receiving_type; - - virtual ~EntityHandler(); - virtual void Handle(Entity Ent) = 0; -}; - -/// \brief Abstract interface for receiving TranslationUnits. -class TranslationUnitHandler { -public: - typedef TranslationUnit* receiving_type; - - virtual ~TranslationUnitHandler(); - virtual void Handle(TranslationUnit *TU) = 0; -}; - -/// \brief Abstract interface for receiving TULocations. -class TULocationHandler { -public: - typedef TULocation receiving_type; - - virtual ~TULocationHandler(); - virtual void Handle(TULocation TULoc) = 0; -}; - -/// \brief Helper for the Handler classes. Stores the objects into a vector. -/// example: -/// @code -/// Storing<TranslationUnitHandler> TURes; -/// IndexProvider.GetTranslationUnitsFor(Entity, TURes); -/// for (Storing<TranslationUnitHandler>::iterator -/// I = TURes.begin(), E = TURes.end(); I != E; ++I) { .... -/// @endcode -template <typename handler_type> -class Storing : public handler_type { - typedef typename handler_type::receiving_type receiving_type; - typedef SmallVector<receiving_type, 8> StoreTy; - StoreTy Store; - -public: - virtual void Handle(receiving_type Obj) { - Store.push_back(Obj); - } - - typedef typename StoreTy::const_iterator iterator; - iterator begin() const { return Store.begin(); } - iterator end() const { return Store.end(); } -}; - -} // namespace idx - -} // namespace clang - -#endif diff --git a/include/clang/Index/IndexProvider.h b/include/clang/Index/IndexProvider.h deleted file mode 100644 index 187dd9393c..0000000000 --- a/include/clang/Index/IndexProvider.h +++ /dev/null @@ -1,38 +0,0 @@ -//===--- IndexProvider.h - Maps information to translation units -*- C++ -*-==// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Maps information to TranslationUnits. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_INDEX_INDEXPROVIDER_H -#define LLVM_CLANG_INDEX_INDEXPROVIDER_H - -namespace clang { - -namespace idx { - class Entity; - class TranslationUnitHandler; - class GlobalSelector; - -/// \brief Maps information to TranslationUnits. -class IndexProvider { -public: - virtual ~IndexProvider(); - virtual void GetTranslationUnitsFor(Entity Ent, - TranslationUnitHandler &Handler) = 0; - virtual void GetTranslationUnitsFor(GlobalSelector Sel, - TranslationUnitHandler &Handler) = 0; -}; - -} // namespace idx - -} // namespace clang - -#endif diff --git a/include/clang/Index/Indexer.h b/include/clang/Index/Indexer.h deleted file mode 100644 index 96c585df24..0000000000 --- a/include/clang/Index/Indexer.h +++ /dev/null @@ -1,71 +0,0 @@ -//===--- Indexer.h - IndexProvider implementation ---------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// IndexProvider implementation. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_INDEX_INDEXER_H -#define LLVM_CLANG_INDEX_INDEXER_H - -#include "clang/Index/IndexProvider.h" -#include "clang/Index/Entity.h" -#include "clang/Index/GlobalSelector.h" -#include "llvm/ADT/SmallPtrSet.h" -#include "llvm/ADT/DenseMap.h" -#include <map> - -namespace clang { - class ASTContext; - class FunctionDecl; - -namespace idx { - class Program; - class TranslationUnit; - -/// \brief Maps information to TranslationUnits. -class Indexer : public IndexProvider { -public: - typedef llvm::SmallPtrSet<TranslationUnit *, 4> TUSetTy; - typedef llvm::DenseMap<ASTContext *, TranslationUnit *> CtxTUMapTy; - typedef std::map<Entity, TUSetTy> MapTy; - typedef std::map<GlobalSelector, TUSetTy> SelMapTy; - typedef std::map<Entity, std::pair<FunctionDecl*,TranslationUnit*> > DefMapTy; - - explicit Indexer(Program &prog) : - Prog(prog) { } - - Program &getProgram() const { return Prog; } - - /// \brief Find all Entities and map them to the given translation unit. - void IndexAST(TranslationUnit *TU); - - virtual void GetTranslationUnitsFor(Entity Ent, - TranslationUnitHandler &Handler); - virtual void GetTranslationUnitsFor(GlobalSelector Sel, - TranslationUnitHandler &Handler); - - std::pair<FunctionDecl*, TranslationUnit*> getDefinitionFor(Entity Ent); - -private: - Program &Prog; - - MapTy Map; - // Map a function Entity to the its definition. - DefMapTy DefMap; - - CtxTUMapTy CtxTUMap; - SelMapTy SelMap; -}; - -} // namespace idx - -} // namespace clang - -#endif diff --git a/include/clang/Index/Program.h b/include/clang/Index/Program.h deleted file mode 100644 index 8039192512..0000000000 --- a/include/clang/Index/Program.h +++ /dev/null @@ -1,45 +0,0 @@ -//===--- Program.h - Cross-translation unit information ---------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file declares the idx::Program interface. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_INDEX_PROGRAM_H -#define LLVM_CLANG_INDEX_PROGRAM_H - -namespace clang { - class ASTContext; - -namespace idx { - class EntityHandler; - -/// \brief Top level object that owns and maintains information -/// that is common across translation units. -class Program { - void *Impl; - - Program(const Program&); // do not implement - Program &operator=(const Program &); // do not implement - friend class Entity; - friend class GlobalSelector; - -public: - Program(); - ~Program(); - - /// \brief Traverses the AST and passes all the entities to the Handler. - void FindEntities(ASTContext &Ctx, EntityHandler &Handler); -}; - -} // namespace idx - -} // namespace clang - -#endif diff --git a/include/clang/Index/STLExtras.h b/include/clang/Index/STLExtras.h deleted file mode 100644 index a3693c6c79..0000000000 --- a/include/clang/Index/STLExtras.h +++ /dev/null @@ -1,63 +0,0 @@ -//===--- STLExtras.h - Helper STL related templates -------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Helper templates for using with the STL. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_INDEX_STLEXTRAS_H -#define LLVM_CLANG_INDEX_STLEXTRAS_H - -namespace clang { - -namespace idx { - -/// \brief Wraps an iterator whose value_type is a pair, and provides -/// pair's second object as the value. -template <typename iter_type> -class pair_value_iterator { - iter_type I; - -public: - typedef typename iter_type::value_type::second_type value_type; - typedef value_type& reference; - typedef value_type* pointer; - typedef typename iter_type::iterator_category iterator_category; - typedef typename iter_type::difference_type difference_type; - - pair_value_iterator() { } - pair_value_iterator(iter_type i) : I(i) { } - - reference operator*() const { return I->second; } - pointer operator->() const { return &I->second; } - - pair_value_iterator& operator++() { - ++I; - return *this; - } - - pair_value_iterator operator++(int) { - pair_value_iterator tmp(*this); - ++(*this); - return tmp; - } - - friend bool operator==(pair_value_iterator L, pair_value_iterator R) { - return L.I == R.I; - } - friend bool operator!=(pair_value_iterator L, pair_value_iterator R) { - return L.I != R.I; - } -}; - -} // end idx namespace - -} // end clang namespace - -#endif diff --git a/include/clang/Index/SelectorMap.h b/include/clang/Index/SelectorMap.h deleted file mode 100644 index be01702fcb..0000000000 --- a/include/clang/Index/SelectorMap.h +++ /dev/null @@ -1,57 +0,0 @@ -//===--- SelectorMap.h - Maps selectors to methods and messages -*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// SelectorMap creates a mapping from selectors to ObjC method declarations -// and ObjC message expressions. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_INDEX_SELECTORMAP_H -#define LLVM_CLANG_INDEX_SELECTORMAP_H - -#include "clang/Index/ASTLocation.h" -#include "clang/Index/STLExtras.h" -#include "clang/Basic/IdentifierTable.h" -#include <map> - -namespace clang { - class ASTContext; - class ObjCMethodDecl; - -namespace idx { - -/// \brief Maps NamedDecls with the ASTLocations that reference them. -/// -/// References are mapped and retrieved using the canonical decls. -class SelectorMap { -public: - explicit SelectorMap(ASTContext &Ctx); - - typedef std::multimap<Selector, ObjCMethodDecl *> SelMethMapTy; - typedef std::multimap<Selector, ASTLocation> SelRefMapTy; - - typedef pair_value_iterator<SelMethMapTy::iterator> method_iterator; - typedef pair_value_iterator<SelRefMapTy::iterator> astlocation_iterator; - - method_iterator methods_begin(Selector Sel) const; - method_iterator methods_end(Selector Sel) const; - - astlocation_iterator refs_begin(Selector Sel) const; - astlocation_iterator refs_end(Selector Sel) const; - -private: - mutable SelMethMapTy SelMethMap; - mutable SelRefMapTy SelRefMap; -}; - -} // end idx namespace - -} // end clang namespace - -#endif diff --git a/include/clang/Index/TranslationUnit.h b/include/clang/Index/TranslationUnit.h deleted file mode 100644 index ba5d48d373..0000000000 --- a/include/clang/Index/TranslationUnit.h +++ /dev/null @@ -1,41 +0,0 @@ -//===--- TranslationUnit.h - Interface for a translation unit ---*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Abstract interface for a translation unit. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_INDEX_TRANSLATIONUNIT_H -#define LLVM_CLANG_INDEX_TRANSLATIONUNIT_H - -namespace clang { - class ASTContext; - class DiagnosticsEngine; - class Preprocessor; - -namespace idx { - class DeclReferenceMap; - class SelectorMap; - -/// \brief Abstract interface for a translation unit. -class TranslationUnit { -public: - virtual ~TranslationUnit(); - virtual ASTContext &getASTContext() = 0; - virtual Preprocessor &getPreprocessor() = 0; - virtual DiagnosticsEngine &getDiagnostic() = 0; - virtual DeclReferenceMap &getDeclReferenceMap() = 0; - virtual SelectorMap &getSelectorMap() = 0; -}; - -} // namespace idx - -} // namespace clang - -#endif diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h b/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h index 3cbecf7d6e..d01644ba0e 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h @@ -22,11 +22,6 @@ namespace clang { -namespace idx { - class Indexer; - class TranslationUnit; -} - namespace ento { class CheckerManager; @@ -46,11 +41,6 @@ class AnalysisManager : public BugReporterData { CheckerManager *CheckerMgr; - /// \brief Provide function definitions in other translation units. This is - /// NULL if we don't have multiple translation units. AnalysisManager does - /// not own the Indexer. - idx::Indexer *Idxer; - enum AnalysisScope { ScopeTU, ScopeDecl } AScope; /// \brief The maximum number of exploded nodes the analyzer will generate. @@ -99,7 +89,6 @@ public: StoreManagerCreator storemgr, ConstraintManagerCreator constraintmgr, CheckerManager *checkerMgr, - idx::Indexer *idxer, unsigned maxnodes, unsigned maxvisit, bool vizdot, bool vizubi, AnalysisPurgeMode purge, bool eager, bool trim, @@ -137,8 +126,6 @@ public: CheckerManager *getCheckerManager() const { return CheckerMgr; } - idx::Indexer *getIndexer() const { return Idxer; } - virtual ASTContext &getASTContext() { return Ctx; } @@ -186,10 +173,6 @@ public: bool shouldInlineCall() const { return (IPAMode == Inlining); } - bool hasIndexer() const { return Idxer != 0; } - - AnalysisDeclContext *getAnalysisDeclContextInAnotherTU(const Decl *D); - CFG *getCFG(Decl const *D) { return AnaCtxMgr.getContext(D)->getCFG(); } |