clang API Documentation

Public Member Functions | Static Public Member Functions | Friends
clang::idx::Entity Class Reference

A ASTContext-independent way to refer to declarations. More...

#include <Entity.h>

List of all members.

Public Member Functions

 Entity ()
DeclgetDecl (ASTContext &AST) const
 Find the Decl that can be referred to by this entity.
DeclgetInternalDecl () 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)

Detailed Description

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.

Definition at line 47 of file Entity.h.


Constructor & Destructor Documentation

clang::idx::Entity::Entity ( ) [inline]

Definition at line 57 of file Entity.h.

Referenced by get().


Member Function Documentation

Entity Entity::get ( Decl D,
Program Prog 
) [static]

Get an Entity associated with the given Decl.

Returns:
invalid Entity if an Entity cannot refer to this Decl.
Null if an Entity cannot refer to this 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().

Entity Entity::get ( StringRef  Name,
Program Prog 
) [static]

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]

Definition at line 89 of file Entity.h.

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]
bool clang::idx::Entity::isValid ( ) const [inline]

Friends And Related Function Documentation

friend class EntityGetter [friend]

Definition at line 54 of file Entity.h.

bool operator< ( const Entity LHS,
const Entity RHS 
) [friend]

Definition at line 100 of file Entity.h.

bool operator== ( const Entity LHS,
const Entity RHS 
) [friend]

Definition at line 95 of file Entity.h.


The documentation for this class was generated from the following files: