diff options
author | Volodymyr Sapsai <vsapsai@apple.com> | 2018-08-03 23:12:37 +0000 |
---|---|---|
committer | Volodymyr Sapsai <vsapsai@apple.com> | 2018-08-03 23:12:37 +0000 |
commit | e5015abf185b6752bd1df09dad5a0d0435ba24a7 (patch) | |
tree | 32b03dc6484b18c2608c4917a393194c9a7aab8e /clang/test/Driver/unavailable_aligned_allocation.cpp | |
parent | 7c3492b00d99c81d4a58a8015dbe313eabaea799 (diff) | |
download | bcm5719-llvm-e5015abf185b6752bd1df09dad5a0d0435ba24a7.tar.gz bcm5719-llvm-e5015abf185b6752bd1df09dad5a0d0435ba24a7.zip |
[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
llvm-svn: 338934
Diffstat (limited to 'clang/test/Driver/unavailable_aligned_allocation.cpp')
-rw-r--r-- | clang/test/Driver/unavailable_aligned_allocation.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/Driver/unavailable_aligned_allocation.cpp b/clang/test/Driver/unavailable_aligned_allocation.cpp index d5820b0665c..508202de9f4 100644 --- a/clang/test/Driver/unavailable_aligned_allocation.cpp +++ b/clang/test/Driver/unavailable_aligned_allocation.cpp @@ -51,4 +51,13 @@ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // +// Check that passing -faligned-allocation or -fno-aligned-allocation stops the +// driver from passing -faligned-alloc-unavailable to cc1. +// +// RUN: %clang -target x86_64-apple-macosx10.12 -faligned-allocation -c -### %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix=AVAILABLE +// +// RUN: %clang -target x86_64-apple-macosx10.12 -fno-aligned-allocation -c -### %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix=AVAILABLE + // AVAILABLE-NOT: "-faligned-alloc-unavailable" |