[PATCH] D63954: Add lifetime categories attributes

Matthias Gehre via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 23 15:57:31 PDT 2019


mgehre marked 2 inline comments as done.
mgehre added inline comments.


================
Comment at: clang/include/clang/Basic/AttrDocs.td:4167
+
+The attribute ``[[gsl::Owner(T)]]`` applies to structs and classes that own an
+object of type ``T``:
----------------
aaron.ballman wrote:
> Do either of these attributes make sense on a union type? If so, might be worth mentioning unions here and below. If not, would it be worth diagnosing on a union?
Good catch! I added diagnostics and a test.


================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:2516
   "%0 and %1 attributes are not compatible">;
+def err_attribute_invalid_argument : Error<
+  "%0 is an invalid argument to attribute %1">;
----------------
aaron.ballman wrote:
> Can you combine this one with `err_attribute_argument_vec_type_hint`?
I'm not sure: vec_type_hint reads `"invalid attribute argument %0 - expecting a vector or vectorizable scalar type"` and here `""%0 is an invalid argument to attribute %1"`, i.e. one is positive ("expecting ...") and the other is negative ("%0 is an invalid argument").

I don't know how to describe "not void, not reference, not array type" in terms of "expecting ...", and I think that we should keep "expecting a vector or vectorizable scalar type" on the  VecTypeHint attribute diagnostic.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63954/new/

https://reviews.llvm.org/D63954





More information about the cfe-commits mailing list