[clang-tools-extra] 656d9ba - [clang] Fix LogDiagnosticPrinter.h and ClangTidyPlugin.cpp after 9e306ad4 (#141131)
via cfe-commits
cfe-commits at lists.llvm.org
Thu May 22 13:39:58 PDT 2025
Author: Jan Svoboda
Date: 2025-05-22T13:39:54-07:00
New Revision: 656d9ba9346ad32aeffd5215c2bed43dfa710e16
URL: https://github.com/llvm/llvm-project/commit/656d9ba9346ad32aeffd5215c2bed43dfa710e16
DIFF: https://github.com/llvm/llvm-project/commit/656d9ba9346ad32aeffd5215c2bed43dfa710e16.diff
LOG: [clang] Fix LogDiagnosticPrinter.h and ClangTidyPlugin.cpp after 9e306ad4 (#141131)
Added:
Modified:
clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp
clang/include/clang/Frontend/LogDiagnosticPrinter.h
clang/lib/Frontend/LogDiagnosticPrinter.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp b/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp
index 7911583db30e4..8c98ba7b9238a 100644
--- a/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp
+++ b/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp
@@ -40,9 +40,10 @@ class ClangTidyPluginAction : public PluginASTAction {
// Create and set diagnostics engine
auto *DiagConsumer =
new ClangTidyDiagnosticConsumer(*Context, &Compiler.getDiagnostics());
+ auto DiagOpts = std::make_unique<DiagnosticOptions>();
auto DiagEngine = std::make_unique<DiagnosticsEngine>(
- new DiagnosticIDs, new DiagnosticOptions, DiagConsumer);
- Context->setDiagnosticsEngine(DiagEngine.get());
+ new DiagnosticIDs, *DiagOpts, DiagConsumer);
+ Context->setDiagnosticsEngine(std::move(DiagOpts), DiagEngine.get());
// Create the AST consumer.
ClangTidyASTConsumerFactory Factory(*Context);
diff --git a/clang/include/clang/Frontend/LogDiagnosticPrinter.h b/clang/include/clang/Frontend/LogDiagnosticPrinter.h
index b43b0da13967a..9807dfa3aba1a 100644
--- a/clang/include/clang/Frontend/LogDiagnosticPrinter.h
+++ b/clang/include/clang/Frontend/LogDiagnosticPrinter.h
@@ -51,7 +51,6 @@ class LogDiagnosticPrinter : public DiagnosticConsumer {
raw_ostream &OS;
std::unique_ptr<raw_ostream> StreamOwner;
const LangOptions *LangOpts;
- DiagnosticOptions &DiagOpts;
SourceLocation LastWarningLoc;
FullSourceLoc LastLoc;
diff --git a/clang/lib/Frontend/LogDiagnosticPrinter.cpp b/clang/lib/Frontend/LogDiagnosticPrinter.cpp
index 2d188931e4f8a..a4dd0298ef5e3 100644
--- a/clang/lib/Frontend/LogDiagnosticPrinter.cpp
+++ b/clang/lib/Frontend/LogDiagnosticPrinter.cpp
@@ -18,10 +18,9 @@ using namespace clang;
using namespace markup;
LogDiagnosticPrinter::LogDiagnosticPrinter(
- raw_ostream &os, DiagnosticOptions &DiagOpts,
+ raw_ostream &os, DiagnosticOptions &,
std::unique_ptr<raw_ostream> StreamOwner)
- : OS(os), StreamOwner(std::move(StreamOwner)), LangOpts(nullptr),
- DiagOpts(DiagOpts) {}
+ : OS(os), StreamOwner(std::move(StreamOwner)), LangOpts(nullptr) {}
static StringRef getLevelName(DiagnosticsEngine::Level Level) {
switch (Level) {
More information about the cfe-commits
mailing list