Skip to content

Commit fda3fa8

Browse files
author
Eduardo Caldas
committed
[SyntaxTree][NFC] Append "get" to syntax Nodes accessor names
Differential Revision: https://reviews.llvm.org/D86679
1 parent 45344cf commit fda3fa8

File tree

2 files changed

+144
-142
lines changed

2 files changed

+144
-142
lines changed

clang/include/clang/Tooling/Syntax/Nodes.h

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,9 @@ class NestedNameSpecifier final : public List {
271271
static bool classof(const Node *N) {
272272
return N->kind() <= NodeKind::NestedNameSpecifier;
273273
}
274-
std::vector<NameSpecifier *> specifiers();
274+
std::vector<NameSpecifier *> getSpecifiers();
275275
std::vector<List::ElementAndDelimiter<syntax::NameSpecifier>>
276-
specifiersAndDoubleColons();
276+
getSpecifiersAndDoubleColons();
277277
};
278278

279279
/// Models an `unqualified-id`. C++ [expr.prim.id.unqual]
@@ -299,9 +299,9 @@ class IdExpression final : public Expression {
299299
static bool classof(const Node *N) {
300300
return N->kind() == NodeKind::IdExpression;
301301
}
302-
NestedNameSpecifier *qualifier();
303-
Leaf *templateKeyword();
304-
UnqualifiedId *unqualifiedId();
302+
NestedNameSpecifier *getQualifier();
303+
Leaf *getTemplateKeyword();
304+
UnqualifiedId *getUnqualifiedId();
305305
};
306306

307307
/// An expression of an unknown kind, i.e. one not currently handled by the
@@ -321,7 +321,7 @@ class ThisExpression final : public Expression {
321321
static bool classof(const Node *N) {
322322
return N->kind() == NodeKind::ThisExpression;
323323
}
324-
Leaf *thisKeyword();
324+
Leaf *getThisKeyword();
325325
};
326326

327327
/// Models arguments of a function call.
@@ -335,8 +335,8 @@ class CallArguments final : public List {
335335
static bool classof(const Node *N) {
336336
return N->kind() <= NodeKind::CallArguments;
337337
}
338-
std::vector<Expression *> arguments();
339-
std::vector<List::ElementAndDelimiter<Expression>> argumentsAndCommas();
338+
std::vector<Expression *> getArguments();
339+
std::vector<List::ElementAndDelimiter<Expression>> getArgumentsAndCommas();
340340
};
341341

342342
/// A function call. C++ [expr.call]
@@ -349,10 +349,10 @@ class CallExpression final : public Expression {
349349
static bool classof(const Node *N) {
350350
return N->kind() == NodeKind::CallExpression;
351351
}
352-
Expression *callee();
353-
Leaf *openParen();
354-
CallArguments *arguments();
355-
Leaf *closeParen();
352+
Expression *getCallee();
353+
Leaf *getOpenParen();
354+
CallArguments *getArguments();
355+
Leaf *getCloseParen();
356356
};
357357

358358
/// Models a parenthesized expression `(E)`. C++ [expr.prim.paren]
@@ -363,9 +363,9 @@ class ParenExpression final : public Expression {
363363
static bool classof(const Node *N) {
364364
return N->kind() == NodeKind::ParenExpression;
365365
}
366-
Leaf *openParen();
367-
Expression *subExpression();
368-
Leaf *closeParen();
366+
Leaf *getOpenParen();
367+
Expression *getSubExpression();
368+
Leaf *getCloseParen();
369369
};
370370

371371
/// Models a class member access. C++ [expr.ref]
@@ -382,10 +382,10 @@ class MemberExpression final : public Expression {
382382
static bool classof(const Node *N) {
383383
return N->kind() == NodeKind::MemberExpression;
384384
}
385-
Expression *object();
386-
Leaf *accessToken();
387-
Leaf *templateKeyword();
388-
IdExpression *member();
385+
Expression *getObject();
386+
Leaf *getAccessToken();
387+
Leaf *getTemplateKeyword();
388+
IdExpression *getMember();
389389
};
390390

391391
/// Expression for literals. C++ [lex.literal]
@@ -404,7 +404,7 @@ class LiteralExpression : public Expression {
404404
N->kind() == NodeKind::CharUserDefinedLiteralExpression ||
405405
N->kind() == NodeKind::StringUserDefinedLiteralExpression;
406406
}
407-
Leaf *literalToken();
407+
Leaf *getLiteralToken();
408408
};
409409

410410
/// Expression for integer literals. C++ [lex.icon]
@@ -539,8 +539,8 @@ class UnaryOperatorExpression : public Expression {
539539
return N->kind() == NodeKind::PrefixUnaryOperatorExpression ||
540540
N->kind() == NodeKind::PostfixUnaryOperatorExpression;
541541
}
542-
Leaf *operatorToken();
543-
Expression *operand();
542+
Leaf *getOperatorToken();
543+
Expression *getOperand();
544544
};
545545

