[PATCH] D45015: [Preprocessor] Allow libc++ to detect when aligned allocation is unavailable.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 25 15:27:19 PDT 2018


rsmith accepted this revision.
rsmith added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/Driver/ToolChains/Darwin.cpp:2027
+      isAlignedAllocationUnavailable())
     CC1Args.push_back("-faligned-alloc-unavailable");
 }
----------------
Quuxplusone wrote:
> Peanut gallery asks: Why is the cc1 option spelled differently from the clang driver option? Don't they do the same thing?
At the `-cc1` level, there are three different levels:
 * no aligned allocation in the language
 * aligned allocation in the language but it doesn't work (eg, C++17 on old Darwin)
 * aligned allocation in the language and it works

The driver aligned allocation flags force the compilation into case 1 or 3. Cases 1 and 2 do not advertise `__cpp_aligned_new`. Case 2 provides an error if an aligned allocation is attempted, whereas case 1 provides an underaligned allocation with a warning. This flag puts us into case 2, so it isn't the same as any driver flag.


https://reviews.llvm.org/D45015





More information about the cfe-commits mailing list