c.s.tools.ide.analysis.modernize/src/com/sun/tools/ide/analysis/modernize/tools-clang-tools-extra.patch
1 Index: clang-tidy/ClangTidy.cpp
2 ===================================================================
3 --- clang-tidy/ClangTidy.cpp (revision 278390)
4 +++ clang-tidy/ClangTidy.cpp (working copy)
6 #include "clang/StaticAnalyzer/Frontend/AnalysisConsumer.h"
7 #include "clang/Tooling/Refactoring.h"
8 #include "clang/Tooling/ReplacementsYaml.h"
9 +#include "clang/Tooling/DiagnosticsYaml.h"
10 #include "clang/Tooling/Tooling.h"
11 #include "llvm/Support/Process.h"
12 #include "llvm/Support/Signals.h"
15 void exportReplacements(const std::vector<ClangTidyError> &Errors,
17 - tooling::TranslationUnitReplacements TUR;
18 - for (const ClangTidyError &Error : Errors)
19 - TUR.Replacements.insert(TUR.Replacements.end(), Error.Fix.begin(),
22 yaml::Output YAML(OS);
24 + TranslationUnitDiagnostics TUD;
25 + TUD.Diags.insert(TUD.Diags.end(), Errors.begin(), Errors.end());
30 Index: clang-tidy/ClangTidyDiagnosticConsumer.cpp
31 ===================================================================
32 --- clang-tidy/ClangTidyDiagnosticConsumer.cpp (revision 278390)
33 +++ clang-tidy/ClangTidyDiagnosticConsumer.cpp (working copy)
36 } // end anonymous namespace
38 -ClangTidyMessage::ClangTidyMessage(StringRef Message)
39 - : Message(Message), FileOffset(0) {}
41 -ClangTidyMessage::ClangTidyMessage(StringRef Message,
42 - const SourceManager &Sources,
44 - : Message(Message) {
45 - assert(Loc.isValid() && Loc.isFileID());
46 - FilePath = Sources.getFilename(Loc);
47 - FileOffset = Sources.getFileOffset(Loc);
50 -ClangTidyError::ClangTidyError(StringRef CheckName,
51 - ClangTidyError::Level DiagLevel,
52 - bool IsWarningAsError,
53 - StringRef BuildDirectory)
54 - : CheckName(CheckName), BuildDirectory(BuildDirectory), DiagLevel(DiagLevel),
55 - IsWarningAsError(IsWarningAsError) {}
57 // Returns true if GlobList starts with the negative indicator ('-'), removes it
59 static bool ConsumeNegativeIndicator(StringRef &GlobList) {
60 Index: clang-tidy/ClangTidyDiagnosticConsumer.h
61 ===================================================================
62 --- clang-tidy/ClangTidyDiagnosticConsumer.h (revision 278390)
63 +++ clang-tidy/ClangTidyDiagnosticConsumer.h (working copy)
65 #include "clang/Basic/Diagnostic.h"
66 #include "clang/Basic/SourceManager.h"
67 #include "clang/Tooling/Refactoring.h"
68 +#include "clang/Tooling/Core/Diagnostics.h"
69 #include "llvm/ADT/DenseMap.h"
70 #include "llvm/ADT/StringMap.h"
71 #include "llvm/Support/Regex.h"
76 -/// \brief A message from a clang-tidy check.
78 -/// Note that this is independent of a \c SourceManager.
79 -struct ClangTidyMessage {
80 - ClangTidyMessage(StringRef Message = "");
81 - ClangTidyMessage(StringRef Message, const SourceManager &Sources,
82 - SourceLocation Loc);
83 - std::string Message;
84 - std::string FilePath;
85 - unsigned FileOffset;
87 +typedef clang::tooling::DiagnosticsMessage ClangTidyMessage;
88 +typedef clang::tooling::Diagnostics ClangTidyError;
90 -/// \brief A detected error complete with information to display diagnostic and
93 -/// This is used as an intermediate format to transport Diagnostics without a
94 -/// dependency on a SourceManager.
96 -/// FIXME: Make Diagnostics flexible enough to support this directly.
97 -struct ClangTidyError {
99 - Warning = DiagnosticsEngine::Warning,
100 - Error = DiagnosticsEngine::Error
103 - ClangTidyError(StringRef CheckName, Level DiagLevel, bool IsWarningAsError,
104 - StringRef BuildDirectory);
106 - std::string CheckName;
107 - ClangTidyMessage Message;
108 - tooling::Replacements Fix;
109 - SmallVector<ClangTidyMessage, 1> Notes;
111 - // A build directory of the diagnostic source file.
113 - // It's an absolute path which is `directory` field of the source file in
114 - // compilation database. If users don't specify the compilation database
115 - // directory, it is the current directory where clang-tidy runs.
117 - // Note: it is empty in unittest.
118 - std::string BuildDirectory;
121 - bool IsWarningAsError;
124 /// \brief Read-only set of strings represented as a list of positive and
125 /// negative globs. Positive globs add all matched strings to the set, negative
126 /// globs remove them in the order of appearance in the list.
127 Index: clang-tidy/tool/ClangTidyMain.cpp
128 ===================================================================
129 --- clang-tidy/tool/ClangTidyMain.cpp (revision 278390)
130 +++ clang-tidy/tool/ClangTidyMain.cpp (working copy)
133 // -fix-errors implies -fix.
134 handleErrors(Errors, (FixErrors || Fix) && !DisableFixes, WErrorCount);
137 if (!ExportFixes.empty() && !Errors.empty()) {
139 llvm::raw_fd_ostream OS(ExportFixes, EC, llvm::sys::fs::F_None);