eduucaldas created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
eduucaldas requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85427

Files:
  clang/include/clang/Tooling/Syntax/Nodes.h
  clang/include/clang/Tooling/Syntax/Tree.h
  clang/lib/Tooling/Syntax/BuildTree.cpp
  clang/lib/Tooling/Syntax/Tree.cpp

Index: clang/lib/Tooling/Syntax/Tree.cpp
===================================================================
--- clang/lib/Tooling/Syntax/Tree.cpp
+++ clang/lib/Tooling/Syntax/Tree.cpp
@@ -36,9 +36,7 @@
                      const TokenBuffer &Tokens)
     : SourceMgr(SourceMgr), LangOpts(LangOpts), Tokens(Tokens) {}
 
-const clang::syntax::TokenBuffer &syntax::Arena::tokenBuffer() const {
-  return Tokens;
-}
+const syntax::TokenBuffer &syntax::Arena::tokenBuffer() const { return Tokens; }
 
 std::pair<FileID, llvm::ArrayRef<syntax::Token>>
 syntax::Arena::lexBuffer(std::unique_ptr<llvm::MemoryBuffer> Input) {
Index: clang/lib/Tooling/Syntax/BuildTree.cpp
===================================================================
--- clang/lib/Tooling/Syntax/BuildTree.cpp
+++ clang/lib/Tooling/Syntax/BuildTree.cpp
@@ -45,7 +45,7 @@
 using namespace clang;
 
 LLVM_ATTRIBUTE_UNUSED
-static bool isImplicitExpr(clang::Expr *E) { return E->IgnoreImplicit() != E; }
+static bool isImplicitExpr(Expr *E) { return E->IgnoreImplicit() != E; }
 
 namespace {
 /// Get start location of the Declarator from the TypeLoc.
@@ -384,7 +384,7 @@
   }
 
   llvm::ArrayRef<syntax::Token> getDeclarationRange(Decl *D) {
-    llvm::ArrayRef<clang::syntax::Token> Tokens;
+    llvm::ArrayRef<syntax::Token> Tokens;
     // We want to drop the template parameters for specializations.
     if (const auto *S = llvm::dyn_cast<TagDecl>(D))
       Tokens = getRange(S->TypeDecl::getBeginLoc(), S->getEndLoc());
@@ -722,16 +722,16 @@
   syntax::UserDefinedLiteralExpression *
   buildUserDefinedLiteral(UserDefinedLiteral *S) {
     switch (S->getLiteralOperatorKind()) {
-    case clang::UserDefinedLiteral::LOK_Integer:
+    case UserDefinedLiteral::LOK_Integer:
       return new (allocator()) syntax::IntegerUserDefinedLiteralExpression;
-    case clang::UserDefinedLiteral::LOK_Floating:
+    case UserDefinedLiteral::LOK_Floating:
       return new (allocator()) syntax::FloatUserDefinedLiteralExpression;
-    case clang::UserDefinedLiteral::LOK_Character:
+    case UserDefinedLiteral::LOK_Character:
       return new (allocator()) syntax::CharUserDefinedLiteralExpression;
-    case clang::UserDefinedLiteral::LOK_String:
+    case UserDefinedLiteral::LOK_String:
       return new (allocator()) syntax::StringUserDefinedLiteralExpression;
-    case clang::UserDefinedLiteral::LOK_Raw:
-    case clang::UserDefinedLiteral::LOK_Template:
+    case UserDefinedLiteral::LOK_Raw:
+    case UserDefinedLiteral::LOK_Template:
       // For raw literal operator and numeric literal operator template we
       // cannot get the type of the operand in the semantic AST. We get this
       // information from the token. As integer and floating point have the same
Index: clang/include/clang/Tooling/Syntax/Tree.h
===================================================================
--- clang/include/clang/Tooling/Syntax/Tree.h
+++ clang/include/clang/Tooling/Syntax/Tree.h
@@ -50,7 +50,7 @@
   /// Add \p Buffer to the underlying source manager, tokenize it and store the
   /// resulting tokens. Useful when there is a need to materialize tokens that
   /// were not written in user code.
-  std::pair<FileID, llvm::ArrayRef<syntax::Token>>
+  std::pair<FileID, llvm::ArrayRef<Token>>
   lexBuffer(std::unique_ptr<llvm::MemoryBuffer> Buffer);
 
 private:
@@ -58,7 +58,7 @@
   const LangOptions &LangOpts;
   const TokenBuffer &Tokens;
   /// IDs and storage for additional tokenized files.
-  llvm::DenseMap<FileID, std::vector<syntax::Token>> ExtraTokens;
+  llvm::DenseMap<FileID, std::vector<Token>> ExtraTokens;
   /// Keeps all the allocated nodes and their intermediate data structures.
   llvm::BumpPtrAllocator Allocator;
 };
@@ -139,13 +139,13 @@
 /// A leaf node points to a single token inside the expanded token stream.
 class Leaf final : public Node {
 public:
-  Leaf(const syntax::Token *T);
+  Leaf(const Token *T);
   static bool classof(const Node *N);
 
-  const syntax::Token *token() const { return Tok; }
+  const Token *token() const { return Tok; }
 
 private:
-  const syntax::Token *Tok;
+  const Token *Tok;
 };
 
 /// A node that has children and represents a syntactic language construct.
@@ -167,7 +167,7 @@
 
 protected:
   /// Find the first node with a corresponding role.
-  syntax::Node *findChild(NodeRole R);
+  Node *findChild(NodeRole R);
 
 private:
   /// Prepend \p Child to the list of children and and sets the parent pointer.
Index: clang/include/clang/Tooling/Syntax/Nodes.h
===================================================================
--- clang/include/clang/Tooling/Syntax/Nodes.h
+++ clang/include/clang/Tooling/Syntax/Nodes.h
@@ -212,7 +212,7 @@
   static bool classof(const Node *N) {
     return N->kind() <= NodeKind::NestedNameSpecifier;
   }
-  std::vector<syntax::NameSpecifier *> specifiers();
+  std::vector<NameSpecifier *> specifiers();
 };
 
 /// Models an `unqualified-id`. C++ [expr.prim.id.unqual]
@@ -238,10 +238,10 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::IdExpression;
   }
-  syntax::NestedNameSpecifier *qualifier();
+  NestedNameSpecifier *qualifier();
   // TODO after expose `id-expression` from `DependentScopeDeclRefExpr`:
   // Add accessor for `template_opt`.
-  syntax::UnqualifiedId *unqualifiedId();
+  UnqualifiedId *unqualifiedId();
 };
 
 /// An expression of an unknown kind, i.e. one not currently handled by the
