This revision was automatically updated to reflect the committed changes.
Closed by commit rG2808f597f872: [clangd] Print .clang-tidy configuration 
parsing errors using [ev]?log. (authored by njames93).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93436

Files:
  clang-tools-extra/clangd/TidyProvider.cpp


Index: clang-tools-extra/clangd/TidyProvider.cpp
===================================================================
--- clang-tools-extra/clangd/TidyProvider.cpp
+++ clang-tools-extra/clangd/TidyProvider.cpp
@@ -19,6 +19,7 @@
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Process.h"
+#include "llvm/Support/SourceMgr.h"
 #include "llvm/Support/VirtualFileSystem.h"
 #include <memory>
 
@@ -44,8 +45,25 @@
         [this](llvm::Optional<llvm::StringRef> Data) {
           Value.reset();
           if (Data && !Data->empty()) {
-            if (auto Parsed = tidy::parseConfiguration(
-                    llvm::MemoryBufferRef(*Data, path())))
+            tidy::DiagCallback Diagnostics = [](const llvm::SMDiagnostic &D) {
+              switch (D.getKind()) {
+              case llvm::SourceMgr::DK_Error:
+                elog("tidy-config error at {0}:{1}:{2}: {3}", D.getFilename(),
+                     D.getLineNo(), D.getColumnNo(), D.getMessage());
+                break;
+              case llvm::SourceMgr::DK_Warning:
+                log("tidy-config warning at {0}:{1}:{2}: {3}", D.getFilename(),
+                    D.getLineNo(), D.getColumnNo(), D.getMessage());
+                break;
+              case llvm::SourceMgr::DK_Note:
+              case llvm::SourceMgr::DK_Remark:
+                vlog("tidy-config note at {0}:{1}:{2}: {3}", D.getFilename(),
+                     D.getLineNo(), D.getColumnNo(), D.getMessage());
+                break;
+              }
+            };
+            if (auto Parsed = tidy::parseConfigurationWithDiags(
+                    llvm::MemoryBufferRef(*Data, path()), Diagnostics))
               Value = std::make_shared<const tidy::ClangTidyOptions>(
                   std::move(*Parsed));
             else


Index: clang-tools-extra/clangd/TidyProvider.cpp
===================================================================
--- clang-tools-extra/clangd/TidyProvider.cpp
+++ clang-tools-extra/clangd/TidyProvider.cpp
@@ -19,6 +19,7 @@
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Process.h"
+#include "llvm/Support/SourceMgr.h"
 #include "llvm/Support/VirtualFileSystem.h"
 #include <memory>
 
@@ -44,8 +45,25 @@
         [this](llvm::Optional<llvm::StringRef> Data) {
           Value.reset();
           if (Data && !Data->empty()) {
-            if (auto Parsed = tidy::parseConfiguration(
-                    llvm::MemoryBufferRef(*Data, path())))
+            tidy::DiagCallback Diagnostics = [](const llvm::SMDiagnostic &D) {
+              switch (D.getKind()) {
+              case llvm::SourceMgr::DK_Error:
+                elog("tidy-config error at {0}:{1}:{2}: {3}", D.getFilename(),
+                     D.getLineNo(), D.getColumnNo(), D.getMessage());
+                break;
+              case llvm::SourceMgr::DK_Warning:
+                log("tidy-config warning at {0}:{1}:{2}: {3}", D.getFilename(),
+                    D.getLineNo(), D.getColumnNo(), D.getMessage());
+                break;
+              case llvm::SourceMgr::DK_Note:
+              case llvm::SourceMgr::DK_Remark:
+                vlog("tidy-config note at {0}:{1}:{2}: {3}", D.getFilename(),
+                     D.getLineNo(), D.getColumnNo(), D.getMessage());
+                break;
+              }
+            };
+            if (auto Parsed = tidy::parseConfigurationWithDiags(
+                    llvm::MemoryBufferRef(*Data, path()), Diagnostics))
               Value = std::make_shared<const tidy::ClangTidyOptions>(
                   std::move(*Parsed));
             else
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to