clang  6.0.0svn
Classes | Public Member Functions | Static Public Member Functions | List of all members
clang::ast_type_traits::ASTNodeKind Class Reference

Kind identifier. More...

#include "clang/AST/ASTTypeTraits.h"

Classes

struct  DenseMapInfo
 Hooks for using ASTNodeKind as a key in a DenseMap. More...
 

Public Member Functions

 ASTNodeKind ()
 Empty identifier. It matches nothing. More...
 
bool isSame (ASTNodeKind Other) const
 Returns true if this and Other represent the same kind. More...
 
bool isNone () const
 Returns true only for the default ASTNodeKind() More...
 
bool isBaseOf (ASTNodeKind Other, unsigned *Distance=nullptr) const
 Returns true if this is a base kind of (or same as) Other. More...
 
StringRef asStringRef () const
 String representation of the kind. More...
 
bool operator< (const ASTNodeKind &Other) const
 Strict weak ordering for ASTNodeKind. More...
 
bool hasPointerIdentity () const
 Check if the given ASTNodeKind identifies a type that offers pointer identity. More...
 

Static Public Member Functions

template<class T >
static ASTNodeKind getFromNodeKind ()
 Construct an identifier for T. More...
 
static ASTNodeKind getMostDerivedType (ASTNodeKind Kind1, ASTNodeKind Kind2)
 Return the most derived type between Kind1 and Kind2. More...
 
static ASTNodeKind getMostDerivedCommonAncestor (ASTNodeKind Kind1, ASTNodeKind Kind2)
 Return the most derived common ancestor between Kind1 and Kind2. More...
 
static ASTNodeKind getFromNode (const Decl &D)
 Construct an identifier for the dynamic type of the node. More...
 
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 46 of file ASTTypeTraits.h.

Constructor & Destructor Documentation

◆ ASTNodeKind()

clang::ast_type_traits::ASTNodeKind::ASTNodeKind ( )
inline

Empty identifier. It matches nothing.

Definition at line 49 of file ASTTypeTraits.h.

Referenced by getMostDerivedCommonAncestor(), and getMostDerivedType().

Member Function Documentation

◆ asStringRef()

StringRef clang::ast_type_traits::ASTNodeKind::asStringRef ( ) const

String representation of the kind.

Definition at line 60 of file ASTTypeTraits.cpp.

Referenced by clang::ast_matchers::dynamic::ArgKind::asString(), and clang::ast_type_traits::operator<<().

◆ getFromNode() [1/3]

ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNode ( const Decl D)
static

Construct an identifier for the dynamic type of the node.

Definition at line 78 of file ASTTypeTraits.cpp.

References clang::Decl::getKind().

◆ getFromNode() [2/3]

ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNode ( const Stmt S)
static

Definition at line 88 of file ASTTypeTraits.cpp.

◆ getFromNode() [3/3]

ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNode ( const Type T)
static

Definition at line 99 of file ASTTypeTraits.cpp.

References clang::Type::getTypeClass().

◆ getFromNodeKind()

template<class T >
static ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind ( )
inlinestatic

Construct an identifier for T.

Definition at line 53 of file ASTTypeTraits.h.

References Id.

◆ getMostDerivedCommonAncestor()

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 69 of file ASTTypeTraits.cpp.

References ASTNodeKind(), isBaseOf(), and Parent.

◆ getMostDerivedType()

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 62 of file ASTTypeTraits.cpp.

References ASTNodeKind(), and isBaseOf().

◆ hasPointerIdentity()

bool clang::ast_type_traits::ASTNodeKind::hasPointerIdentity ( ) const
inline

Check if the given ASTNodeKind identifies a type that offers pointer identity.

This is useful for the fast path in DynTypedNode.

Definition at line 113 of file ASTTypeTraits.h.

References Id.

Referenced by clang::ASTContext::getParents().

◆ 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 43 of file ASTTypeTraits.cpp.

Referenced by getMostDerivedCommonAncestor(), getMostDerivedType(), clang::ast_matchers::dynamic::ArgKind::isConvertibleTo(), and clang::ast_matchers::dynamic::internal::DynCastAllOfMatcherDescriptor::isConvertibleTo().

◆ isNone()

bool clang::ast_type_traits::ASTNodeKind::isNone ( ) const
inline

Returns true only for the default ASTNodeKind()

Definition at line 70 of file ASTTypeTraits.h.

◆ isSame()

bool clang::ast_type_traits::ASTNodeKind::isSame ( ASTNodeKind  Other) const
inline

Returns true if this and Other represent the same kind.

Definition at line 65 of file ASTTypeTraits.h.

Referenced by clang::ast_matchers::dynamic::internal::DynCastAllOfMatcherDescriptor::isConvertibleTo(), and clang::diff::ComparisonOptions::isMatchingAllowed().

◆ operator<()

bool clang::ast_type_traits::ASTNodeKind::operator< ( const ASTNodeKind Other) const
inline

Strict weak ordering for ASTNodeKind.

Definition at line 81 of file ASTTypeTraits.h.


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