Skip to content

[clang] Fix LogDiagnosticPrinter.h and ClangTidyPlugin.cpp after 9e306ad4 #141131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion clang/include/clang/Frontend/LogDiagnosticPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions clang/lib/Frontend/LogDiagnosticPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading