[PATCH] D64562: [clangd] Fixed toHalfOpenFileRange

Shaurya Gupta via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 11 16:07:50 PDT 2019


SureYeaah added inline comments.


================
Comment at: clang-tools-extra/clangd/unittests/SourceCodeTests.cpp:410
+// Test for functions toHalfOpenFileRange and getHalfOpenFileRange
+// FIXME: Need better testing support to be able to check more than just Decls.
+TEST(SourceCodeTests, HalfOpenFileRange) {
----------------
sammccall wrote:
> this is a function on ranges, so only using decls isn't a limitation per se.
> 
> Is there a type of range you're unable to test because you can't construct it as the source range of a decl? If so, please say which. If not I think we should just drop this comment.
e.g. Nested template instantiation (TemplateSpecializationTypeLoc)


================
Comment at: clang-tools-extra/clangd/unittests/SourceCodeTests.cpp:421
+      $c[[FOO(b, c)]]; 
+      $d[[FOO(BAR(BAR(b)), d)]];
+    }
----------------
sammccall wrote:
> some tests where the expansion range is a macro arg? e.g.
> ```
> #define ECHO(X) X
> ECHO($e[[ECHO(int) ECHO(e)]])
> ```
> 
> (if I'm understanding right)
In this case, the FileRange would be

```
ECHO(ECHO($e[[int) ECHO(e]]));
```

So the code works correctly. But it's not how we want it to behave right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64562





More information about the cfe-commits mailing list