summaryrefslogtreecommitdiff
path: root/clang-tools-extra/clangd/ClangdUnit.cpp
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2018-02-12 12:48:51 +0000
committerIlya Biryukov <ibiryukov@google.com>2018-02-12 12:48:51 +0000
commit235d4ad051a408e71da26b3accf6e03a1a49fd79 (patch)
treec925fec5986b725e9ad16a355ea2a2a2e80c9fec /clang-tools-extra/clangd/ClangdUnit.cpp
parentc0d2a9580ca719d69bcae8b161e0236d18bdb881 (diff)
[clangd] Log all ignored diagnostics.
Summary: To aid debugging failures and crashes. Only part of ignored diagnostics was logged before, now we log all of them. Reviewers: ioeric, hokein, sammccall Reviewed By: hokein Subscribers: klimek, jkorous-apple, cfe-commits Differential Revision: https://reviews.llvm.org/D43123
Diffstat (limited to 'clang-tools-extra/clangd/ClangdUnit.cpp')
-rw-r--r--clang-tools-extra/clangd/ClangdUnit.cpp21
1 files changed, 4 insertions, 17 deletions
diff --git a/clang-tools-extra/clangd/ClangdUnit.cpp b/clang-tools-extra/clangd/ClangdUnit.cpp
index d7a8e89faab..9db97b466c9 100644
--- a/clang-tools-extra/clangd/ClangdUnit.cpp
+++ b/clang-tools-extra/clangd/ClangdUnit.cpp
@@ -26,7 +26,6 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/CrashRecoveryContext.h"
-#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
@@ -178,27 +177,15 @@ TextEdit toTextEdit(const FixItHint &FixIt, const SourceManager &M,
llvm::Optional<DiagWithFixIts> toClangdDiag(const clang::Diagnostic &D,
DiagnosticsEngine::Level Level,
const LangOptions &LangOpts) {
- SmallString<64> Message;
- D.FormatDiagnostic(Message);
-
if (!D.hasSourceManager() || !D.getLocation().isValid() ||
!D.getSourceManager().isInMainFile(D.getLocation())) {
-
- SmallString<64> Location;
- if (D.hasSourceManager() && D.getLocation().isValid()) {
- auto &SourceMgr = D.getSourceManager();
- auto Loc = SourceMgr.getFileLoc(D.getLocation());
- llvm::raw_svector_ostream OS(Location);
- Loc.print(OS, SourceMgr);
- } else {
- Location = "<no-loc>";
- }
-
- log(llvm::formatv("Ignored diagnostic outside main file. {0}: {1}",
- Location, Message));
+ IgnoreDiagnostics::log(Level, D);
return llvm::None;
}
+ SmallString<64> Message;
+ D.FormatDiagnostic(Message);
+
DiagWithFixIts Result;
Result.Diag.range = diagnosticRange(D, LangOpts);
Result.Diag.severity = getSeverity(Level);