[clang] [Clang] show attribute namespace in diagnostics (PR #138519)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu May 8 05:55:20 PDT 2025


================
@@ -6861,13 +6861,16 @@ ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, const ParsedAttr &AL,
   // though they were unknown attributes.
   if (AL.getKind() == ParsedAttr::UnknownAttribute ||
       !AL.existsInTarget(S.Context.getTargetInfo())) {
-    S.Diag(AL.getLoc(),
-           AL.isRegularKeywordAttribute()
-               ? (unsigned)diag::err_keyword_not_supported_on_target
-           : AL.isDeclspecAttribute()
-               ? (unsigned)diag::warn_unhandled_ms_attribute_ignored
-               : (unsigned)diag::warn_unknown_attribute_ignored)
-        << AL << AL.getRange();
+    if (AL.isRegularKeywordAttribute() || AL.isDeclspecAttribute()) {
----------------
erichkeane wrote:

I think that is a nice idea!  I think we actually already HAVE a ParsedAttr streaming diagnostic FWIW, its for `Attr *` (though we should probably make it work with `AttributeCommonInfo` instead, which works with `ParsedAttr` and `Attr`).

You're right about that being a bigger change, so I'm totally OK with that being a followup or a bug report.



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


More information about the cfe-commits mailing list