546546
/// <operator> <operand>
@@ -588,9 +588,9 @@ class BinaryOperatorExpression final : public Expression {
588588
static bool classof(const Node *N) {
589589
return N->kind() == NodeKind::BinaryOperatorExpression;
590590
}
591-
Expression *lhs();
592-
Leaf *operatorToken();
593-
Expression *rhs();
591+
Expression *getLhs();
592+
Leaf *getOperatorToken();
593+
Expression *getRhs();
594594
};
595595

596596
/// An abstract node for C++ statements, e.g. 'while', 'if', etc.
@@ -639,8 +639,8 @@ class SwitchStatement final : public Statement {
639639
static bool classof(const Node *N) {
640640
return N->kind() == NodeKind::SwitchStatement;
641641
}
642-
Leaf *switchKeyword();
643-
Statement *body();
642+
Leaf *getSwitchKeyword();
643+
Statement *getBody();
644644
};
645645

646646
/// case <value>: <body>
@@ -650,9 +650,9 @@ class CaseStatement final : public Statement {
650650
static bool classof(const Node *N) {
651651
return N->kind() == NodeKind::CaseStatement;
652652
}
653-
Leaf *caseKeyword();
654-
Expression *caseValue();
655-
Statement *body();
653+
Leaf *getCaseKeyword();
654+
Expression *getCaseValue();
655+
Statement *getBody();
656656
};
657657

658658
/// default: <body>
@@ -662,8 +662,8 @@ class DefaultStatement final : public Statement {
662662
static bool classof(const Node *N) {
663663
return N->kind() == NodeKind::DefaultStatement;
664664
}
665-
Leaf *defaultKeyword();
666-
Statement *body();
665+
Leaf *getDefaultKeyword();
666+
Statement *getBody();
667667
};
668668

669669
/// if (cond) <then-statement> else <else-statement>
@@ -674,10 +674,10 @@ class IfStatement final : public Statement {
674674
static bool classof(const Node *N) {
675675
return N->kind() == NodeKind::IfStatement;
676676
}
677-
Leaf *ifKeyword();
678-
Statement *thenStatement();
679-
Leaf *elseKeyword();
680-
Statement *elseStatement();
677+
Leaf *getIfKeyword();
678+
Statement *getThenStatement();
679+
Leaf *getElseKeyword();
680+
Statement *getElseStatement();
681681
};
682682

683683
/// for (<init>; <cond>; <increment>) <body>
@@ -687,8 +687,8 @@ class ForStatement final : public Statement {
687687
static bool classof(const Node *N) {
688688
return N->kind() == NodeKind::ForStatement;
689689
}
690-
Leaf *forKeyword();
691-
Statement *body();
690+
Leaf *getForKeyword();
691+
Statement *getBody();
692692
};
693693

694694
/// while (<cond>) <body>
@@ -698,8 +698,8 @@ class WhileStatement final : public Statement {
698698
static bool classof(const Node *N) {
699699
return N->kind() == NodeKind::WhileStatement;
700700
}
701-
Leaf *whileKeyword();
702-
Statement *body();
701+
Leaf *getWhileKeyword();
702+
Statement *getBody();
703703
};
704704

705705
/// continue;
@@ -709,7 +709,7 @@ class ContinueStatement final : public Statement {
709709
static bool classof(const Node *N) {
710710
return N->kind() == NodeKind::ContinueStatement;
711711
}
712-
Leaf *continueKeyword();
712+
Leaf *getContinueKeyword();
713713
};
714714

715715
/// break;
@@ -719,7 +719,7 @@ class BreakStatement final : public Statement {
719719
static bool classof(const Node *N) {
720720
return N->kind() == NodeKind::BreakStatement;
721721
}
722-
Leaf *breakKeyword();
722+
Leaf *getBreakKeyword();
723723
};
724724

725725
/// return <expr>;
@@ -730,8 +730,8 @@ class ReturnStatement final : public Statement {
730730
static bool classof(const Node *N) {
731731
return N->kind() == NodeKind::ReturnStatement;
732732
}
733-
Leaf *returnKeyword();
734-
Expression *returnValue();
733+
Leaf *getReturnKeyword();
734+
Expression *getReturnValue();
735735
};
736736

737737
/// for (<decl> : <init>) <body>
@@ -741,8 +741,8 @@ class RangeBasedForStatement final : public Statement {
741741
static bool classof(const Node *N) {
742742
return N->kind() == NodeKind::RangeBasedForStatement;
743743
}
744-
Leaf *forKeyword();
745-
Statement *body();
744+
Leaf *getForKeyword();
745+
Statement *getBody();
746746
};
747747

748748
/// Expression in a statement position, e.g. functions calls inside compound
@@ -753,7 +753,7 @@ class ExpressionStatement final : public Statement {
753753
static bool classof(const Node *N) {
754754
return N->kind() == NodeKind::ExpressionStatement;
755755
}
756-
Expression *expression();
756+
Expression *getExpression();
757757
};
758758

