summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/alloc-size.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2016-12-20 08:28:19 +0000
committerChandler Carruth <chandlerc@gmail.com>2016-12-20 08:28:19 +0000
commit4e57f52faea670d545cbe937f52e6e9cf5d19b0b (patch)
tree0e1a34ef183e1a86041560a01939b35c280421a0 /test/CodeGenCXX/alloc-size.cpp
parent4e23c3c7878efe0251fcf3af27231635a438359e (diff)
Revert r290149: Add the alloc_size attribute to clang.
This commit fails MSan when running test/CodeGen/object-size.c in a confusing way. After some discussion with George, it isn't really clear what is going on here. We can make the MSan failure go away by testing for the invalid bit, but *why* things are invalid isn't clear. And yet, other code in the surrounding area is doing precisely this and testing for invalid. George is going to take a closer look at this to better understand the nature of the failure and recommit it, for now backing it out to clean up MSan builds. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290169 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/alloc-size.cpp')
-rw-r--r--test/CodeGenCXX/alloc-size.cpp72
1 files changed, 0 insertions, 72 deletions
diff --git a/test/CodeGenCXX/alloc-size.cpp b/test/CodeGenCXX/alloc-size.cpp
deleted file mode 100644
index e93e231b70..0000000000
--- a/test/CodeGenCXX/alloc-size.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -O0 %s -o - 2>&1 -std=c++11 | FileCheck %s
-
-namespace templates {
-void *my_malloc(int N) __attribute__((alloc_size(1)));
-void *my_calloc(int N, int M) __attribute__((alloc_size(1, 2)));
-
-struct MyType {
- int arr[4];
-};
-
-template <typename T> int callMalloc();
-
-template <typename T, int N> int callCalloc();
-
-// CHECK-LABEL: define i32 @_ZN9templates6testItEv()
-int testIt() {
- // CHECK: call i32 @_ZN9templates10callMallocINS_6MyTypeEEEiv
- // CHECK: call i32 @_ZN9templates10callCallocINS_6MyTypeELi4EEEiv
- return callMalloc<MyType>() + callCalloc<MyType, 4>();
-}
-
-// CHECK-LABEL: define linkonce_odr i32
-// @_ZN9templates10callMallocINS_6MyTypeEEEiv
-template <typename T> int callMalloc() {
- static_assert(sizeof(T) == 16, "");
- // CHECK: ret i32 16
- return __builtin_object_size(my_malloc(sizeof(T)), 0);
-}
-
-// CHECK-LABEL: define linkonce_odr i32
-// @_ZN9templates10callCallocINS_6MyTypeELi4EEEiv
-template <typename T, int N> int callCalloc() {
- static_assert(sizeof(T) * N == 64, "");
- // CHECK: ret i32 64
- return __builtin_object_size(my_malloc(sizeof(T) * N), 0);
-}
-}
-
-namespace templated_alloc_size {
-using size_t = unsigned long;
-
-// We don't need bodies for any of these, because they're only used in
-// __builtin_object_size, and that shouldn't need anything but a function
-// decl with alloc_size on it.
-template <typename T>
-T *my_malloc(size_t N = sizeof(T)) __attribute__((alloc_size(1)));
-
-template <typename T>
-T *my_calloc(size_t M, size_t N = sizeof(T)) __attribute__((alloc_size(2, 1)));
-
-template <size_t N>
-void *dependent_malloc(size_t NT = N) __attribute__((alloc_size(1)));
-
-template <size_t N, size_t M>
-void *dependent_calloc(size_t NT = N, size_t MT = M)
- __attribute__((alloc_size(1, 2)));
-
-template <typename T, size_t M>
-void *dependent_calloc2(size_t NT = sizeof(T), size_t MT = M)
- __attribute__((alloc_size(1, 2)));
-
-// CHECK-LABEL: define i32 @_ZN20templated_alloc_size6testItEv
-int testIt() {
- // 122 = 4 + 5*4 + 6 + 7*8 + 4*9
- // CHECK: ret i32 122
- return __builtin_object_size(my_malloc<int>(), 0) +
- __builtin_object_size(my_calloc<int>(5), 0) +
- __builtin_object_size(dependent_malloc<6>(), 0) +
- __builtin_object_size(dependent_calloc<7, 8>(), 0) +
- __builtin_object_size(dependent_calloc2<int, 9>(), 0);
-}
-}