[PATCH] D61667: Assume `__cxa_allocate_exception` returns an under-aligned memory on Darwin if the version of libc++abi isn't new enough to include the fix in r319123

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 9 16:43:34 PDT 2019


rjmccall added inline comments.


================
Comment at: lib/Sema/SemaExprCXX.cpp:946
+  // is larger than the minimum alignment the libc++abi runtime guarantees.
+  if (Context.getTargetInfo().getTriple().isOSDarwin()) {
+    CharUnits TypeAlign = Context.getTypeAlignInChars(Ty);
----------------
ahatanak wrote:
> rjmccall wrote:
> > Why is this a Darwin-specific check?  Seems like it ought to be an Itanium-specific check, but it's equally applicable on Linux to highly-aligned types.
> Except when the C++ ABI is Microsoft, this is always diagnosed.
Thanks.  Please don't refer to `libc++abi` in this comment, though, since this is a general Itanium issue and not specific to any particular implementation.  How about something like:

  Under the Itanium C++ ABI, memory for the exception object is allocated by the runtime with no ability for the compiler to request additional alignment.  Warn if the exception type requires alignment beyond the minimum guaranteed by the target C++ runtime.


Repository:
  rC Clang

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

https://reviews.llvm.org/D61667





More information about the cfe-commits mailing list