[PATCH] D87599: [SyntaxTree] Provide `List::classof`
Eduardo Caldas via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 14 01:22:36 PDT 2020
eduucaldas created this revision.
eduucaldas added a reviewer: gribozavr2.
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/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.291506.patch
Type: text/x-patch
Size: 1068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200914/5a0c15f5/attachment-0001.bin>
More information about the cfe-commits
mailing list