================ @@ -7867,15 +7867,16 @@ void Sema::checkUnusedDeclAttributes(Declarator &D) { void Sema::DiagnoseUnknownAttribute(const ParsedAttr &AL) { std::string NormalizedFullName = '\'' + AL.getNormalizedFullName() + '\''; + SourceRange NR = AL.getNormalizedRange(); + SourceLocation Loc = NR.getBegin(); + if (auto CorrectedFullName = AL.getCorrectedFullName(Context.getTargetInfo(), getLangOpts())) { - Diag(AL.getNormalizedRange().getBegin(), - diag::warn_unknown_attribute_ignored_suggestion) - << NormalizedFullName << *CorrectedFullName << AL.getNormalizedRange(); + Diag(Loc, diag::warn_unknown_attribute_ignored_suggestion) + << NormalizedFullName << *CorrectedFullName + << FixItHint::CreateReplacement(NR, *CorrectedFullName) << NR; } else { - Diag(AL.getNormalizedRange().getBegin(), - diag::warn_unknown_attribute_ignored) - << NormalizedFullName << AL.getNormalizedRange(); + Diag(Loc, diag::warn_unknown_attribute_ignored) << NormalizedFullName << NR; ---------------- AaronBallman wrote:
There are more places where we emit a `warn_unknown_attribute_ignored` diagnostic; should any of those be handled as well? For example, target-specific attributes which are typos, etc. https://github.com/llvm/llvm-project/pull/141305 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits