[PATCH] D85295: [SyntaxTree] Implement the List construct.
Dmitri Gribenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 10 01:17:29 PDT 2020
gribozavr2 accepted this revision.
gribozavr2 added inline comments.
This revision is now accepted and ready to land.
================
Comment at: clang/include/clang/Tooling/Syntax/Tree.h:194
+/// A Tree that represents a syntactic list of elements.
+///
----------------
"""
A list of elements separated or terminated by a fixed token.
This type models the following grammar construct:
delimited-list(element, delimiter, termination, canBeEmpty)
"""
================
Comment at: clang/include/clang/Tooling/Syntax/Tree.h:249
+
+ /// Return whether *under valid code* the list can be empty.
+ ///
----------------
"Whether this list can be empty in syntactically and semantically correct code.
This list may be empty when the source code has errors even if canBeEmpty() returns true."
================
Comment at: clang/lib/Tooling/Syntax/Tree.cpp:367
+clang::tok::TokenKind syntax::List::getDelimiterTokenKind() {
+ llvm_unreachable("A list can have only elements and delimiters as children.");
+}
----------------
I think a better error message would say that there are no subclasses of List, so this method can't be called.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85295/new/
https://reviews.llvm.org/D85295
More information about the cfe-commits
mailing list