================ @@ -3703,8 +3703,14 @@ void Parser::ParseDeclarationSpecifiers( // We reject AT_LifetimeBound and AT_AnyX86NoCfCheck, even though they // are type attributes, because we historically haven't allowed these // to be used as type attributes in C++11 / C23 syntax. - if (PA.isTypeAttr() && PA.getKind() != ParsedAttr::AT_LifetimeBound && - PA.getKind() != ParsedAttr::AT_AnyX86NoCfCheck) + if (PA.getKind() == ParsedAttr::AT_LifetimeBound) { + Diag(PA.getLoc(), diag::err_attribute_wrong_decl_type_str) + << PA << PA.isRegularKeywordAttribute() + << "parameters and implicit object parameters"; ---------------- ilya-biryukov wrote:
I would like to second @cor3ntin's comment. We should aim to have all message strings in one place (i.e. the .td file), it makes searching for error messages much easier. However, `err_attribute_wrong_decl_type_str` in particular seems to be using strings in the source code ([1](https://github.com/llvm/llvm-project/blob/0cda970ecc8a885acf7298a61370a1368b0ea39b/clang/lib/Sema/SemaDeclAttr.cpp#L5529), [2](https://github.com/llvm/llvm-project/blob/0cda970ecc8a885acf7298a61370a1368b0ea39b/clang/lib/Sema/SemaDeclAttr.cpp#L1842), [3](https://github.com/llvm/llvm-project/blob/0cda970ecc8a885acf7298a61370a1368b0ea39b/clang/lib/Sema/SemaDeclAttr.cpp#L2736)). So I think this change is consistent with that, and I think we should just land it and replace this with a follow-up instead (@emaxx-google would you be willing to do it?) Adding another `AttributeDeclKind` seems off, given that it's a enumeration used primarily by parser. But adding a new enumeration for select (that maps to `AttributeDeclKind` for the known values and adds a few more) seems like a good path forward. https://github.com/llvm/llvm-project/pull/118567 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits