[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 06:47:18 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:

There are a few uses of this function, I wonder if we switched it to returning `bool` and taking by reference (instead of const-reference) if making this always return 'true' (such that the cases followed immediately by 'return true' could just return), AND having it set the Attribute as invalid would be valuable.

ALSO-ALSO: Could we change this to take `AttributeCommonInfo` instead?  Or is there something that we need the full `ParsedAttr` for?

https://github.com/llvm/llvm-project/pull/141305


More information about the cfe-commits mailing list