clang API Documentation

Classes | Public Types | Public Member Functions
clang::idx::ASTLocation Class Reference

Represents a Decl or a Stmt and its immediate Decl parent. It's immutable. More...

#include <ASTLocation.h>

Inheritance diagram for clang::idx::ASTLocation:
Inheritance graph
[legend]
Collaboration diagram for clang::idx::ASTLocation:
Collaboration graph
[legend]

List of all members.

Classes

struct  NamedRef

Public Types

enum  NodeKind { N_Decl, N_NamedRef, N_Stmt, N_Type }

Public Member Functions

 ASTLocation ()
 ASTLocation (const Decl *d)
 ASTLocation (const Decl *parentDecl, const Stmt *stm)
 ASTLocation (const Decl *parentDecl, NamedDecl *ndRef, SourceLocation loc)
 ASTLocation (const Decl *parentDecl, TypeLoc tyLoc)
bool isValid () const
bool isInvalid () const
NodeKind getKind () const
DeclgetParentDecl () const
DeclAsDecl () const
StmtAsStmt () const
NamedRef AsNamedRef () const
TypeLoc AsTypeLoc () const
Decldyn_AsDecl () const
Stmtdyn_AsStmt () const
NamedRef dyn_AsNamedRef () const
TypeLoc dyn_AsTypeLoc () const
bool isDecl () const
bool isStmt () const
bool isNamedRef () const
bool isType () const
DeclgetReferencedDecl ()
 Returns the declaration that this ASTLocation references.
const DeclgetReferencedDecl () const
SourceRange getSourceRange () const LLVM_READONLY
void print (raw_ostream &OS) const

Detailed Description

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.

Definition at line 37 of file ASTLocation.h.


Member Enumeration Documentation

Enumerator:
N_Decl 
N_NamedRef 
N_Stmt 
N_Type 

Definition at line 39 of file ASTLocation.h.


Constructor & Destructor Documentation

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

Definition at line 68 of file ASTLocation.h.

clang::idx::ASTLocation::ASTLocation ( const Decl d) [inline, explicit]

Definition at line 70 of file ASTLocation.h.

clang::idx::ASTLocation::ASTLocation ( const Decl parentDecl,
const Stmt stm 
) [inline]

Definition at line 73 of file ASTLocation.h.

clang::idx::ASTLocation::ASTLocation ( const Decl parentDecl,
NamedDecl ndRef,
SourceLocation  loc 
) [inline]

Definition at line 79 of file ASTLocation.h.

References clang::SourceLocation::getRawEncoding(), and NDRef.

clang::idx::ASTLocation::ASTLocation ( const Decl parentDecl,
TypeLoc  tyLoc 
) [inline]

Member Function Documentation

Decl* clang::idx::ASTLocation::AsDecl ( ) const [inline]

Definition at line 107 of file ASTLocation.h.

References D, getKind(), and N_Decl.

Referenced by print().

NamedRef clang::idx::ASTLocation::AsNamedRef ( ) const [inline]
Stmt* clang::idx::ASTLocation::AsStmt ( ) const [inline]

Definition at line 111 of file ASTLocation.h.

References getKind(), N_Stmt, and Stm.

Referenced by print().

TypeLoc clang::idx::ASTLocation::AsTypeLoc ( ) const [inline]

Definition at line 119 of file ASTLocation.h.

References clang::QualType::getFromOpaquePtr(), getKind(), N_Type, and Ty.

Referenced by dyn_AsTypeLoc(), getSourceRange(), and print().

Decl* clang::idx::ASTLocation::dyn_AsDecl ( ) const [inline]

Definition at line 124 of file ASTLocation.h.

References D, getKind(), isValid(), and N_Decl.

NamedRef clang::idx::ASTLocation::dyn_AsNamedRef ( ) const [inline]

Definition at line 128 of file ASTLocation.h.

References AsNamedRef(), getKind(), and N_Type.

Stmt* clang::idx::ASTLocation::dyn_AsStmt ( ) const [inline]

Definition at line 125 of file ASTLocation.h.

References getKind(), isValid(), N_Stmt, and Stm.

TypeLoc clang::idx::ASTLocation::dyn_AsTypeLoc ( ) const [inline]

Definition at line 131 of file ASTLocation.h.

References AsTypeLoc(), getKind(), and N_Type.

NodeKind clang::idx::ASTLocation::getKind ( ) const [inline]
Decl* clang::idx::ASTLocation::getParentDecl ( ) const [inline]

Definition at line 105 of file ASTLocation.h.

Referenced by print().

Decl * ASTLocation::getReferencedDecl ( )

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.

Definition at line 39 of file ASTLocation.cpp.

References D, getDeclFromExpr(), getKind(), isInvalid(), N_Decl, N_NamedRef, N_Stmt, N_Type, NDRef, and Stm.

Referenced by getReferencedDecl().

const Decl* clang::idx::ASTLocation::getReferencedDecl ( ) const [inline]

Definition at line 146 of file ASTLocation.h.

References getReferencedDecl().

SourceRange ASTLocation::getSourceRange ( ) const
bool clang::idx::ASTLocation::isDecl ( ) const [inline]

Definition at line 135 of file ASTLocation.h.

References getKind(), isValid(), and N_Decl.

bool clang::idx::ASTLocation::isInvalid ( ) const [inline]

Definition at line 98 of file ASTLocation.h.

References isValid().

Referenced by getReferencedDecl(), getSourceRange(), and print().

bool clang::idx::ASTLocation::isNamedRef ( ) const [inline]

Definition at line 137 of file ASTLocation.h.

References getKind(), isValid(), and N_NamedRef.

bool clang::idx::ASTLocation::isStmt ( ) const [inline]

Definition at line 136 of file ASTLocation.h.

References getKind(), isValid(), and N_Stmt.

bool clang::idx::ASTLocation::isType ( ) const [inline]

Definition at line 138 of file ASTLocation.h.

References getKind(), isValid(), and N_Type.

bool clang::idx::ASTLocation::isValid ( ) const [inline]

Definition at line 97 of file ASTLocation.h.

Referenced by dyn_AsDecl(), dyn_AsStmt(), getKind(), isDecl(), isInvalid(), isNamedRef(), isStmt(), and isType().

void ASTLocation::print ( raw_ostream &  OS) const

Member Data Documentation

Definition at line 55 of file ASTLocation.h.

Referenced by AsDecl(), dyn_AsDecl(), getReferencedDecl(), and getSourceRange().

Definition at line 63 of file ASTLocation.h.

Definition at line 58 of file ASTLocation.h.

Referenced by print().

Definition at line 59 of file ASTLocation.h.

Definition at line 56 of file ASTLocation.h.

Referenced by AsStmt(), dyn_AsStmt(), getReferencedDecl(), and getSourceRange().

Referenced by ASTLocation(), and AsTypeLoc().

Definition at line 62 of file ASTLocation.h.


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