diff options
| author | Sam McCall <sam.mccall@gmail.com> | 2019-04-17 20:12:03 +0000 | 
|---|---|---|
| committer | Sam McCall <sam.mccall@gmail.com> | 2019-04-17 20:12:03 +0000 | 
| commit | d98170c324b193ebe44cbedaa53748fc3beea91d (patch) | |
| tree | eb0d2f62aa96850cac713c999d90973119806290 /clang-tools-extra/unittests/clangd/DiagnosticsTests.cpp | |
| parent | 09ef420d6254f945a50da07a0a71c2c7a93b6b12 (diff) | |
| download | bcm5719-llvm-d98170c324b193ebe44cbedaa53748fc3beea91d.tar.gz bcm5719-llvm-d98170c324b193ebe44cbedaa53748fc3beea91d.zip | |
[clangd] Use shorter, more recognizable codes for diagnostics.
Summary:
 - for warnings, use the flag the warning is controlled by (-Wfoo)
 - for errors, keep using the internal name (there's nothing better) but
   drop the err_ prefix
This comes at the cost of uniformity, it's no longer totally obvious
exactly what the code field contains. But the -Wname flags are so much
more useful to end-users than the internal warn_foo that this seems worth it.
Reviewers: kadircet
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60822
llvm-svn: 358611
Diffstat (limited to 'clang-tools-extra/unittests/clangd/DiagnosticsTests.cpp')
| -rw-r--r-- | clang-tools-extra/unittests/clangd/DiagnosticsTests.cpp | 8 | 
1 files changed, 4 insertions, 4 deletions
| diff --git a/clang-tools-extra/unittests/clangd/DiagnosticsTests.cpp b/clang-tools-extra/unittests/clangd/DiagnosticsTests.cpp index f406ec43bd5..3228a32bc1b 100644 --- a/clang-tools-extra/unittests/clangd/DiagnosticsTests.cpp +++ b/clang-tools-extra/unittests/clangd/DiagnosticsTests.cpp @@ -107,7 +107,7 @@ o]]();            AllOf(Diag(Test.range("typo"),                       "use of undeclared identifier 'goo'; did you mean 'foo'?"),                  DiagSource(Diag::Clang), -                DiagName("err_undeclared_var_use_suggest"), +                DiagName("undeclared_var_use_suggest"),                  WithFix(                      Fix(Test.range("typo"), "foo", "change 'go\\ o' to 'foo'")),                  // This is a pretty normal range. @@ -152,7 +152,7 @@ TEST(DiagnosticsTest, DiagnosticPreamble) {    EXPECT_THAT(TU.build().getDiagnostics(),                ElementsAre(testing::AllOf(                    Diag(Test.range(), "'not-found.h' file not found"), -                  DiagSource(Diag::Clang), DiagName("err_pp_file_not_found")))); +                  DiagSource(Diag::Clang), DiagName("pp_file_not_found"))));  }  TEST(DiagnosticsTest, ClangTidy) { @@ -252,7 +252,7 @@ TEST(DiagnosticsTest, NoFixItInMacro) {  TEST(DiagnosticsTest, ToLSP) {    clangd::Diag D;    D.ID = clang::diag::err_enum_class_reference; -  D.Name = "err_enum_class_reference"; +  D.Name = "enum_class_reference";    D.Source = clangd::Diag::Clang;    D.Message = "something terrible happened";    D.Range = {pos(1, 2), pos(3, 4)}; @@ -322,7 +322,7 @@ main.cpp:2:3: error: something terrible happened)");        LSPDiags,        ElementsAre(Pair(EqualToLSPDiag(MainLSP), ElementsAre(EqualToFix(F))),                    Pair(EqualToLSPDiag(NoteInMainLSP), IsEmpty()))); -  EXPECT_EQ(LSPDiags[0].first.code, "err_enum_class_reference"); +  EXPECT_EQ(LSPDiags[0].first.code, "enum_class_reference");    EXPECT_EQ(LSPDiags[0].first.source, "clang");    EXPECT_EQ(LSPDiags[1].first.code, "");    EXPECT_EQ(LSPDiags[1].first.source, ""); | 

