================ @@ -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>{" ---------------- erichkeane wrote:
>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. Hmm... pulling in the same text as well is interesting... What we discussed was pulling in the same `%enum_select` iif the enumerators were the same across all uses, not if the text itself was. I think ensuring the text is the same isn't necessary, and is actually problematic. The re-use of the same text like that is interesting.... I'd not thought of doing something like that (without the curleys), but I'm a touch afraid it harms readability of the diagnostic. https://github.com/llvm/llvm-project/pull/130868 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits