]> granicus.if.org Git - clang/commit
[Preprocessor] Allow libc++ to detect when aligned allocation is unavailable.
authorVolodymyr Sapsai <vsapsai@apple.com>
Fri, 3 Aug 2018 23:12:37 +0000 (23:12 +0000)
committerVolodymyr Sapsai <vsapsai@apple.com>
Fri, 3 Aug 2018 23:12:37 +0000 (23:12 +0000)
commita336291ffe7ae5927e040fd3fcffb3af30d7fff5
tree31321c6d7ac06895f0791437140b031dfbef2867
parent6c542b52ff1756169b286d50ed7c35628fe2e49a
[Preprocessor] Allow libc++ to detect when aligned allocation is unavailable.

Libc++ needs to know when aligned allocation is supported by clang, but is
otherwise unavailable at link time. Otherwise, libc++ will incorrectly end up
generating calls to `__builtin_operator_new`/`__builtin_operator_delete` with
alignment arguments.

This patch implements the following changes:

* The `__cpp_aligned_new` feature test macro to no longer be defined when
  aligned allocation is otherwise enabled but unavailable.

* The Darwin driver no longer passes `-faligned-alloc-unavailable` when the
  user manually specifies `-faligned-allocation` or `-fno-aligned-allocation`.

* Instead of a warning Clang now generates a hard error when an aligned
  allocation or deallocation function is referenced but unavailable.

Patch by Eric Fiselier.

Reviewers: rsmith, vsapsai, erik.pilkington, ahatanak, dexonsmith

Reviewed By: rsmith

Subscribers: Quuxplusone, cfe-commits

Differential Revision: https://reviews.llvm.org/D45015

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338934 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticGroups.td
include/clang/Basic/DiagnosticSemaKinds.td
lib/Driver/ToolChains/Darwin.cpp
lib/Frontend/InitPreprocessor.cpp
lib/Sema/SemaExprCXX.cpp
test/Driver/unavailable_aligned_allocation.cpp
test/Lexer/aligned-allocation.cpp [new file with mode: 0644]