================
@@ -131,17 +131,21 @@ def note_constexpr_past_end : Note<
"dereferenced pointer past the end of %select{|subobject of }0"
"%select{temporary|%2}1 is not a constant expression">;
def note_constexpr_past_end_subobject : Note<
- "cannot %select{access base class of|access derived class of|access field
of|"
- "access array element of|ERROR|"
- "access real component of|access imaginary component of}0 "
- "pointer past the end of object">;
+ "cannot %enum_select<AccessType>{"
+ "%BaseClassAccess{access base class of}|%DerivedClassAccess{access derived
class of}|"
+ "%FieldAccess{access field of}|%ArrayElementAccess{access array element
of}|"
+ "%ErrorAccess{ERROR}|"
+ "%RealComponentAccess{access real component
of}|%ImaginaryComponentAccess{access imaginary component of}"
+ "}0 pointer past the end of object">;
def note_non_null_attribute_failed : Note<
"null passed to a callee that requires a non-null argument">;
def note_constexpr_null_subobject : Note<
- "cannot %select{access base class of|access derived class of|access field
of|"
- "access array element of|perform pointer arithmetic on|"
- "access real component of|"
- "access imaginary component of}0 null pointer">;
+ "cannot %enum_select<NullSubobjectAccess>{"
----------------
Sirraide wrote:
Hmm, so `NullSubobjectAccess` has basically the same enumerators as
`AccessType` above—except that the latter has an additional `ERROR` case, which
I’m candidly not sure what that one is even for, but I also haven’t checked the
call site(s) for that diagnostic.
Somewhat relatedly, below we have `AccessKind` twice two different diagnostics,
which currently isn’t supported.
@erichkeane We recently discussed allowing ‘redeclaring’ an `%enum_select` iff
the enumerators and text are the same across all uses of `%enum_select` with
the same enumeration. I think it might additionally make sense to allow just
e.g. `%enum_select<T>`, that is e.g. `cannot %enum_select<AccessType>0 null
pointer`, to reference an existing `%enum_select`. That *should* be fairly
simple to implement; I finally have some more time on my hands, so I could come
up w/ a patch for that later today.
https://github.com/llvm/llvm-project/pull/130868
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits