summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/alloc-size.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CodeGenCXX/alloc-size.cpp')
-rw-r--r--clang/test/CodeGenCXX/alloc-size.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/alloc-size.cpp b/clang/test/CodeGenCXX/alloc-size.cpp
index ac53ea8f8ea..34892b8abc2 100644
--- a/clang/test/CodeGenCXX/alloc-size.cpp
+++ b/clang/test/CodeGenCXX/alloc-size.cpp
@@ -70,3 +70,19 @@ int testIt() {
__builtin_object_size(dependent_calloc2<int, 9>(), 0);
}
} // namespace templated_alloc_size
+
+// Be sure that an ExprWithCleanups doesn't deter us.
+namespace alloc_size_with_cleanups {
+struct Foo {
+ ~Foo();
+};
+
+void *my_malloc(const Foo &, int N) __attribute__((alloc_size(2)));
+
+// CHECK-LABEL: define i32 lalala
+int testIt() {
+ int *const p = (int *)my_malloc(Foo{}, 3);
+ // CHECK: ret i32 3
+ return __builtin_object_size(p, 0);
+}
+} // namespace alloc_size_with_cleanups
OpenPOWER on IntegriCloud