Warning, /include/clang/Tooling/Syntax/NodeClasses.inc is written in an unsupported language. File is not indexed.
0001 /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
0002 |* *|
0003 |* Syntax tree node list *|
0004 |* *|
0005 |* Automatically generated file, do not edit! *|
0006 |* From: Nodes.td *|
0007 |* *|
0008 \*===----------------------------------------------------------------------===*/
0009
0010
0011 // Forward-declare node types so we don't have to carefully sequence definitions.
0012 class Node;
0013 class Leaf;
0014 class Tree;
0015 class ArraySubscript;
0016 class Declaration;
0017 class EmptyDeclaration;
0018 class ExplicitTemplateInstantiation;
0019 class LinkageSpecificationDeclaration;
0020 class NamespaceAliasDefinition;
0021 class NamespaceDefinition;
0022 class SimpleDeclaration;
0023 class StaticAssertDeclaration;
0024 class TemplateDeclaration;
0025 class TypeAliasDeclaration;
0026 class UnknownDeclaration;
0027 class UsingDeclaration;
0028 class UsingNamespaceDirective;
0029 class Declarator;
0030 class ParenDeclarator;
0031 class SimpleDeclarator;
0032 class Expression;
0033 class BinaryOperatorExpression;
0034 class CallExpression;
0035 class IdExpression;
0036 class LiteralExpression;
0037 class BoolLiteralExpression;
0038 class CharacterLiteralExpression;
0039 class CxxNullPtrExpression;
0040 class FloatingLiteralExpression;
0041 class IntegerLiteralExpression;
0042 class StringLiteralExpression;
0043 class UserDefinedLiteralExpression;
0044 class CharUserDefinedLiteralExpression;
0045 class FloatUserDefinedLiteralExpression;
0046 class IntegerUserDefinedLiteralExpression;
0047 class StringUserDefinedLiteralExpression;
0048 class MemberExpression;
0049 class ParenExpression;
0050 class ThisExpression;
0051 class UnknownExpression;
0052 class List;
0053 class CallArguments;
0054 class DeclaratorList;
0055 class NestedNameSpecifier;
0056 class ParameterDeclarationList;
0057 class MemberPointer;
0058 class NameSpecifier;
0059 class DecltypeNameSpecifier;
0060 class GlobalNameSpecifier;
0061 class IdentifierNameSpecifier;
0062 class SimpleTemplateNameSpecifier;
0063 class ParametersAndQualifiers;
0064 class Statement;
0065 class BreakStatement;
0066 class CaseStatement;
0067 class CompoundStatement;
0068 class ContinueStatement;
0069 class DeclarationStatement;
0070 class DefaultStatement;
0071 class EmptyStatement;
0072 class ExpressionStatement;
0073 class ForStatement;
0074 class IfStatement;
0075 class RangeBasedForStatement;
0076 class ReturnStatement;
0077 class SwitchStatement;
0078 class UnknownStatement;
0079 class WhileStatement;
0080 class TrailingReturnType;
0081 class TranslationUnit;
0082 class UnaryOperatorExpression;
0083 class PostfixUnaryOperatorExpression;
0084 class PrefixUnaryOperatorExpression;
0085 class UnqualifiedId;
0086
0087 // Node definitions
0088
0089 /// A base class for all expressions. Note that expressions are not statements,
0090 /// even though they are in clang.
0091 class Expression : public Tree {
0092 protected:
0093 Expression(NodeKind K) : Tree(K) {}
0094 public:
0095 static bool classof(const Node *N);
0096 };
0097
0098 /// A function call. C++ [expr.call]
0099 /// call-expression:
0100 /// expression '(' call-arguments ')'
0101 /// e.g `f(1, '2')` or `this->Base::f()`
0102 class CallExpression final : public Expression {
0103 public:
0104 CallExpression() : Expression(NodeKind::CallExpression) {}
0105 Expression *getCallee() {
0106 return llvm::cast_or_null<Expression>(findChild(NodeRole::Callee));
0107 }
0108 const Expression *getCallee() const {
0109 return llvm::cast_or_null<Expression>(findChild(NodeRole::Callee));
0110 }
0111 Leaf *getOpenParen() {
0112 return llvm::cast_or_null<Leaf>(findChild(NodeRole::OpenParen));
0113 }
0114 const Leaf *getOpenParen() const {
0115 return llvm::cast_or_null<Leaf>(findChild(NodeRole::OpenParen));
0116 }
0117 CallArguments *getArguments() {
0118 return llvm::cast_or_null<CallArguments>(findChild(NodeRole::Arguments));
0119 }
0120 const CallArguments *getArguments() const {
0121 return llvm::cast_or_null<CallArguments>(findChild(NodeRole::Arguments));
0122 }
0123 Leaf *getCloseParen() {
0124 return llvm::cast_or_null<Leaf>(findChild(NodeRole::CloseParen));
0125 }
0126 const Leaf *getCloseParen() const {
0127 return llvm::cast_or_null<Leaf>(findChild(NodeRole::CloseParen));
0128 }
0129 static bool classof(const Node *N);
0130 };
0131
0132 /// Models an `id-expression`, e.g. `std::vector<int>::size`.
0133 /// C++ [expr.prim.id]
0134 /// id-expression:
0135 /// unqualified-id
0136 /// qualified-id
0137 /// qualified-id:
0138 /// nested-name-specifier template_opt unqualified-id
0139 class IdExpression final : public Expression {
0140 public:
0141 IdExpression() : Expression(NodeKind::IdExpression) {}
0142 NestedNameSpecifier *getQualifier() {
0143 return llvm::cast_or_null<NestedNameSpecifier>(findChild(NodeRole::Qualifier));
0144 }
0145 const NestedNameSpecifier *getQualifier() const {
0146 return llvm::cast_or_null<NestedNameSpecifier>(findChild(NodeRole::Qualifier));
0147 }
0148 Leaf *getTemplateKeyword() {
0149 return llvm::cast_or_null<Leaf>(findChild(NodeRole::TemplateKeyword));
0150 }
0151 const Leaf *getTemplateKeyword() const {
0152 return llvm::cast_or_null<Leaf>(findChild(NodeRole::TemplateKeyword));
0153 }
0154 UnqualifiedId *getUnqualifiedId() {
0155 return llvm::cast_or_null<UnqualifiedId>(findChild(NodeRole::UnqualifiedId));
0156 }
0157 const UnqualifiedId *getUnqualifiedId() const {
0158 return llvm::cast_or_null<UnqualifiedId>(findChild(NodeRole::UnqualifiedId));
0159 }
0160 static bool classof(const Node *N);
0161 };
0162
0163 /// Expression for literals. C++ [lex.literal]
0164 class LiteralExpression : public Expression {
0165 protected:
0166 LiteralExpression(NodeKind K) : Expression(K) {}
0167 public:
0168 static bool classof(const Node *N);
0169 };
0170
0171 /// Expression for boolean literals. C++ [lex.bool]
0172 class BoolLiteralExpression final : public LiteralExpression {
0173 public:
0174 BoolLiteralExpression() : LiteralExpression(NodeKind::BoolLiteralExpression) {}
0175 Leaf *getLiteralToken() {
0176 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0177 }
0178 const Leaf *getLiteralToken() const {
0179 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0180 }
0181 static bool classof(const Node *N);
0182 };
0183
0184 /// Expression for character literals. C++ [lex.ccon]
0185 class CharacterLiteralExpression final : public LiteralExpression {
0186 public:
0187 CharacterLiteralExpression() : LiteralExpression(NodeKind::CharacterLiteralExpression) {}
0188 Leaf *getLiteralToken() {
0189 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0190 }
0191 const Leaf *getLiteralToken() const {
0192 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0193 }
0194 static bool classof(const Node *N);
0195 };
0196
0197 /// Expression for the `nullptr` literal. C++ [lex.nullptr]
0198 class CxxNullPtrExpression final : public LiteralExpression {
0199 public:
0200 CxxNullPtrExpression() : LiteralExpression(NodeKind::CxxNullPtrExpression) {}
0201 Leaf *getLiteralToken() {
0202 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0203 }
0204 const Leaf *getLiteralToken() const {
0205 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0206 }
0207 static bool classof(const Node *N);
0208 };
0209
0210 /// Expression for floating-point literals. C++ [lex.fcon]
0211 class FloatingLiteralExpression final : public LiteralExpression {
0212 public:
0213 FloatingLiteralExpression() : LiteralExpression(NodeKind::FloatingLiteralExpression) {}
0214 Leaf *getLiteralToken() {
0215 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0216 }
0217 const Leaf *getLiteralToken() const {
0218 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0219 }
0220 static bool classof(const Node *N);
0221 };
0222
0223 /// Expression for integer literals. C++ [lex.icon]
0224 class IntegerLiteralExpression final : public LiteralExpression {
0225 public:
0226 IntegerLiteralExpression() : LiteralExpression(NodeKind::IntegerLiteralExpression) {}
0227 Leaf *getLiteralToken() {
0228 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0229 }
0230 const Leaf *getLiteralToken() const {
0231 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0232 }
0233 static bool classof(const Node *N);
0234 };
0235
0236 /// Expression for string-literals. C++ [lex.string]
0237 class StringLiteralExpression final : public LiteralExpression {
0238 public:
0239 StringLiteralExpression() : LiteralExpression(NodeKind::StringLiteralExpression) {}
0240 Leaf *getLiteralToken() {
0241 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0242 }
0243 const Leaf *getLiteralToken() const {
0244 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0245 }
0246 static bool classof(const Node *N);
0247 };
0248
0249 /// Expression for user-defined literal. C++ [lex.ext]
0250 /// user-defined-literal:
0251 /// user-defined-integer-literal
0252 /// user-defined-floating-point-literal
0253 /// user-defined-string-literal
0254 /// user-defined-character-literal
0255 class UserDefinedLiteralExpression : public LiteralExpression {
0256 protected:
0257 UserDefinedLiteralExpression(NodeKind K) : LiteralExpression(K) {}
0258 public:
0259 static bool classof(const Node *N);
0260 };
0261
0262 /// Expression for user-defined-character-literal. C++ [lex.ext]
0263 class CharUserDefinedLiteralExpression final : public UserDefinedLiteralExpression {
0264 public:
0265 CharUserDefinedLiteralExpression() : UserDefinedLiteralExpression(NodeKind::CharUserDefinedLiteralExpression) {}
0266 Leaf *getLiteralToken() {
0267 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0268 }
0269 const Leaf *getLiteralToken() const {
0270 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0271 }
0272 static bool classof(const Node *N);
0273 };
0274
0275 /// Expression for user-defined-floating-point-literal. C++ [lex.ext]
0276 class FloatUserDefinedLiteralExpression final : public UserDefinedLiteralExpression {
0277 public:
0278 FloatUserDefinedLiteralExpression() : UserDefinedLiteralExpression(NodeKind::FloatUserDefinedLiteralExpression) {}
0279 Leaf *getLiteralToken() {
0280 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0281 }
0282 const Leaf *getLiteralToken() const {
0283 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0284 }
0285 static bool classof(const Node *N);
0286 };
0287
0288 /// Expression for user-defined-integer-literal. C++ [lex.ext]
0289 class IntegerUserDefinedLiteralExpression final : public UserDefinedLiteralExpression {
0290 public:
0291 IntegerUserDefinedLiteralExpression() : UserDefinedLiteralExpression(NodeKind::IntegerUserDefinedLiteralExpression) {}
0292 Leaf *getLiteralToken() {
0293 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0294 }
0295 const Leaf *getLiteralToken() const {
0296 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0297 }
0298 static bool classof(const Node *N);
0299 };
0300
0301 /// Expression for user-defined-string-literal. C++ [lex.ext]
0302 class StringUserDefinedLiteralExpression final : public UserDefinedLiteralExpression {
0303 public:
0304 StringUserDefinedLiteralExpression() : UserDefinedLiteralExpression(NodeKind::StringUserDefinedLiteralExpression) {}
0305 Leaf *getLiteralToken() {
0306 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0307 }
0308 const Leaf *getLiteralToken() const {
0309 return llvm::cast_or_null<Leaf>(findChild(NodeRole::LiteralToken));
0310 }
0311 static bool classof(const Node *N);
0312 };
0313
0314 /// Models a class member access. C++ [expr.ref]
0315 /// member-expression:
0316 /// expression -> template_opt id-expression
0317 /// expression . template_opt id-expression
0318 /// e.g. `x.a`, `xp->a`
0319 ///
0320 /// Note: An implicit member access inside a class, i.e. `a` instead of
0321 /// `this->a`, is an `id-expression`.
0322 class MemberExpression final : public Expression {
0323 public:
0324 MemberExpression() : Expression(NodeKind::MemberExpression) {}
0325 Expression *getObject() {
0326 return llvm::cast_or_null<Expression>(findChild(NodeRole::Object));
0327 }
0328 const Expression *getObject() const {
0329 return llvm::cast_or_null<Expression>(findChild(NodeRole::Object));
0330 }
0331 Leaf *getAccessToken() {
0332 return llvm::cast_or_null<Leaf>(findChild(NodeRole::AccessToken));
0333 }
0334 const Leaf *getAccessToken() const {
0335 return llvm::cast_or_null<Leaf>(findChild(NodeRole::AccessToken));
0336 }
0337 Leaf *getTemplateKeyword() {
0338 return llvm::cast_or_null<Leaf>(findChild(NodeRole::TemplateKeyword));
0339 }
0340 const Leaf *getTemplateKeyword() const {
0341 return llvm::cast_or_null<Leaf>(findChild(NodeRole::TemplateKeyword));
0342 }
0343 IdExpression *getMember() {
0344 return llvm::cast_or_null<IdExpression>(findChild(NodeRole::Member));
0345 }
0346 const IdExpression *getMember() const {
0347 return llvm::cast_or_null<IdExpression>(findChild(NodeRole::Member));
0348 }
0349 static bool classof(const Node *N);
0350 };
0351
0352 /// Models a parenthesized expression `(E)`. C++ [expr.prim.paren]
0353 /// e.g. `(3 + 2)` in `a = 1 + (3 + 2);`
0354 class ParenExpression final : public Expression {
0355 public:
0356 ParenExpression() : Expression(NodeKind::ParenExpression) {}
0357 Leaf *getOpenParen() {
0358 return llvm::cast_or_null<Leaf>(findChild(NodeRole::OpenParen));
0359 }
0360 const Leaf *getOpenParen() const {
0361 return llvm::cast_or_null<Leaf>(findChild(NodeRole::OpenParen));
0362 }
0363 Expression *getSubExpression() {
0364 return llvm::cast_or_null<Expression>(findChild(NodeRole::SubExpression));
0365 }
0366 const Expression *getSubExpression() const {
0367 return llvm::cast_or_null<Expression>(findChild(NodeRole::SubExpression));
0368 }
0369 Leaf *getCloseParen() {
0370 return llvm::cast_or_null<Leaf>(findChild(NodeRole::CloseParen));
0371 }
0372 const Leaf *getCloseParen() const {
0373 return llvm::cast_or_null<Leaf>(findChild(NodeRole::CloseParen));
0374 }
0375 static bool classof(const Node *N);
0376 };
0377
0378 /// Models a this expression `this`. C++ [expr.prim.this]
0379 class ThisExpression final : public Expression {
0380 public:
0381 ThisExpression() : Expression(NodeKind::ThisExpression) {}
0382 Leaf *getIntroducerKeyword() {
0383 return llvm::cast_or_null<Leaf>(findChild(NodeRole::IntroducerKeyword));
0384 }
0385 const Leaf *getIntroducerKeyword() const {
0386 return llvm::cast_or_null<Leaf>(findChild(NodeRole::IntroducerKeyword));
0387 }
0388 static bool classof(const Node *N);
0389 };
0390
0391 /// A sequence of these specifiers make a `nested-name-specifier`.
0392 /// e.g. the `std` or `vector<int>` in `std::vector<int>::size`.
0393 class NameSpecifier : public Tree {
0394 protected:
0395 NameSpecifier(NodeKind K) : Tree(K) {}
0396 public:
0397 static bool classof(const Node *N);
0398 };
0399
0400 /// A name specifier holding a decltype, of the form: `decltype ( expression ) `
0401 /// e.g. the `decltype(s)` in `decltype(s)::size`.
0402 class DecltypeNameSpecifier final : public NameSpecifier {
0403 public:
0404 DecltypeNameSpecifier() : NameSpecifier(NodeKind::DecltypeNameSpecifier) {}
0405 static bool classof(const Node *N);
0406 };
0407
0408 /// The global namespace name specifier, this specifier doesn't correspond to a
0409 /// token instead an absence of tokens before a `::` characterizes it, in
0410 /// `::std::vector<int>` it would be characterized by the absence of a token
0411 /// before the first `::`
0412 class GlobalNameSpecifier final : public NameSpecifier {
0413 public:
0414 GlobalNameSpecifier() : NameSpecifier(NodeKind::GlobalNameSpecifier) {}
0415 static bool classof(const Node *N);
0416 };
0417
0418 /// A identifier name specifier, of the form `identifier`
0419 /// e.g. the `std` in `std::vector<int>::size`.
0420 class IdentifierNameSpecifier final : public NameSpecifier {
0421 public:
0422 IdentifierNameSpecifier() : NameSpecifier(NodeKind::IdentifierNameSpecifier) {}
0423 static bool classof(const Node *N);
0424 };
0425
0426 /// A name specifier with a simple-template-id, of the form `template_opt
0427 /// identifier < template-args >` e.g. the `vector<int>` in
0428 /// `std::vector<int>::size`.
0429 class SimpleTemplateNameSpecifier final : public NameSpecifier {
0430 public:
0431 SimpleTemplateNameSpecifier() : NameSpecifier(NodeKind::SimpleTemplateNameSpecifier) {}
0432 static bool classof(const Node *N);
0433 };
0434
0435 /// A root node for a translation unit. Parent is always null.
0436 class TranslationUnit final : public Tree {
0437 public:
0438 TranslationUnit() : Tree(NodeKind::TranslationUnit) {}
0439 static bool classof(const Node *N);
0440 };
0441