njames93 updated this revision to Diff 449046.
njames93 added a comment.

Revert to first version, just so we can sort out the 15.X branch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128379

Files:
  clang-tools-extra/clangd/Diagnostics.cpp
  clang-tools-extra/clangd/test/diagnostics-tidy.test


Index: clang-tools-extra/clangd/test/diagnostics-tidy.test
===================================================================
--- clang-tools-extra/clangd/test/diagnostics-tidy.test
+++ clang-tools-extra/clangd/test/diagnostics-tidy.test
@@ -9,7 +9,7 @@
 # CHECK-NEXT:      {
 # CHECK-NEXT:        "code": "bugprone-sizeof-expression",
 # CHECK-NEXT:        "codeDescription": {
-# CHECK-NEXT:          "href": 
"https://clang.llvm.org/extra/clang-tidy/checks/bugprone-sizeof-expression.html";
+# CHECK-NEXT:          "href": 
"https://clang.llvm.org/extra/clang-tidy/checks/bugprone/sizeof-expression.html";
 # CHECK-NEXT:        },
 # CHECK-NEXT:        "message": "Suspicious usage of 'sizeof(K)'; did you mean 
'K'?",
 # CHECK-NEXT:        "range": {
Index: clang-tools-extra/clangd/Diagnostics.cpp
===================================================================
--- clang-tools-extra/clangd/Diagnostics.cpp
+++ clang-tools-extra/clangd/Diagnostics.cpp
@@ -918,9 +918,19 @@
     // information to be worth linking.
     // https://clang.llvm.org/docs/DiagnosticsReference.html
     break;
-  case Diag::ClangTidy:
-    return {("https://clang.llvm.org/extra/clang-tidy/checks/"; + Name + 
".html")
-                .str()};
+  case Diag::ClangTidy: {
+    StringRef Module, Check;
+    // This won't correctly get the module for clang-analyzer checks, but as we
+    // don't link in the analyzer that shouldn't be an issue.
+    // This would also need updating if anyone decides to create a module with 
a
+    // '-' in the name.
+    std::tie(Module, Check) = Name.split('-');
+    if (Module.empty() || Check.empty())
+      return llvm::None;
+    return ("https://clang.llvm.org/extra/clang-tidy/checks/"; + Module + "/" +
+            Check + ".html")
+        .str();
+  }
   case Diag::Clangd:
     if (Name == "unused-includes")
       return {"https://clangd.llvm.org/guides/include-cleaner"};


Index: clang-tools-extra/clangd/test/diagnostics-tidy.test
===================================================================
--- clang-tools-extra/clangd/test/diagnostics-tidy.test
+++ clang-tools-extra/clangd/test/diagnostics-tidy.test
@@ -9,7 +9,7 @@
 # CHECK-NEXT:      {
 # CHECK-NEXT:        "code": "bugprone-sizeof-expression",
 # CHECK-NEXT:        "codeDescription": {
-# CHECK-NEXT:          "href": "https://clang.llvm.org/extra/clang-tidy/checks/bugprone-sizeof-expression.html";
+# CHECK-NEXT:          "href": "https://clang.llvm.org/extra/clang-tidy/checks/bugprone/sizeof-expression.html";
 # CHECK-NEXT:        },
 # CHECK-NEXT:        "message": "Suspicious usage of 'sizeof(K)'; did you mean 'K'?",
 # CHECK-NEXT:        "range": {
Index: clang-tools-extra/clangd/Diagnostics.cpp
===================================================================
--- clang-tools-extra/clangd/Diagnostics.cpp
+++ clang-tools-extra/clangd/Diagnostics.cpp
@@ -918,9 +918,19 @@
     // information to be worth linking.
     // https://clang.llvm.org/docs/DiagnosticsReference.html
     break;
-  case Diag::ClangTidy:
-    return {("https://clang.llvm.org/extra/clang-tidy/checks/"; + Name + ".html")
-                .str()};
+  case Diag::ClangTidy: {
+    StringRef Module, Check;
+    // This won't correctly get the module for clang-analyzer checks, but as we
+    // don't link in the analyzer that shouldn't be an issue.
+    // This would also need updating if anyone decides to create a module with a
+    // '-' in the name.
+    std::tie(Module, Check) = Name.split('-');
+    if (Module.empty() || Check.empty())
+      return llvm::None;
+    return ("https://clang.llvm.org/extra/clang-tidy/checks/"; + Module + "/" +
+            Check + ".html")
+        .str();
+  }
   case Diag::Clangd:
     if (Name == "unused-includes")
       return {"https://clangd.llvm.org/guides/include-cleaner"};
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to