summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/Diagnostics.cpp
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2018-08-14 22:21:40 +0000
committerAlex Lorenz <arphaman@gmail.com>2018-08-14 22:21:40 +0000
commit37146431d23a926b560b449acd847bda8d7a7bb3 (patch)
tree866d22b4f9ec39fcb991bd52ecac948ec4053294 /clang-tools-extra/clangd/Diagnostics.cpp
parent3738dba69b5fea4fd066f0209f9cf38d2a3e62dc (diff)
downloadbcm5719-llvm-37146431d23a926b560b449acd847bda8d7a7bb3.tar.gz
bcm5719-llvm-37146431d23a926b560b449acd847bda8d7a7bb3.zip
[clangd] add an extension field to LSP to transfer the diagnostic's category
This patch adds a 'category' extension field to the LSP diagnostic that's sent by Clangd. This extension is always on by default. Differential Revision: https://reviews.llvm.org/D50571 llvm-svn: 339738
Diffstat (limited to 'clang-tools-extra/clangd/Diagnostics.cpp')
-rw-r--r--clang-tools-extra/clangd/Diagnostics.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/Diagnostics.cpp b/clang-tools-extra/clangd/Diagnostics.cpp
index c053bd22266..893854d1d9f 100644
--- a/clang-tools-extra/clangd/Diagnostics.cpp
+++ b/clang-tools-extra/clangd/Diagnostics.cpp
@@ -226,6 +226,7 @@ void toLSPDiags(
clangd::Diagnostic Res;
Res.range = D.Range;
Res.severity = getSeverity(D.Severity);
+ Res.category = D.Category;
return Res;
};
@@ -292,6 +293,9 @@ void StoreDiags::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
D.InsideMainFile = InsideMainFile;
D.File = Info.getSourceManager().getFilename(Info.getLocation());
D.Severity = DiagLevel;
+ D.Category = DiagnosticIDs::getCategoryNameFromID(
+ DiagnosticIDs::getCategoryNumberForDiag(Info.getID()))
+ .str();
return D;
};
OpenPOWER on IntegriCloud