@@ -262,9 +262,9 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::ParenExpression;
   }
-  syntax::Leaf *openParen();
-  syntax::Expression *subExpression();
-  syntax::Leaf *closeParen();
+  Leaf *openParen();
+  Expression *subExpression();
+  Leaf *closeParen();
 };
 
 /// Expression for literals. C++ [lex.literal]
@@ -283,7 +283,7 @@
            N->kind() == NodeKind::CharUserDefinedLiteralExpression ||
            N->kind() == NodeKind::StringUserDefinedLiteralExpression;
   }
-  syntax::Leaf *literalToken();
+  Leaf *literalToken();
 };
 
 /// Expression for integer literals. C++ [lex.icon]
@@ -418,8 +418,8 @@
     return N->kind() == NodeKind::PrefixUnaryOperatorExpression ||
            N->kind() == NodeKind::PostfixUnaryOperatorExpression;
   }
-  syntax::Leaf *operatorToken();
-  syntax::Expression *operand();
+  Leaf *operatorToken();
+  Expression *operand();
 };
 
 /// <operator> <operand>
@@ -467,9 +467,9 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::BinaryOperatorExpression;
   }
-  syntax::Expression *lhs();
-  syntax::Leaf *operatorToken();
-  syntax::Expression *rhs();
+  Expression *lhs();
+  Leaf *operatorToken();
+  Expression *rhs();
 };
 
 /// An abstract node for C++ statements, e.g. 'while', 'if', etc.
@@ -518,8 +518,8 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::SwitchStatement;
   }
-  syntax::Leaf *switchKeyword();
-  syntax::Statement *body();
+  Leaf *switchKeyword();
+  Statement *body();
 };
 
 /// case <value>: <body>
@@ -529,9 +529,9 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::CaseStatement;
   }
-  syntax::Leaf *caseKeyword();
-  syntax::Expression *value();
-  syntax::Statement *body();
+  Leaf *caseKeyword();
+  Expression *value();
+  Statement *body();
 };
 
 /// default: <body>
@@ -541,8 +541,8 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::DefaultStatement;
   }
-  syntax::Leaf *defaultKeyword();
-  syntax::Statement *body();
+  Leaf *defaultKeyword();
+  Statement *body();
 };
 
 /// if (cond) <then-statement> else <else-statement>
@@ -553,10 +553,10 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::IfStatement;
   }
-  syntax::Leaf *ifKeyword();
-  syntax::Statement *thenStatement();
-  syntax::Leaf *elseKeyword();
-  syntax::Statement *elseStatement();
+  Leaf *ifKeyword();
+  Statement *thenStatement();
+  Leaf *elseKeyword();
+  Statement *elseStatement();
 };
 
 /// for (<init>; <cond>; <increment>) <body>
@@ -566,8 +566,8 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::ForStatement;
   }
-  syntax::Leaf *forKeyword();
-  syntax::Statement *body();
+  Leaf *forKeyword();
+  Statement *body();
 };
 
 /// while (<cond>) <body>
