diff options
| author | George Burgess IV <george.burgess.iv@gmail.com> | 2015-12-02 21:58:08 +0000 |
|---|---|---|
| committer | George Burgess IV <george.burgess.iv@gmail.com> | 2015-12-02 21:58:08 +0000 |
| commit | 3e3bb95b6951c313dd5dd1c099184c309a3952e2 (patch) | |
| tree | 601f182e5509276b9319182864eac0e27a888b68 /clang/test | |
| parent | ba904d4ecf66528be5dadd60665d5a979ce6b1a4 (diff) | |
| download | bcm5719-llvm-3e3bb95b6951c313dd5dd1c099184c309a3952e2.tar.gz bcm5719-llvm-3e3bb95b6951c313dd5dd1c099184c309a3952e2.zip | |
Add the `pass_object_size` attribute to clang.
`pass_object_size` is our way of enabling `__builtin_object_size` to
produce high quality results without requiring inlining to happen
everywhere.
A link to the design doc for this attribute is available at the
Differential review link below.
Differential Revision: http://reviews.llvm.org/D13263
llvm-svn: 254554
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/CodeGenCXX/mangle-ms.cpp | 19 | ||||
| -rw-r--r-- | clang/test/SemaCXX/init-priority-attr.cpp | 2 |
2 files changed, 20 insertions, 1 deletions
diff --git a/clang/test/CodeGenCXX/mangle-ms.cpp b/clang/test/CodeGenCXX/mangle-ms.cpp index 54855ec5a4d..98277dc9a30 100644 --- a/clang/test/CodeGenCXX/mangle-ms.cpp +++ b/clang/test/CodeGenCXX/mangle-ms.cpp @@ -418,3 +418,22 @@ void f(S::T6) {} // X64-DAG: @"\01?f@UnnamedType@@YAXUT5@S@1@@Z" // X64-DAG: @"\01?f@UnnamedType@@YAXPEAU<unnamed-type-T6>@S@1@@Z" } + +namespace PassObjectSize { +// NOTE: This mangling is subject to change. +// Reiterating from the comment in MicrosoftMangle, the scheme is pretend a +// parameter of type __clang::__pass_object_sizeN exists after each pass object +// size param P, where N is the Type of the pass_object_size attribute on P. +// +// e.g. we want to mangle: +// void foo(void *const __attribute__((pass_object_size(0)))); +// as if it were +// namespace __clang { enum __pass_object_size0 : size_t {}; } +// void foo(void *const, __clang::__pass_object_size0); +// where __clang is a top-level namespace. + +// CHECK-DAG: define i32 @"\01?foo@PassObjectSize@@YAHQAHW4__pass_object_size0@__clang@@@Z" +int foo(int *const i __attribute__((pass_object_size(0)))) { return 0; } +// CHECK-DAG: define i32 @"\01?bar@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@@Z" +int bar(int *const i __attribute__((pass_object_size(1)))) { return 0; } +} diff --git a/clang/test/SemaCXX/init-priority-attr.cpp b/clang/test/SemaCXX/init-priority-attr.cpp index a2e6df26ba1..8f31e2fd62d 100644 --- a/clang/test/SemaCXX/init-priority-attr.cpp +++ b/clang/test/SemaCXX/init-priority-attr.cpp @@ -21,7 +21,7 @@ Two foo __attribute__((init_priority(101))) ( 5, 6 ); Two goo __attribute__((init_priority(2,3))) ( 5, 6 ); // expected-error {{'init_priority' attribute takes one argument}} -Two coo[2] __attribute__((init_priority(3))); // expected-error {{init_priority attribute requires integer constant between 101 and 65535 inclusive}} +Two coo[2] __attribute__((init_priority(3))); // expected-error {{'init_priority' attribute requires integer constant between 101 and 65535 inclusive}} Two koo[4] __attribute__((init_priority(1.13))); // expected-error {{'init_priority' attribute requires an integer constant}} |

