[clang] [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118281)

Maksim Ivanov via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 2 07:55:17 PST 2024


================
@@ -8612,7 +8612,10 @@ static void HandleLifetimeBoundAttr(TypeProcessingState &State,
     CurType = State.getAttributedType(
         createSimpleAttr<LifetimeBoundAttr>(State.getSema().Context, Attr),
         CurType, CurType);
+    return;
   }
+  State.getSema().Diag(Attr.getLoc(), diag::err_attribute_not_type_attr)
----------------
emaxx-google wrote:

Done, makes sense!

Probably I should also change the existing diagnostics on the decl-spec code? (This is the `int [[clang::lifetimebound]]` test above.) I'll do that in a separate PR because this would be a change of the warning that was already emitted previously.

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


More information about the cfe-commits mailing list