[PATCH] D93436: [clangd] Print .clang-tidy configuration parsing errors using [ev]?log.
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 17 18:07:53 PST 2020
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93436.312660.patch
Type: text/x-patch
Size: 1835 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201218/c8e0db42/attachment.bin>
More information about the cfe-commits
mailing list