[PATCH] D75572: [Sema][SVE] Reject sizeof and alignof for sizeless types

Richard Sandiford via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 4 10:05:52 PST 2020


rsandifo-arm added a comment.

In D75572#1904517 <https://reviews.llvm.org/D75572#1904517>, @efriedma wrote:

> I think the specialized error messages are useful.  I don't have a strong opinion on what order the patches should land.


OK.  The new version keeps the tailored diagnostic but emits it from RequireCompleteTypeImpl instead.

> The difference between emitting the diagnostic in RequireCompleteType, vs. letting the caller do it, is basically just that it's harder to forget to check whether the type is sizeless.  I think that's important enough to be worth complicating the API a bit; better to forbid scalable types, rather than crash or miscompile later.  Probably the entry point that allows sizeless types should have a different name.

Yeah, the plan is to make RequireCompleteType reject sizeless types unless the caller has explicitly said otherwise.  We want to do that whatever approach is taken for emitting the diagnostics.  However, starting off with a patch that makes the types incomplete and then gradually relaxing the rules would interfere too much with other people's work, so the idea was to do it the other way around.  By building the series up this way, the final patch that makes sizeless types incomplete ends up being much smaller (and hopefully more reviewable!) than D62962 <https://reviews.llvm.org/D62962> was.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75572





More information about the cfe-commits mailing list