[PATCH] D64573: [Syntax] Allow to mutate syntax trees
Ilya Biryukov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 18 03:26:20 PST 2019
ilya-biryukov marked 3 inline comments as done.
ilya-biryukov added inline comments.
================
Comment at: clang/unittests/Tooling/Syntax/TreeTest.cpp:528
+void test() {
+ HALF_IF HALF_IF_2 else {}
+})cpp",
----------------
ilya-biryukov wrote:
> gribozavr2 wrote:
> > Could you also do something like:
> >
> > ```
> > #define OPEN {
> > #define CLOSE }
> >
> > void test1() {
> > OPEN
> > 1;
> > CLOSE
> > }
> > void test1() {
> > OPEN
> > 1;
> > }
> > }
> > ```
> Funnily enough, this causes an assertion failure, because binary-searching with `isBeforeInTranslationUnit` finds `{` expanded from `OPEN` instead of `1` when building a syntax tree.
>
> I'll make use of a hash table for searching tokens by location and add the test in the follow-up patch.
c1bbefef9d36e84e469513374ef404b9e354b262 adds the corresponding test.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64573/new/
https://reviews.llvm.org/D64573
More information about the cfe-commits
mailing list