[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
Wed May 8 14:25:14 PDT 2019


rjmccall added inline comments.


================
Comment at: include/clang/Basic/DiagnosticGroups.td:411
 def OpenCLUnsupportedRGBA: DiagGroup<"opencl-unsupported-rgba">;
+def UnderalignedExcpObj : DiagGroup<"underaligned-exception-object">;
 def DeprecatedObjCIsaUsage : DiagGroup<"deprecated-objc-isa-usage">;
----------------
Why is this name so clipped?


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:6572
+  "The alignment of %0 (%1-bytes) is larger than the guaranteed alignment of "
+  "the memory Itanium C++ runtime returns (%2-bytes)">;
 def err_return_in_constructor_handler : Error<
----------------
Hyphens seem wrong here, and you're missing some words, and it shouldn't be capitalized.  How about:

"required alignment of type %0 (%1 bytes) is larger than the supported alignment of C++ exception objects on this target (%2 bytes)"


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


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