clang API Documentation

Classes | Public Member Functions | Static Public Member Functions
clang::ast_type_traits::ASTNodeKind Class Reference

Kind identifier. More...

#include <ASTTypeTraits.h>

List of all members.

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)

Detailed Description

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.


Constructor & Destructor Documentation

Empty identifier. It matches nothing.

Definition at line 48 of file ASTTypeTraits.h.

Referenced by getFromNodeKind(), getMostDerivedCommonAncestor(), and getMostDerivedType().


Member Function Documentation

Construct an identifier for the dynamic type of the node.

Definition at line 81 of file ASTTypeTraits.cpp.

References clang::Decl::getKind().

Definition at line 91 of file ASTTypeTraits.cpp.

References clang::Stmt::getStmtClass(), and clang::Stmt::NoStmtClass.

Definition at line 102 of file ASTTypeTraits.cpp.

References clang::Type::getTypeClass().

template<class T >
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().

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().

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.

Parameters:
DistanceIf 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==().

Returns true only for the default ASTNodeKind()

Definition at line 67 of file ASTTypeTraits.h.

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.


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