clang API Documentation
Kind identifier. More...
#include <ASTTypeTraits.h>
Classes | |
struct | KindInfo |
Per kind info. | |
struct | KindToKindId |
Helper meta-function to convert a kind T to its enum value. | |
Public Member Functions | |
ASTNodeKind () | |
Empty identifier. It matches nothing. | |
bool | isSame (ASTNodeKind Other) const |
Returns true if this and Other represent the same kind. | |
bool | isNone () const |
Returns true only for the default ASTNodeKind() | |
bool | isBaseOf (ASTNodeKind Other, unsigned *Distance=nullptr) const |
Returns true if this is a base kind of (or same as) Other . | |
StringRef | asStringRef () const |
String representation of the kind. | |
bool | operator< (const ASTNodeKind &Other) const |
Strict weak ordering for ASTNodeKind. | |
Static Public Member Functions | |
template<class T > | |
static ASTNodeKind | getFromNodeKind () |
Construct an identifier for T. | |
static ASTNodeKind | getMostDerivedType (ASTNodeKind Kind1, ASTNodeKind Kind2) |
Return the most derived type between Kind1 and Kind2 . | |
static ASTNodeKind | getMostDerivedCommonAncestor (ASTNodeKind Kind1, ASTNodeKind Kind2) |
Return the most derived common ancestor between Kind1 and Kind2. | |
static ASTNodeKind | getFromNode (const Decl &D) |
Construct an identifier for the dynamic type of the node. | |
static ASTNodeKind | getFromNode (const Stmt &S) |
static ASTNodeKind | getFromNode (const Type &T) |
Kind identifier.
It can be constructed from any node kind and allows for runtime type hierarchy checks. Use getFromNodeKind<T>() to construct them.
Definition at line 45 of file ASTTypeTraits.h.
clang::ast_type_traits::ASTNodeKind::ASTNodeKind | ( | ) | [inline] |
Empty identifier. It matches nothing.
Definition at line 48 of file ASTTypeTraits.h.
Referenced by getFromNodeKind(), getMostDerivedCommonAncestor(), and getMostDerivedType().
StringRef clang::ast_type_traits::ASTNodeKind::asStringRef | ( | ) | const |
String representation of the kind.
Definition at line 63 of file ASTTypeTraits.cpp.
Referenced by clang::ast_matchers::dynamic::ArgKind::asString(), clang::ast_type_traits::DynTypedNode::dump(), clang::ast_type_traits::operator<<(), and clang::ast_type_traits::DynTypedNode::print().
ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNode | ( | const Decl & | D | ) | [static] |
Construct an identifier for the dynamic type of the node.
Definition at line 81 of file ASTTypeTraits.cpp.
References clang::Decl::getKind().
ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNode | ( | const Stmt & | S | ) | [static] |
Definition at line 91 of file ASTTypeTraits.cpp.
References clang::Stmt::getStmtClass(), and clang::Stmt::NoStmtClass.
ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNode | ( | const Type & | T | ) | [static] |
Definition at line 102 of file ASTTypeTraits.cpp.
References clang::Type::getTypeClass().
static ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind | ( | ) | [inline, static] |
Construct an identifier for T.
Definition at line 52 of file ASTTypeTraits.h.
References ASTNodeKind().
ASTNodeKind clang::ast_type_traits::ASTNodeKind::getMostDerivedCommonAncestor | ( | ASTNodeKind | Kind1, |
ASTNodeKind | Kind2 | ||
) | [static] |
Return the most derived common ancestor between Kind1 and Kind2.
Return ASTNodeKind() if they are not related.
Definition at line 72 of file ASTTypeTraits.cpp.
References ASTNodeKind(), and isBaseOf().
ASTNodeKind clang::ast_type_traits::ASTNodeKind::getMostDerivedType | ( | ASTNodeKind | Kind1, |
ASTNodeKind | Kind2 | ||
) | [static] |
Return the most derived type between Kind1
and Kind2
.
Return ASTNodeKind() if they are not related.
Definition at line 65 of file ASTTypeTraits.cpp.
References ASTNodeKind(), and isBaseOf().
bool clang::ast_type_traits::ASTNodeKind::isBaseOf | ( | ASTNodeKind | Other, |
unsigned * | Distance = nullptr |
||
) | const |
Returns true
if this
is a base kind of (or same as) Other
.
Distance | If non-null, used to return the distance between this and Other in the class hierarchy. |
Definition at line 42 of file ASTTypeTraits.cpp.
Referenced by getMostDerivedCommonAncestor(), getMostDerivedType(), clang::ast_matchers::dynamic::ArgKind::isConvertibleTo(), clang::ast_matchers::dynamic::internal::DynCastAllOfMatcherDescriptor::isConvertibleTo(), and clang::ast_type_traits::DynTypedNode::operator==().
bool clang::ast_type_traits::ASTNodeKind::isNone | ( | ) | const [inline] |
Returns true
only for the default ASTNodeKind()
Definition at line 67 of file ASTTypeTraits.h.
bool clang::ast_type_traits::ASTNodeKind::isSame | ( | ASTNodeKind | Other | ) | const |
Returns true
if this
and Other
represent the same kind.
Definition at line 46 of file ASTTypeTraits.cpp.
Referenced by clang::ast_matchers::dynamic::internal::DynCastAllOfMatcherDescriptor::isConvertibleTo().
bool clang::ast_type_traits::ASTNodeKind::operator< | ( | const ASTNodeKind & | Other | ) | const [inline] |
Strict weak ordering for ASTNodeKind.
Definition at line 78 of file ASTTypeTraits.h.