[clang] [Clang] add fix-it hints for unknown attributes (PR #141305)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed May 28 13:44:44 PDT 2025
================
@@ -7867,15 +7865,16 @@ void Sema::checkUnusedDeclAttributes(Declarator &D) {
void Sema::DiagnoseUnknownAttribute(const ParsedAttr &AL) {
std::string NormalizedFullName = '\'' + AL.getNormalizedFullName() + '\'';
+ SourceRange NR = AL.getNormalizedRange();
----------------
erichkeane wrote:
> What I was thinking is that if we have information about the `attribute-using prefix`, we could avoid normalization when suggesting a typo correction (while still using the scope::attr format in the diagnostic message). Instead, we could provide two separate fix-its: one for the scope and one for the attribute name. Not sure if that approach makes sense.
It DOES make sense. I was sorta hoping we could come up with a method to do the two separate on an individual identifier basis (so doing 1 level of correction at a scope, then a separate on on the attribute itself).
BUT this requires us to act separately on the scope so we cna do some sort of validation/fixit.
https://github.com/llvm/llvm-project/pull/141305
More information about the cfe-commits
mailing list