clang API Documentation
A ASTContext-independent way to refer to declarations. More...
#include <Entity.h>
Public Member Functions | |
| Entity () | |
| Decl * | getDecl (ASTContext &AST) const |
| Find the Decl that can be referred to by this entity. | |
| Decl * | getInternalDecl () const |
| If this Entity represents a declaration that is internal to its translation unit, getInternalDecl() returns it. | |
| std::string | getPrintableName () const |
| Get a printable name for debugging purpose. | |
| bool | isInternalToTU () const |
| true if the Entity is not visible outside the trasnlation unit. | |
| bool | isValid () const |
| bool | isInvalid () const |
| void * | getAsOpaquePtr () const |
Static Public Member Functions | |
| static Entity | get (Decl *D, Program &Prog) |
| Get an Entity associated with the given Decl. | |
| static Entity | get (StringRef Name, Program &Prog) |
| Get an Entity associated with a name in the global namespace. | |
| static Entity | getFromOpaquePtr (void *Ptr) |
| static Entity | getEmptyMarker () |
| static Entity | getTombstoneMarker () |
Friends | |
| class | EntityGetter |
| bool | operator== (const Entity &LHS, const Entity &RHS) |
| bool | operator< (const Entity &LHS, const Entity &RHS) |
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.
| clang::idx::Entity::Entity | ( | ) | [inline] |
Get an Entity associated with the given Decl.
Definition at line 255 of file Entity.cpp.
References Entity().
Referenced by clang::CallGraph::addTU(), clang::idx::Analyzer::FindDeclarations(), FindEntitiesInDC(), clang::idx::Analyzer::FindReferences(), get(), and clang::ento::AnalysisManager::getAnalysisDeclContextInAnotherTU().
Get an Entity associated with a name in the global namespace.
Definition at line 262 of file Entity.cpp.
References get().
| void* clang::idx::Entity::getAsOpaquePtr | ( | ) | const [inline] |
Definition at line 88 of file Entity.h.
Referenced by clang::idx::EntityImpl::Profile().
| Decl * Entity::getDecl | ( | ASTContext & | AST | ) | const |
Find the Decl that can be referred to by this entity.
Definition at line 228 of file Entity.cpp.
References isInvalid().
Referenced by clang::idx::EntityImpl::getDecl(), and clang::CallGraphNode::getDecl().
| static Entity clang::idx::Entity::getEmptyMarker | ( | ) | [inline, static] |
Definition at line 105 of file Entity.h.
Referenced by llvm::DenseMapInfo< clang::idx::Entity >::getEmptyKey().
| static Entity clang::idx::Entity::getFromOpaquePtr | ( | void * | Ptr | ) | [inline, static] |
| Decl* clang::idx::Entity::getInternalDecl | ( | ) | const [inline] |
If this Entity represents a declaration that is internal to its translation unit, getInternalDecl() returns it.
Definition at line 64 of file Entity.h.
References isInternalToTU().
Referenced by clang::idx::Indexer::GetTranslationUnitsFor().
| std::string Entity::getPrintableName | ( | ) | const |
Get a printable name for debugging purpose.
Definition at line 239 of file Entity.cpp.
References isInvalid().
Referenced by clang::CallGraphNode::getName().
| static Entity clang::idx::Entity::getTombstoneMarker | ( | ) | [inline, static] |
Definition at line 111 of file Entity.h.
Referenced by llvm::DenseMapInfo< clang::idx::Entity >::getTombstoneKey().
| bool clang::idx::Entity::isInternalToTU | ( | ) | const [inline] |
true if the Entity is not visible outside the trasnlation unit.
Definition at line 80 of file Entity.h.
References isValid().
Referenced by getInternalDecl(), clang::idx::Indexer::GetTranslationUnitsFor(), and clang::idx::EntityGetter::VisitNamedDecl().
| bool clang::idx::Entity::isInvalid | ( | ) | const [inline] |
Definition at line 86 of file Entity.h.
References isValid().
Referenced by clang::idx::Analyzer::FindDeclarations(), clang::idx::Analyzer::FindReferences(), clang::idx::EntityImpl::getDecl(), getDecl(), getPrintableName(), and clang::idx::EntityGetter::VisitNamedDecl().
| bool clang::idx::Entity::isValid | ( | ) | const [inline] |
Definition at line 85 of file Entity.h.
Referenced by FindEntitiesInDC(), clang::idx::Indexer::GetTranslationUnitsFor(), isInternalToTU(), isInvalid(), and clang::idx::EntityGetter::VisitNamedDecl().
friend class EntityGetter [friend] |