summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2017-01-03 14:36:13 +0000
committerAlexander Kornienko <alexfh@google.com>2017-01-03 14:36:13 +0000
commit563de799e3c5573da5eed7427a29d8cc05019eda (patch)
tree27c9202e548af9b967b08d00e62c4fd33c10ecfb /clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
parent9bab1991469c1c04f832a80d52e3f5065914cc39 (diff)
downloadbcm5719-llvm-563de799e3c5573da5eed7427a29d8cc05019eda.tar.gz
bcm5719-llvm-563de799e3c5573da5eed7427a29d8cc05019eda.zip
[clang-tidy] Add check name to YAML export (clang-tools-extra part)
Add a field indicating the associated check for every replacement to the YAML report generated with the '-export-fixes' option. Update clang-apply-replacements to handle the new format. Patch by Alpha Abdoulaye! Differential revision: https://reviews.llvm.org/D26137 llvm-svn: 290893
Diffstat (limited to 'clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h')
-rw-r--r--clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h42
1 files changed, 5 insertions, 37 deletions
diff --git a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
index 374331c5ef6..eb831a180fc 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
+++ b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
@@ -13,6 +13,7 @@
#include "ClangTidyOptions.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/SourceManager.h"
+#include "clang/Tooling/Core/Diagnostic.h"
#include "clang/Tooling/Refactoring.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringMap.h"
@@ -32,18 +33,6 @@ class CompilationDatabase;
namespace tidy {
-/// \brief A message from a clang-tidy check.
-///
-/// Note that this is independent of a \c SourceManager.
-struct ClangTidyMessage {
- ClangTidyMessage(StringRef Message = "");
- ClangTidyMessage(StringRef Message, const SourceManager &Sources,
- SourceLocation Loc);
- std::string Message;
- std::string FilePath;
- unsigned FileOffset;
-};
-
/// \brief A detected error complete with information to display diagnostic and
/// automatic fix.
///
@@ -51,31 +40,10 @@ struct ClangTidyMessage {
/// dependency on a SourceManager.
///
/// FIXME: Make Diagnostics flexible enough to support this directly.
-struct ClangTidyError {
- enum Level {
- Warning = DiagnosticsEngine::Warning,
- Error = DiagnosticsEngine::Error
- };
-
- ClangTidyError(StringRef CheckName, Level DiagLevel, bool IsWarningAsError,
- StringRef BuildDirectory);
-
- std::string CheckName;
- ClangTidyMessage Message;
- // Fixes grouped by file path.
- llvm::StringMap<tooling::Replacements> Fix;
- SmallVector<ClangTidyMessage, 1> Notes;
-
- // A build directory of the diagnostic source file.
- //
- // It's an absolute path which is `directory` field of the source file in
- // compilation database. If users don't specify the compilation database
- // directory, it is the current directory where clang-tidy runs.
- //
- // Note: it is empty in unittest.
- std::string BuildDirectory;
-
- Level DiagLevel;
+struct ClangTidyError : tooling::Diagnostic {
+ ClangTidyError(StringRef CheckName, Level DiagLevel, StringRef BuildDirectory,
+ bool IsWarningAsError);
+
bool IsWarningAsError;
};
OpenPOWER on IntegriCloud