@@ -577,8 +577,8 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::WhileStatement;
   }
-  syntax::Leaf *whileKeyword();
-  syntax::Statement *body();
+  Leaf *whileKeyword();
+  Statement *body();
 };
 
 /// continue;
@@ -588,7 +588,7 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::ContinueStatement;
   }
-  syntax::Leaf *continueKeyword();
+  Leaf *continueKeyword();
 };
 
 /// break;
@@ -598,7 +598,7 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::BreakStatement;
   }
-  syntax::Leaf *breakKeyword();
+  Leaf *breakKeyword();
 };
 
 /// return <expr>;
@@ -609,8 +609,8 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::ReturnStatement;
   }
-  syntax::Leaf *returnKeyword();
-  syntax::Expression *value();
+  Leaf *returnKeyword();
+  Expression *value();
 };
 
 /// for (<decl> : <init>) <body>
@@ -620,8 +620,8 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::RangeBasedForStatement;
   }
-  syntax::Leaf *forKeyword();
-  syntax::Statement *body();
+  Leaf *forKeyword();
+  Statement *body();
 };
 
 /// Expression in a statement position, e.g. functions calls inside compound
@@ -632,7 +632,7 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::ExpressionStatement;
   }
-  syntax::Expression *expression();
+  Expression *expression();
 };
 
 /// { statement1; statement2; … }
@@ -642,10 +642,10 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::CompoundStatement;
   }
-  syntax::Leaf *lbrace();
+  Leaf *lbrace();
   /// FIXME: use custom iterator instead of 'vector'.
-  std::vector<syntax::Statement *> statements();
-  syntax::Leaf *rbrace();
+  std::vector<Statement *> statements();
+  Leaf *rbrace();
 };
 
 /// A declaration that can appear at the top-level. Note that this does *not*
@@ -687,8 +687,8 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::StaticAssertDeclaration;
   }
-  syntax::Expression *condition();
-  syntax::Expression *message();
+  Expression *condition();
+  Expression *message();
 };
 
 /// extern <string-literal> declaration
@@ -712,7 +712,7 @@
     return N->kind() == NodeKind::SimpleDeclaration;
   }
   /// FIXME: use custom iterator instead of 'vector'.
-  std::vector<syntax::SimpleDeclarator *> declarators();
+  std::vector<SimpleDeclarator *> declarators();
 };
 
 /// template <template-parameters> <declaration>
@@ -722,8 +722,8 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::TemplateDeclaration;
   }
-  syntax::Leaf *templateKeyword();
-  syntax::Declaration *declaration();
+  Leaf *templateKeyword();
+  Declaration *declaration();
 };
 
 /// template <declaration>
@@ -738,9 +738,9 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::ExplicitTemplateInstantiation;
   }
-  syntax::Leaf *templateKeyword();
-  syntax::Leaf *externKeyword();
-  syntax::Declaration *declaration();
+  Leaf *templateKeyword();
+  Leaf *externKeyword();
+  Declaration *declaration();
 };
 
 /// namespace <name> { <decls> }
@@ -830,8 +830,8 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::ParenDeclarator;
   }
-  syntax::Leaf *lparen();
-  syntax::Leaf *rparen();
+  Leaf *lparen();
+  Leaf *rparen();
 };
 
 /// Array size specified inside a declarator.
@@ -845,9 +845,9 @@
     return N->kind() == NodeKind::ArraySubscript;
   }
   // TODO: add an accessor for the "static" keyword.
-  syntax::Leaf *lbracket();
-  syntax::Expression *sizeExpression();
-  syntax::Leaf *rbracket();
+  Leaf *lbracket();
+  Expression *sizeExpression();
+  Leaf *rbracket();
 };
 
 /// Trailing return type after the parameter list, including the arrow token.
@@ -859,8 +859,8 @@
     return N->kind() == NodeKind::TrailingReturnType;
   }
   // TODO: add accessors for specifiers.
-  syntax::Leaf *arrowToken();
-  syntax::SimpleDeclarator *declarator();
+  Leaf *arrowToken();
+  SimpleDeclarator *declarator();
 };
 
 /// Parameter list for a function type and a trailing return type, if the
@@ -880,11 +880,11 @@
   static bool classof(const Node *N) {
     return N->kind() == NodeKind::ParametersAndQualifiers;
   }
-  syntax::Leaf *lparen();
+  Leaf *lparen();
   /// FIXME: use custom iterator instead of 'vector'.
-  std::vector<syntax::SimpleDeclaration *> parameters();
-  syntax::Leaf *rparen();
-  syntax::TrailingReturnType *trailingReturn();
+  std::vector<SimpleDeclaration *> parameters();
+  Leaf *rparen();
+  TrailingReturnType *trailingReturn();
 };
 
 /// Member pointer inside a declarator
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to