;
27constASTNodeKind::KindInfo ASTNodeKind::AllKindInfo[] = {
28{NKI_None,
"<None>"},
29{NKI_None,
"TemplateArgument"},
30{NKI_None,
"TemplateArgumentLoc"},
31{NKI_None,
"LambdaCapture"},
32{NKI_None,
"TemplateName"},
33{NKI_None,
"NestedNameSpecifierLoc"},
34{NKI_None,
"QualType"},
35#define TYPELOC(CLASS, PARENT) {NKI_##PARENT, #CLASS "TypeLoc"},
36#include "clang/AST/TypeLocNodes.def" 37{NKI_None,
"TypeLoc"},
38{NKI_None,
"CXXBaseSpecifier"},
39{NKI_None,
"CXXCtorInitializer"},
40{NKI_None,
"NestedNameSpecifier"},
42#define DECL(DERIVED, BASE) { NKI_##BASE, #DERIVED "Decl"},
43#include "clang/AST/DeclNodes.inc" 45#define STMT(DERIVED, BASE) { NKI_##BASE, #DERIVED }, 46#include "clang/AST/StmtNodes.inc" 48#define TYPE(DERIVED, BASE) { NKI_##BASE, #DERIVED "Type"},
49#include "clang/AST/TypeNodes.inc" 50{NKI_None,
"OMPClause"},
51#define GEN_CLANG_CLAUSE_CLASS 52#define CLAUSE_CLASS(Enum, Str, Class) {NKI_OMPClause, #Class}, 53#include "llvm/Frontend/OpenMP/OMP.inc" 55#define ATTR(A) {NKI_Attr, #A "Attr"},
56#include "clang/Basic/AttrList.inc" 57{NKI_None,
"ObjCProtocolLoc"},
58{NKI_None,
"ConceptReference"},
70 if(
Base== NKI_None || Derived == NKI_None)
72 while(Derived !=
Base&& Derived != NKI_None) {
73Derived = AllKindInfo[Derived].ParentId;
75 returnDerived ==
Base;
80 if(
Base== NKI_None || Derived == NKI_None)
return false;
82 while(Derived !=
Base&& Derived != NKI_None) {
83Derived = AllKindInfo[Derived].ParentId;
88 returnDerived ==
Base;
92NodeKindId LastId = KindId;
94NodeKindId ParentId = AllKindInfo[LastId].ParentId;
95 if(ParentId == NKI_None)
106 if(Kind1.
isBaseOf(Kind2))
returnKind2;
107 if(Kind2.
isBaseOf(Kind1))
returnKind1;
113NodeKindId
Parent= Kind1.KindId;
122#define DECL(DERIVED, BASE) \ 123 case Decl::DERIVED: return ASTNodeKind(NKI_##DERIVED##Decl); 124#define ABSTRACT_DECL(D) 125#include "clang/AST/DeclNodes.inc" 127llvm_unreachable(
"invalid decl kind");
131 switch(S.getStmtClass()) {
133#define STMT(CLASS, PARENT) \ 134 case Stmt::CLASS##Class: return ASTNodeKind(NKI_##CLASS); 135#define ABSTRACT_STMT(S) 136#include "clang/AST/StmtNodes.inc" 138llvm_unreachable(
"invalid stmt kind");
143#define TYPE(Class, Base) \ 144 case Type::Class: return ASTNodeKind(NKI_##Class##Type); 145#define ABSTRACT_TYPE(Class, Base) 146#include "clang/AST/TypeNodes.inc" 148llvm_unreachable(
"invalid type kind");
152 switch(
T.getTypeLocClass()) {
153#define ABSTRACT_TYPELOC(CLASS, PARENT) 154#define TYPELOC(CLASS, PARENT) \ 155 case TypeLoc::CLASS: \ 156 return ASTNodeKind(NKI_##CLASS##TypeLoc); 157#include "clang/AST/TypeLocNodes.def" 159llvm_unreachable(
"invalid typeloc kind");
163 switch(
C.getClauseKind()) {
164#define GEN_CLANG_CLAUSE_CLASS 165#define CLAUSE_CLASS(Enum, Str, Class) \ 166 case llvm::omp::Clause::Enum: \ 167 return ASTNodeKind(NKI_##Class); 168#define CLAUSE_NO_CLASS(Enum, Str) \ 169 case llvm::omp::Clause::Enum: \ 170 llvm_unreachable("unexpected OpenMP clause kind");
171#include "llvm/Frontend/OpenMP/OMP.inc" 173llvm_unreachable(
"invalid omp clause kind");
180 return ASTNodeKind(NKI_##A##Attr); 181#include "clang/Basic/AttrList.inc" 183llvm_unreachable(
"invalid attr kind");
189TA->print(PP, OS,
true);
191TAL->getArgument().print(PP, OS,
true);
200OS <<
"(empty NestedNameSpecifierLoc)";
201}
else if(
const QualType*QT = get<QualType>())
203 else if(
const TypeLoc*TL = get<TypeLoc>())
204TL->getType().print(OS, PP);
205 else if(
const Decl*
D= get<Decl>())
207 else if(
const Stmt*S = get<Stmt>())
208S->printPretty(OS,
nullptr, PP);
209 else if(
const Type*
T= get<Type>())
211 else if(
const Attr*A = get<Attr>())
212A->printPretty(OS, PP);
214 P->getProtocol()->print(OS, PP);
218OS <<
"Unable to print values of type "<< NodeKind.
asStringRef() <<
"\n";
223 if(
const Decl*
D= get<Decl>())
225 else if(
const Stmt*S = get<Stmt>())
226S->dump(OS, Context);
227 else if(
const Type*
T= get<Type>())
228 T->
dump(OS, Context);
231 else if(
const TypeLoc*TL = get<TypeLoc>())
232TL->dump(OS, Context);
234OS <<
"Unable to dump values of type "<< NodeKind.
asStringRef() <<
"\n";
239 returnCCI->getSourceRange();
241 returnNNSL->getSourceRange();
242 if(
const TypeLoc*TL = get<TypeLoc>())
243 returnTL->getSourceRange();
244 if(
const Decl*
D= get<Decl>())
246 if(
const Stmt*S = get<Stmt>())
247 returnS->getSourceRange();
249 returnTAL->getSourceRange();
250 if(
const auto*
C= get<OMPClause>())
252 if(
const auto*CBS = get<CXXBaseSpecifier>())
253 returnCBS->getSourceRange();
254 if(
const auto*A = get<Attr>())
255 returnA->getRange();
257 return P->getSourceRange();
259 return C->getSourceRange();
This file provides AST data structures related to concepts.
Defines the clang::ASTContext interface.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
This file defines OpenMP AST classes for clauses.
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 ...
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
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)
Attr - This represents one attribute.
attr::Kind getKind() const
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.
void print(raw_ostream &Out, unsigned Indentation=0, bool PrintInstantiation=false) const
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
SourceRange getSourceRange() const
For nodes which represent textual entities in the source code, return their SourceRange.
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.
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.
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
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.
TypeClass getTypeClass() const
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
@ Other
Other implicit parameter.
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