aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/annotate.c
diff options
context:
space:
mode:
authorJulien Lerouge <jlerouge@apple.com>2012-04-28 17:39:16 +0000
committerJulien Lerouge <jlerouge@apple.com>2012-04-28 17:39:16 +0000
commite59392176c2369df2bdd11b7786cb38abac00198 (patch)
tree5f166c1ff87306d850f0fd2ee5569b4b41d04186 /test/Sema/annotate.c
parentbddc7e5ed3982b5845e4fbb5d9bc7b7431c35a4f (diff)
Currently __builtin_annotation() only annotates an i32.
i32 __builtin_annotation(i32, string); Applying it to i64 (e.g., long long) generates the following IR. trunc i64 {{.*}} to i32 call i32 @llvm.annotation.i32 zext i32 {{.*}} to i64 The redundant truncation and extension make the result difficult to use. This patch makes __builtin_annotation() generic. type __builtin_annotation(type, string); For the i64 example, it simplifies the generated IR to: call i64 @llvm.annotation.i64 Patch by Xi Wang! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155764 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/annotate.c')
-rw-r--r--test/Sema/annotate.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/Sema/annotate.c b/test/Sema/annotate.c
index 5b2727752b..ef878d4c98 100644
--- a/test/Sema/annotate.c
+++ b/test/Sema/annotate.c
@@ -4,7 +4,8 @@ void __attribute__((annotate("foo"))) foo(float *a) {
__attribute__((annotate("bar"))) int x;
__attribute__((annotate(1))) int y; // expected-error {{argument to annotate attribute was not a string literal}}
__attribute__((annotate("bar", 1))) int z; // expected-error {{attribute takes one argument}}
- int u = __builtin_annotation(z, (char*) 0); // expected-error {{__builtin_annotation requires a non wide string constant}}
- int v = __builtin_annotation(z, (char*) L"bar"); // expected-error {{__builtin_annotation requires a non wide string constant}}
+ int u = __builtin_annotation(z, (char*) 0); // expected-error {{second argument to __builtin_annotation must be a non-wide string constant}}
+ int v = __builtin_annotation(z, (char*) L"bar"); // expected-error {{second argument to __builtin_annotation must be a non-wide string constant}}
int w = __builtin_annotation(z, "foo");
+ float b = __builtin_annotation(*a, "foo"); // expected-error {{first argument to __builtin_annotation must be an integer}}
}