[PATCH] D52889: [clangd] Add new test to cover no_member diag.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 4 08:58:22 PDT 2018


kadircet created this revision.
Herald added subscribers: cfe-commits, arphaman, jkorous, MaskRay, ioeric, ilya-biryukov.
kadircet edited the summary of this revision.
kadircet added reviewers: sammccall, ilya-biryukov.
kadircet added a dependency: D52890: Also report range for the name token on no_member error..

Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52889

Files:
  unittests/clangd/ClangdUnitTests.cpp


Index: unittests/clangd/ClangdUnitTests.cpp
===================================================================
--- unittests/clangd/ClangdUnitTests.cpp
+++ unittests/clangd/ClangdUnitTests.cpp
@@ -82,6 +82,8 @@
       foo()$semicolon[[]]//with comments
       $unk[[unknown]]();
       double bar = $type[["foo"]];
+      struct Foo { int x; }; Foo a;
+      a.$nomember[[y]];
     }
   )cpp");
   EXPECT_THAT(
@@ -103,7 +105,8 @@
           Diag(Test.range("unk"), "use of undeclared identifier 'unknown'"),
           Diag(Test.range("type"),
                "cannot initialize a variable of type 'double' with an lvalue "
-               "of type 'const char [4]'")));
+               "of type 'const char [4]'"),
+          Diag(Test.range("nomember"), "no member named 'y' in 'Foo'")));
 }
 
 TEST(DiagnosticsTest, FlagsMatter) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52889.168305.patch
Type: text/x-patch
Size: 836 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181004/4557815a/attachment.bin>


More information about the cfe-commits mailing list