[PATCH] D51437: [clangd] Report position of opening paren in singature help

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 30 01:34:27 PDT 2018

sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.

Comment at: clangd/Protocol.h:832
+  /// Position of the opening paren of the argument list.
+  /// This is a clangd-specific extension, it is only available via C++ API and
As noted offline, I misread this as being *inside* the paren - could maybe be more explicit?
```Position of the start of the argument list, including opening paren. e.g.
foo("first arg", 
   ^argListStart ^cursor

Comment at: unittests/clangd/CodeCompleteTests.cpp:914
+TEST(SignatureHelpTest, OpeningParen) {
+  Annotations Code(R"cpp(
Hmm, I think this test would be easier to follow if tests 1-5 were written separately - it's hard to spot all the locations and how the code interacts.

As a bonus, no need to mess around with explicit positions and the failure message can just echo the test:

for (const char* Test : {
    int foo(int a, b, c);
    int main() { foo(foo$p^(foo(10, 10, 10), ^); }
}) {
  EXPECT_EQ(signatures(Test).argListStart, Annotations(Test).point("p")) << Test;

  rCTE Clang Tools Extra


More information about the cfe-commits mailing list