759759
/// { statement1; statement2; … }
@@ -763,10 +763,10 @@ class CompoundStatement final : public Statement {
763763
static bool classof(const Node *N) {
764764
return N->kind() == NodeKind::CompoundStatement;
765765
}
766-
Leaf *lbrace();
766+
Leaf *getLbrace();
767767
/// FIXME: use custom iterator instead of 'vector'.
768-
std::vector<Statement *> statements();
769-
Leaf *rbrace();
768+
std::vector<Statement *> getStatements();
769+
Leaf *getRbrace();
770770
};
771771

772772
/// A declaration that can appear at the top-level. Note that this does *not*
@@ -808,8 +808,8 @@ class StaticAssertDeclaration final : public Declaration {
808808
static bool classof(const Node *N) {
809809
return N->kind() == NodeKind::StaticAssertDeclaration;
810810
}
811-
Expression *condition();
812-
Expression *message();
811+
Expression *getCondition();
812+
Expression *getMessage();
813813
};
814814

815815
/// extern <string-literal> declaration
@@ -833,7 +833,7 @@ class SimpleDeclaration final : public Declaration {
833833
return N->kind() == NodeKind::SimpleDeclaration;
834834
}
835835
/// FIXME: use custom iterator instead of 'vector'.
836-
std::vector<SimpleDeclarator *> declarators();
836+
std::vector<SimpleDeclarator *> getDeclarators();
837837
};
838838

839839
/// template <template-parameters> <declaration>
@@ -843,8 +843,8 @@ class TemplateDeclaration final : public Declaration {
843843
static bool classof(const Node *N) {
844844
return N->kind() == NodeKind::TemplateDeclaration;
845845
}
846-
Leaf *templateKeyword();
847-
Declaration *declaration();
846+
Leaf *getTemplateKeyword();
847+
Declaration *getDeclaration();
848848
};
849849

850850
/// template <declaration>
@@ -859,9 +859,9 @@ class ExplicitTemplateInstantiation final : public Declaration {
859859
static bool classof(const Node *N) {
860860
return N->kind() == NodeKind::ExplicitTemplateInstantiation;
861861
}
862-
Leaf *templateKeyword();
863-
Leaf *externKeyword();
864-
Declaration *declaration();
862+
Leaf *getTemplateKeyword();
863+
Leaf *getExternKeyword();
864+
Declaration *getDeclaration();
865865
};
866866

867867
/// namespace <name> { <decls> }
@@ -951,8 +951,8 @@ class ParenDeclarator final : public Declarator {
951951
static bool classof(const Node *N) {
952952
return N->kind() == NodeKind::ParenDeclarator;
953953
}
954-
Leaf *lparen();
955-
Leaf *rparen();
954+
Leaf *getLparen();
955+
Leaf *getRparen();
956956
};
957957

958958
/// Array size specified inside a declarator.
@@ -966,9 +966,9 @@ class ArraySubscript final : public Tree {
966966
return N->kind() == NodeKind::ArraySubscript;
967967
}
968968
// TODO: add an accessor for the "static" keyword.
969-
Leaf *lbracket();
970-
Expression *size();
971-
Leaf *rbracket();
969+
Leaf *getLbracket();
970+
Expression *getSize();
971+
Leaf *getRbracket();
972972
};
973973

974974
/// Trailing return type after the parameter list, including the arrow token.
@@ -980,10 +980,10 @@ class TrailingReturnType final : public Tree {
980980
return N->kind() == NodeKind::TrailingReturnType;
981981
}
982982
// TODO: add accessors for specifiers.
983-
Leaf *arrowToken();
983+
Leaf *getArrowToken();
984984
// FIXME: This should be a `type-id` following the grammar. Fix this once we
985985
// have a representation of `type-id`s.
986-
SimpleDeclarator *declarator();
986+
SimpleDeclarator *getDeclarator();
987987
};
988988

989989
/// Models a `parameter-declaration-list` which appears within
@@ -994,9 +994,9 @@ class ParameterDeclarationList final : public List {
994994
static bool classof(const Node *N) {
995995
return N->kind() == NodeKind::ParameterDeclarationList;
996996
}
997-
std::vector<SimpleDeclaration *> parameterDeclarations();
997+
std::vector<SimpleDeclaration *> getParameterDeclarations();
998998
std::vector<List::ElementAndDelimiter<syntax::SimpleDeclaration>>
999-
parametersAndCommas();
999+
getParametersAndCommas();
10001000
};
10011001

10021002
/// Parameter list for a function type and a trailing return type, if the
@@ -1016,10 +1016,10 @@ class ParametersAndQualifiers final : public Tree {
10161016
static bool classof(const Node *N) {
10171017
return N->kind() == NodeKind::ParametersAndQualifiers;
10181018
}
1019-
Leaf *lparen();
1020-
ParameterDeclarationList *parameters();
1021-
Leaf *rparen();
1022-
TrailingReturnType *trailingReturn();
1019+
Leaf *getLparen();
1020+
ParameterDeclarationList *getParameters();
1021+
Leaf *getRparen();
1022+
TrailingReturnType *getTrailingReturn();
10231023
};
10241024

10251025
/// Member pointer inside a declarator

0 commit comments

Comments
 (0)