diff options
author | George Burgess IV <george.burgess.iv@gmail.com> | 2018-03-06 07:42:36 +0000 |
---|---|---|
committer | George Burgess IV <george.burgess.iv@gmail.com> | 2018-03-06 07:42:36 +0000 |
commit | 179aac9d58705772b5c17b0b4136c7cf994c8c62 (patch) | |
tree | ee6e59bada51d99aac83f4269c93d39673cc2643 /test/CodeGenCXX/alloc-size.cpp | |
parent | 09a80cc504e13cd931d86446f194d4a0ddf89e8f (diff) |
[ExprConstant] Look through ExprWithCleanups for `allocsize`
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326766 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/alloc-size.cpp')
-rw-r--r-- | test/CodeGenCXX/alloc-size.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/CodeGenCXX/alloc-size.cpp b/test/CodeGenCXX/alloc-size.cpp index 137d4543dd..275ffe6dca 100644 --- a/test/CodeGenCXX/alloc-size.cpp +++ b/test/CodeGenCXX/alloc-size.cpp @@ -88,3 +88,15 @@ int callMemberCalloc() { // CHECK: ret i32 32 return __builtin_object_size(C().my_calloc(16, 2), 0); } + +struct D { + ~D(); + void *my_malloc(int N) __attribute__((alloc_size(2))); +}; + +// CHECK-LABEL: define i32 @_Z20callExprWithCleanupsv +int callExprWithCleanups() { + int *const p = (int *)D().my_malloc(3); + // CHECK: ret i32 3 + return __builtin_object_size(p, 0); +} |