KindId != NKI_None && KindId ==
Other.KindId;
78 constexpr bool isNone()
const{
returnKindId == NKI_None; }
93 returnKindId <
Other.KindId;
120 returnLHS.KindId == RHS.KindId;
127 returnKindId > NKI_LastKindWithoutPointerIdentity;
136NKI_TemplateArgument,
137NKI_TemplateArgumentLoc,
140NKI_NestedNameSpecifierLoc,
142#define TYPELOC(CLASS, PARENT) NKI_##CLASS##TypeLoc, 143#include "clang/AST/TypeLocNodes.def" 145NKI_LastKindWithoutPointerIdentity = NKI_TypeLoc,
146NKI_CXXBaseSpecifier,
147NKI_CXXCtorInitializer,
148NKI_NestedNameSpecifier,
150#define DECL(DERIVED, BASE) NKI_##DERIVED##Decl, 151#include "clang/AST/DeclNodes.inc" 153#define STMT(DERIVED, BASE) NKI_##DERIVED, 154#include "clang/AST/StmtNodes.inc" 156#define TYPE(DERIVED, BASE) NKI_##DERIVED##Type, 157#include "clang/AST/TypeNodes.inc" 159#define GEN_CLANG_CLAUSE_CLASS 160#define CLAUSE_CLASS(Enum, Str, Class) NKI_##Class, 161#include "llvm/Frontend/OpenMP/OMP.inc" 163#define ATTR(A) NKI_##A##Attr, 164#include "clang/Basic/AttrList.inc" 166NKI_ConceptReference,
171 constexpr ASTNodeKind(NodeKindId KindId) : KindId(KindId) {}
175 static bool isBaseOf(NodeKindId
Base, NodeKindId Derived);
181 static bool isBaseOf(NodeKindId
Base, NodeKindId Derived,
unsigned*Distance);
186 template<
classT>
structKindToKindId {
187 static constNodeKindId
Id= NKI_None;
190 structKindToKindId<const
T> : KindToKindId<T> {};
199 static constKindInfo AllKindInfo[NKI_NumberOfKinds];
204#define KIND_TO_KIND_ID(Class) \ 205 template <> struct ASTNodeKind::KindToKindId<Class> { \ 206 static const NodeKindId Id = NKI_##Class; \ 216#define TYPELOC(CLASS, PARENT) KIND_TO_KIND_ID(CLASS##TypeLoc) 217#include "clang/AST/TypeLocNodes.def" 227#define DECL(DERIVED, BASE) KIND_TO_KIND_ID(DERIVED##Decl) 228#include "clang/AST/DeclNodes.inc" 229#define STMT(DERIVED, BASE) KIND_TO_KIND_ID(DERIVED) 230#include "clang/AST/StmtNodes.inc" 231#define TYPE(DERIVED, BASE) KIND_TO_KIND_ID(DERIVED##Type) 232#include "clang/AST/TypeNodes.inc" 233#define GEN_CLANG_CLAUSE_CLASS 234#define CLAUSE_CLASS(Enum, Str, Class) KIND_TO_KIND_ID(Class) 235#include "llvm/Frontend/OpenMP/OMP.inc" 236#define ATTR(A) KIND_TO_KIND_ID(A##Attr) 237#include "clang/Basic/AttrList.inc" 238#undef KIND_TO_KIND_ID 260 template<
typenameT>
262 returnBaseConverter<T>::create(
Node);
277 template<
typenameT>
const T*
get()
const{
278 returnBaseConverter<T>::get(NodeKind, &Storage);
284 template<
typenameT>
286 returnBaseConverter<T>::getUnchecked(NodeKind, &Storage);
298? *
reinterpret_cast<void*
const*
>(&Storage)
306 void dump(llvm::raw_ostream &OS,
const ASTContext&Context)
const;
320 returnNodeKind <
Other.NodeKind;
322 if(ASTNodeKind::getFromNodeKind<QualType>().isSame(NodeKind))
323 returngetUnchecked<QualType>().getAsOpaquePtr() <
326 if(ASTNodeKind::getFromNodeKind<TypeLoc>().isBaseOf(NodeKind)) {
327 autoTLA = getUnchecked<TypeLoc>();
329 returnstd::make_pair(TLA.getType().getAsOpaquePtr(),
330TLA.getOpaqueData()) <
331std::make_pair(TLB.getType().getAsOpaquePtr(),
332TLB.getOpaqueData());
335 if(ASTNodeKind::getFromNodeKind<NestedNameSpecifierLoc>().isSame(
337 autoNNSLA = getUnchecked<NestedNameSpecifierLoc>();
339 returnstd::make_pair(NNSLA.getNestedNameSpecifier(),
340NNSLA.getOpaqueData()) <
341std::make_pair(NNSLB.getNestedNameSpecifier(),
342NNSLB.getOpaqueData());
355 if(ASTNodeKind::getFromNodeKind<QualType>().isSame(NodeKind))
356 returngetUnchecked<QualType>() ==
Other.getUnchecked<
QualType>();
358 if(ASTNodeKind::getFromNodeKind<TypeLoc>().isBaseOf(NodeKind))
359 returngetUnchecked<TypeLoc>() ==
Other.getUnchecked<
TypeLoc>();
361 if(ASTNodeKind::getFromNodeKind<NestedNameSpecifierLoc>().isSame(NodeKind))
362 returngetUnchecked<NestedNameSpecifierLoc>() ==
387 if(ASTNodeKind::getFromNodeKind<TypeLoc>().isBaseOf(Val.NodeKind)) {
389 returnllvm::hash_combine(TL.getType().getAsOpaquePtr(),
393 if(ASTNodeKind::getFromNodeKind<NestedNameSpecifierLoc>().isSame(
396 returnllvm::hash_combine(NNSL.getNestedNameSpecifier(),
397NNSL.getOpaqueData());
416 template<
typenameT,
typenameEnablerT =
void>
structBaseConverter;
419 template<
typenameT,
typenameBaseT>
structDynCastPtrConverter {
421 if(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
425 static const T&
getUnchecked(ASTNodeKind NodeKind,
const void*Storage) {
426assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
427 return*cast<T>(
static_cast<constBaseT *
>(
428*
reinterpret_cast<const void*
const*
>(Storage)));
433 new(&
Result.Storage)
const void*(&
Node);
439 template<
typenameT>
structPtrConverter {
440 static const T*
get(ASTNodeKind NodeKind,
const void*Storage) {
441 if(ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind))
445 static const T&
getUnchecked(ASTNodeKind NodeKind,
const void*Storage) {
446assert(ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind));
447 return*
static_cast<const T*
>(
448*
reinterpret_cast<const void*
const*
>(
Storage));
452 Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
453 new(&
Result.Storage)
const void*(&
Node);
459 template<
typenameT>
structValueConverter {
460 static const T*
get(ASTNodeKind NodeKind,
const void*Storage) {
461 if(ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind))
462 return reinterpret_cast<const T*
>(
Storage);
465 static const T&
getUnchecked(ASTNodeKind NodeKind,
const void*Storage) {
466assert(ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind));
467 return*
reinterpret_cast<const T*
>(
Storage);
471 Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
480 template<
typename T,
typenameBaseT,
481 typename= std::enable_if_t<(
sizeof(
T) ==
sizeof(BaseT))>>
482 structDynCastValueConverter {
483 static const T*
get(ASTNodeKind NodeKind,
const void*Storage) {
484 if(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
488 static const T&
getUnchecked(ASTNodeKind NodeKind,
const void*Storage) {
489assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
490 return*
static_cast<const T*
>(
reinterpret_cast<constBaseT *
>(
Storage));
510llvm::AlignedCharArrayUnion<
const void*, TemplateArgument,
511TemplateArgumentLoc, NestedNameSpecifierLoc,
512QualType, TypeLoc, ObjCProtocolLoc>
516template<
typenameT>
517structDynTypedNode::BaseConverter<
518 T, std::enable_if_t<std::is_base_of<Decl, T>::value>>
519:
publicDynCastPtrConverter<T, Decl> {};
521template<
typenameT>
522structDynTypedNode::BaseConverter<
523 T,
std::enable_if_t<std::is_base_of<Stmt, T>::value>>
524:
publicDynCastPtrConverter<T, Stmt> {};
526template<
typenameT>
527structDynTypedNode::BaseConverter<
528 T,
std::enable_if_t<std::is_base_of<Type, T>::value>>
529:
publicDynCastPtrConverter<T, Type> {};
531template<
typenameT>
532structDynTypedNode::BaseConverter<
533 T,
std::enable_if_t<std::is_base_of<OMPClause, T>::value>>
534:
publicDynCastPtrConverter<T, OMPClause> {};
536template<
typenameT>
537structDynTypedNode::BaseConverter<
538 T,
std::enable_if_t<std::is_base_of<Attr, T>::value>>
539:
publicDynCastPtrConverter<T, Attr> {};
542structDynTypedNode::BaseConverter<
546structDynTypedNode::BaseConverter<
550structDynTypedNode::BaseConverter<
555:
publicValueConverter<TemplateArgumentLoc> {};
559:
publicValueConverter<LambdaCapture> {};
562structDynTypedNode::BaseConverter<
563 TemplateName, void> :
publicValueConverter<TemplateName> {};
566structDynTypedNode::BaseConverter<
568void> :
publicValueConverter<NestedNameSpecifierLoc> {};
572void> :
publicValueConverter<QualType> {};
574template<
typenameT>
575structDynTypedNode::BaseConverter<
576 T,
std::enable_if_t<std::is_base_of<TypeLoc, T>::value>>
577:
publicDynCastValueConverter<T, TypeLoc> {};
581:
publicPtrConverter<CXXBaseSpecifier> {};
585:
publicValueConverter<ObjCProtocolLoc> {};
589:
publicPtrConverter<ConceptReference> {};
595template<
typenameT,
typenameEnablerT>
structDynTypedNode::BaseConverter {
Forward declaration of all AST node types.
#define KIND_TO_KIND_ID(Class)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the LambdaCapture class.
Defines the clang::TypeLoc interface and its subclasses.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
static ASTNodeKind getFromNode(const LambdaCapture &L)
StringRef asStringRef() const
String representation of the kind.
bool isBaseOf(ASTNodeKind Other) const
Returns true if this is a base kind of (or same as) Other.
constexpr ASTNodeKind()
Empty identifier. It matches nothing.
ASTNodeKind getCladeKind() const
constexpr bool hasPointerIdentity() const
Check if the given ASTNodeKind identifies a type that offers pointer identity.
constexpr bool operator<(const ASTNodeKind &Other) const
Strict weak ordering for ASTNodeKind.
static ASTNodeKind getMostDerivedCommonAncestor(ASTNodeKind Kind1, ASTNodeKind Kind2)
Return the most derived common ancestor between Kind1 and Kind2.
static ASTNodeKind getMostDerivedType(ASTNodeKind Kind1, ASTNodeKind Kind2)
Return the most derived type between Kind1 and Kind2.
static ASTNodeKind getFromNode(const Decl &D)
constexpr bool isSame(ASTNodeKind Other) const
Returns true if this and Other represent the same kind.
constexpr bool isNone() const
Returns true only for the default ASTNodeKind()
static constexpr ASTNodeKind getFromNodeKind()
Construct an identifier for T.
Attr - This represents one attribute.
Represents a base class of a C++ class.
Represents a C++ base or member initializer.
A reference to a concept and its template args, as it appears in the code.
Decl - This represents one declaration (or definition), e.g.
A dynamically typed AST node container.
bool operator<(const DynTypedNode &Other) const
ASTNodeKind getNodeKind() const
SourceRange getSourceRange() const
For nodes which represent textual entities in the source code, return their SourceRange.
bool operator==(const DynTypedNode &Other) const
bool operator!=(const DynTypedNode &Other) const
const T * get() const
Retrieve the stored node as type T.
const T & getUnchecked() const
Retrieve the stored node as type T.
static DynTypedNode create(const T &Node)
Creates a DynTypedNode from Node.
const void * getMemoizationData() const
Returns a pointer that identifies the stored AST node.
void dump(llvm::raw_ostream &OS, const ASTContext &Context) const
Dumps the node to the given output stream.
void print(llvm::raw_ostream &OS, const PrintingPolicy &PP) const
Prints the node to the given output stream.
Describes the capture of a variable or of this, or of a C++1y init-capture.
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
This is a basic class for representing single OpenMP clause.
A (possibly-)qualified type.
A trivial tuple used to represent a source range.
Stmt - This represents one statement.
Location wrapper for a TemplateArgument.
Represents a template argument.
Represents a C++ template name within the type system.
Base wrapper for a particular "section" of type source info.
The base class of the type hierarchy.
DynTypedNode DynTypedNode
std::unique_ptr< DiagnosticConsumer > create(StringRef OutputFile, DiagnosticOptions *Diags, bool MergeChildRecords=false)
Returns a DiagnosticConsumer that serializes diagnostics to a bitcode file.
NodeKind
A kind of a syntax node, used for implementing casts.
The JSON file list parser is used to communicate input to InstallAPI.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
TraversalKind
Defines how we descend a level in the AST when we pass through expressions.
@ TK_AsIs
Will traverse all child nodes.
@ TK_IgnoreUnlessSpelledInSource
Ignore AST nodes not written in the source.
@ Result
The result type of a method or function.
const FunctionProtoType * T
@ Other
Other implicit parameter.
Diagnostic wrappers for TextAPI types for error reporting.
hash_code hash_value(const clang::tooling::dependencies::ModuleID &ID)
Hooks for using ASTNodeKind as a key in a DenseMap.
static ASTNodeKind getEmptyKey()
static unsigned getHashValue(const ASTNodeKind &Val)
static bool isEqual(const ASTNodeKind &LHS, const ASTNodeKind &RHS)
static ASTNodeKind getTombstoneKey()
Hooks for using DynTypedNode as a key in a DenseMap.
static unsigned getHashValue(const DynTypedNode &Val)
static DynTypedNode getEmptyKey()
static bool isEqual(const DynTypedNode &LHS, const DynTypedNode &RHS)
static DynTypedNode getTombstoneKey()
Describes how types, statements, expressions, and declarations should be printed.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4