clang API Documentation
Represents a Decl or a Stmt and its immediate Decl parent. It's immutable. More...
#include <ASTLocation.h>


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 |
| Decl * | getParentDecl () const |
| Decl * | AsDecl () const |
| Stmt * | AsStmt () const |
| NamedRef | AsNamedRef () const |
| TypeLoc | AsTypeLoc () const |
| Decl * | dyn_AsDecl () const |
| Stmt * | dyn_AsStmt () const |
| NamedRef | dyn_AsNamedRef () const |
| TypeLoc | dyn_AsTypeLoc () const |
| bool | isDecl () const |
| bool | isStmt () const |
| bool | isNamedRef () const |
| bool | isType () const |
| Decl * | getReferencedDecl () |
| Returns the declaration that this ASTLocation references. | |
| const Decl * | getReferencedDecl () const |
| SourceRange | getSourceRange () const LLVM_READONLY |
| void | print (raw_ostream &OS) const |
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.
Definition at line 39 of file ASTLocation.h.
| 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.
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.
Definition at line 88 of file ASTLocation.h.
References clang::QualType::getAsOpaquePtr(), clang::TypeLoc::getOpaqueData(), clang::TypeLoc::getType(), and Ty.
| Decl* clang::idx::ASTLocation::AsDecl | ( | ) | const [inline] |
| NamedRef clang::idx::ASTLocation::AsNamedRef | ( | ) | const [inline] |
Definition at line 115 of file ASTLocation.h.
References clang::SourceLocation::getFromRawEncoding(), getKind(), N_NamedRef, and NDRef.
Referenced by dyn_AsNamedRef(), getSourceRange(), and print().
| Stmt* clang::idx::ASTLocation::AsStmt | ( | ) | const [inline] |
| 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] |
| 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] |
| 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] |
Definition at line 100 of file ASTLocation.h.
References isValid().
Referenced by AsDecl(), AsNamedRef(), AsStmt(), AsTypeLoc(), dyn_AsDecl(), dyn_AsNamedRef(), dyn_AsStmt(), dyn_AsTypeLoc(), getReferencedDecl(), getSourceRange(), isDecl(), isNamedRef(), isStmt(), isType(), and print().
| 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 |
Definition at line 57 of file ASTLocation.cpp.
References AsNamedRef(), AsTypeLoc(), D, getKind(), clang::TypeLoc::getLocalSourceRange(), clang::Decl::getSourceRange(), clang::Stmt::getSourceRange(), isInvalid(), N_Decl, N_NamedRef, N_Stmt, N_Type, and Stm.
Referenced by print().
| bool clang::idx::ASTLocation::isDecl | ( | ) | const [inline] |
Definition at line 135 of file ASTLocation.h.
| 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.
| bool clang::idx::ASTLocation::isType | ( | ) | const [inline] |
Definition at line 138 of file ASTLocation.h.
| 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 |
Definition at line 75 of file ASTLocation.cpp.
References AsDecl(), AsNamedRef(), AsStmt(), AsTypeLoc(), clang::QualType::getAsString(), clang::Decl::getASTContext(), clang::SourceRange::getBegin(), clang::Decl::getDeclKindName(), clang::SourceRange::getEnd(), getKind(), clang::ASTContext::getLangOpts(), getParentDecl(), clang::ASTContext::getSourceManager(), getSourceRange(), clang::Stmt::getStmtClassName(), clang::TypeLoc::getType(), isInvalid(), N_Decl, N_NamedRef, N_Stmt, N_Type, clang::idx::ASTLocation::NamedRef::ND, ND, clang::SourceLocation::print(), and clang::Stmt::printPretty().
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().
| struct { ... } clang::idx::ASTLocation::NDRef |
Referenced by AsNamedRef(), ASTLocation(), and getReferencedDecl().
| unsigned clang::idx::ASTLocation::RawLoc |
Definition at line 59 of file ASTLocation.h.
Definition at line 56 of file ASTLocation.h.
Referenced by AsStmt(), dyn_AsStmt(), getReferencedDecl(), and getSourceRange().
| struct { ... } clang::idx::ASTLocation::Ty |
Referenced by ASTLocation(), and AsTypeLoc().
Definition at line 62 of file ASTLocation.h.