[PATCH] D87599: [SyntaxTree] Provide `List::classof`

Eduardo Caldas via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 14 03:36:00 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG0f4cc64fd747: [SyntaxTree] Provide `List::classof` (authored by eduucaldas).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87599/new/

https://reviews.llvm.org/D87599

Files:
  clang/include/clang/Tooling/Syntax/Tree.h
  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
@@ -273,6 +273,17 @@
   return nullptr;
 }
 
+bool classof(const syntax::Node *N) {
+  switch (N->getKind()) {
+  case syntax::NodeKind::NestedNameSpecifier:
+  case syntax::NodeKind::CallArguments:
+  case syntax::NodeKind::ParameterDeclarationList:
+    return true;
+  default:
+    return false;
+  }
+}
+
 std::vector<syntax::List::ElementAndDelimiter<syntax::Node>>
 syntax::List::getElementsAsNodesAndDelimiters() {
   if (!getFirstChild())
Index: clang/include/clang/Tooling/Syntax/Tree.h
===================================================================
--- clang/include/clang/Tooling/Syntax/Tree.h
+++ clang/include/clang/Tooling/Syntax/Tree.h
@@ -213,6 +213,7 @@
   };
 
   using Tree::Tree;
+  static bool classof(const Node *N);
   /// Returns the elements and corresponding delimiters. Missing elements
   /// and delimiters are represented as null pointers.
   ///


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87599.291531.patch
Type: text/x-patch
Size: 1068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200914/13f7d806/attachment.bin>


More information about the cfe-commits mailing list