[PATCH] D88828: [clangd] Verify the diagnostic code in include-fixer diagnostic tests, NFC.

2020-10-06 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG48a82c42457b: [clangd] Verify the diagnostic code in 
include-fixer diagnostic tests, NFC. (authored by hokein).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88828

Files:
  clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp


Index: clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
===
--- clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
+++ clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
@@ -720,13 +720,16 @@
   UnorderedElementsAre(
   AllOf(Diag(Test.range("nested"),
  "incomplete type 'ns::X' named in nested name specifier"),
+DiagName("incomplete_nested_name_spec"),
 WithFix(Fix(Test.range("insert"), "#include \"x.h\"\n",
 "Add include \"x.h\" for symbol ns::X"))),
   AllOf(Diag(Test.range("base"), "base class has incomplete type"),
+DiagName("incomplete_base_class"),
 WithFix(Fix(Test.range("insert"), "#include \"x.h\"\n",
 "Add include \"x.h\" for symbol ns::X"))),
   AllOf(Diag(Test.range("access"),
  "member access into incomplete type 'ns::X'"),
+DiagName("incomplete_member_access"),
 WithFix(Fix(Test.range("insert"), "#include \"x.h\"\n",
 "Add include \"x.h\" for symbol ns::X");
 }
@@ -789,19 +792,23 @@
   TU.build().getDiagnostics(),
   UnorderedElementsAre(
   AllOf(Diag(Test.range("unqualified1"), "unknown type name 'X'"),
+DiagName("unknown_typename"),
 WithFix(Fix(Test.range("insert"), "#include \"x.h\"\n",
 "Add include \"x.h\" for symbol ns::X"))),
   Diag(Test.range("unqualified2"), "use of undeclared identifier 'X'"),
   AllOf(Diag(Test.range("qualified1"),
  "no type named 'X' in namespace 'ns'"),
+DiagName("typename_nested_not_found"),
 WithFix(Fix(Test.range("insert"), "#include \"x.h\"\n",
 "Add include \"x.h\" for symbol ns::X"))),
   AllOf(Diag(Test.range("qualified2"),
  "no member named 'X' in namespace 'ns'"),
+DiagName("no_member"),
 WithFix(Fix(Test.range("insert"), "#include \"x.h\"\n",
 "Add include \"x.h\" for symbol ns::X"))),
   AllOf(Diag(Test.range("global"),
  "no type named 'Global' in the global namespace"),
+DiagName("typename_nested_not_found"),
 WithFix(Fix(Test.range("insert"), "#include \"global.h\"\n",
 "Add include \"global.h\" for symbol Global");
 }
@@ -825,6 +832,7 @@
   EXPECT_THAT(TU.build().getDiagnostics(),
   UnorderedElementsAre(AllOf(
   Diag(Test.range("unqualified"), "unknown type name 'X'"),
+  DiagName("unknown_typename"),
   WithFix(Fix(Test.range("insert"), "#include \"a.h\"\n",
   "Add include \"a.h\" for symbol na::X"),
   Fix(Test.range("insert"), "#include \"b.h\"\n",
@@ -905,6 +913,7 @@
   TU.build().getDiagnostics(),
   UnorderedElementsAre(AllOf(
   Diag(Test.range(), "no member named 'scope' in namespace 'ns'"),
+  DiagName("no_member"),
   WithFix(Fix(Test.range("insert"), "#include \"x.h\"\n",
   "Add include \"x.h\" for symbol ns::scope::X_Y");
 }
@@ -934,22 +943,26 @@
   AllOf(
   Diag(Test.range("q1"), "use of undeclared identifier 'clangd'; "
  "did you mean 'clang'?"),
+  DiagName("undeclared_var_use_suggest"),
   WithFix(_, // change clangd to clang
   Fix(Test.range("insert"), "#include \"x.h\"\n",
   "Add include \"x.h\" for symbol clang::clangd::X"))),
   AllOf(
   Diag(Test.range("x"), "no type named 'X' in namespace 'clang'"),
+  DiagName("typename_nested_not_found"),
   WithFix(Fix(Test.range("insert"), "#include \"x.h\"\n",
   "Add include \"x.h\" for symbol clang::clangd::X"))),
   AllOf(
   Diag(Test.range("q2"), "use of undeclared identifier 'clangd'; "
  "did you mean 'clang'?"),
+  DiagName("undeclared_var_use_suggest"),
   WithFix(
-  _, // change clangd to clangd
+  _, // change clangd to clang
   Fix(Test.range("insert"), "#include \"y.h\"\n",
   "Add 

[PATCH] D88828: [clangd] Verify the diagnostic code in include-fixer diagnostic tests, NFC.

2020-10-06 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

In D88828#2311679 , @kadircet wrote:

> LGTM, but can you add some description about why you've decided to do it now 
> :D

yeah, this comes up when I read the code, I think it is easier to spot which 
diagnostics in the include-fixer list are tested, (e.g. `err_incomplete_type` 
is not tested yet).

And my next step to see whether there are other missing diagnostics that could 
be fixed by inserting a header.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88828

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D88828: [clangd] Verify the diagnostic code in include-fixer diagnostic tests, NFC.

2020-10-05 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

LGTM, but can you add some description about why you've decided to do it now :D


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88828

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D88828: [clangd] Verify the diagnostic code in include-fixer diagnostic tests, NFC.

2020-10-05 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision.
hokein added a reviewer: kadircet.
Herald added subscribers: usaxena95, arphaman.
Herald added a project: clang.
hokein requested review of this revision.
Herald added subscribers: MaskRay, ilya-biryukov.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88828

Files:
  clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp


Index: clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
===
--- clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
+++ clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
@@ -720,13 +720,16 @@
   UnorderedElementsAre(
   AllOf(Diag(Test.range("nested"),
  "incomplete type 'ns::X' named in nested name specifier"),
+DiagName("incomplete_nested_name_spec"),
 WithFix(Fix(Test.range("insert"), "#include \"x.h\"\n",
 "Add include \"x.h\" for symbol ns::X"))),
   AllOf(Diag(Test.range("base"), "base class has incomplete type"),
+DiagName("incomplete_base_class"),
 WithFix(Fix(Test.range("insert"), "#include \"x.h\"\n",
 "Add include \"x.h\" for symbol ns::X"))),
   AllOf(Diag(Test.range("access"),
  "member access into incomplete type 'ns::X'"),
+DiagName("incomplete_member_access"),
 WithFix(Fix(Test.range("insert"), "#include \"x.h\"\n",
 "Add include \"x.h\" for symbol ns::X");
 }
@@ -789,19 +792,23 @@
   TU.build().getDiagnostics(),
   UnorderedElementsAre(
   AllOf(Diag(Test.range("unqualified1"), "unknown type name 'X'"),
+DiagName("unknown_typename"),
 WithFix(Fix(Test.range("insert"), "#include \"x.h\"\n",
 "Add include \"x.h\" for symbol ns::X"))),
   Diag(Test.range("unqualified2"), "use of undeclared identifier 'X'"),
   AllOf(Diag(Test.range("qualified1"),
  "no type named 'X' in namespace 'ns'"),
+DiagName("typename_nested_not_found"),
 WithFix(Fix(Test.range("insert"), "#include \"x.h\"\n",
 "Add include \"x.h\" for symbol ns::X"))),
   AllOf(Diag(Test.range("qualified2"),
  "no member named 'X' in namespace 'ns'"),
+DiagName("no_member"),
 WithFix(Fix(Test.range("insert"), "#include \"x.h\"\n",
 "Add include \"x.h\" for symbol ns::X"))),
   AllOf(Diag(Test.range("global"),
  "no type named 'Global' in the global namespace"),
+DiagName("typename_nested_not_found"),
 WithFix(Fix(Test.range("insert"), "#include \"global.h\"\n",
 "Add include \"global.h\" for symbol Global");
 }
@@ -825,6 +832,7 @@
   EXPECT_THAT(TU.build().getDiagnostics(),
   UnorderedElementsAre(AllOf(
   Diag(Test.range("unqualified"), "unknown type name 'X'"),
+  DiagName("unknown_typename"),
   WithFix(Fix(Test.range("insert"), "#include \"a.h\"\n",
   "Add include \"a.h\" for symbol na::X"),
   Fix(Test.range("insert"), "#include \"b.h\"\n",
@@ -905,6 +913,7 @@
   TU.build().getDiagnostics(),
   UnorderedElementsAre(AllOf(
   Diag(Test.range(), "no member named 'scope' in namespace 'ns'"),
+  DiagName("no_member"),
   WithFix(Fix(Test.range("insert"), "#include \"x.h\"\n",
   "Add include \"x.h\" for symbol ns::scope::X_Y");
 }
@@ -934,22 +943,26 @@
   AllOf(
   Diag(Test.range("q1"), "use of undeclared identifier 'clangd'; "
  "did you mean 'clang'?"),
+  DiagName("undeclared_var_use_suggest"),
   WithFix(_, // change clangd to clang
   Fix(Test.range("insert"), "#include \"x.h\"\n",
   "Add include \"x.h\" for symbol clang::clangd::X"))),
   AllOf(
   Diag(Test.range("x"), "no type named 'X' in namespace 'clang'"),
+  DiagName("typename_nested_not_found"),
   WithFix(Fix(Test.range("insert"), "#include \"x.h\"\n",
   "Add include \"x.h\" for symbol clang::clangd::X"))),
   AllOf(
   Diag(Test.range("q2"), "use of undeclared identifier 'clangd'; "
  "did you mean 'clang'?"),
+  DiagName("undeclared_var_use_suggest"),
   WithFix(
-  _, // change clangd to clangd
+  _, // change clangd to clang
   Fix(Test.range("insert"), "#include \"y.h\"\n",
   "Add include \"y.h\" for symbol