[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

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 9 16:29:41 PDT 2019


ahatanak added inline comments.


================
Comment at: include/clang/Basic/TargetInfo.h:643
+  /// runtime, such as those using the Itanium C++ ABI.
+  virtual unsigned getExnObjectAlignment() const {
+    // Itanium says that an _Unwind_Exception has to be "double-word"
----------------
rjmccall wrote:
> CharUnits?
I added a function to ASTContext that returns CharUnits.


================
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);
----------------
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.


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