[clang] [clang] print correct context for diagnostics suppressed by deduction (PR #125453)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 3 16:27:42 PST 2025
================
@@ -1909,7 +1909,19 @@ class Sema final : public SemaBase {
/// '\#pragma clang attribute push' directives to the given declaration.
void AddPragmaAttributes(Scope *S, Decl *D);
- void PrintPragmaAttributeInstantiationPoint();
+ using DiagFuncRef =
+ llvm::function_ref<void(SourceLocation, PartialDiagnostic)>;
+ auto getDefaultDiagFunc() {
+ return [this](SourceLocation Loc, PartialDiagnostic PD) {
+ DiagnosticBuilder Builder(Diags.Report(Loc, PD.getDiagID()));
----------------
mizvekov wrote:
This bypasses a lot of the things `this->Diag(Loc, PD)` does, like SFINAE handling, ignoring notes attached to ignored diagnostics, adding instantiation context notes, and more, because we have already done them before storing the suppressed diagnostics, and we are just attaching notes to them.
https://github.com/llvm/llvm-project/pull/125453
More information about the cfe-commits
mailing list