blob: 0d1a1c29a31091d6109365c5b415aab74f68f600 [file] [log] [blame]
Aaron Ballmanf09294c2018-01-03 22:22:48 +00001// RUN: %clang_cc1 %s -fsyntax-only -fdouble-square-bracket-attributes -verify
Nate Begeman86e07b62008-02-21 19:44:16 +00002
Aaron Ballmanbaec7782013-07-23 19:30:11 +00003void __attribute__((annotate("foo"))) foo(float *a) {
Nate Begeman86e07b62008-02-21 19:44:16 +00004 __attribute__((annotate("bar"))) int x;
Aaron Ballmanf09294c2018-01-03 22:22:48 +00005 [[clang::annotate("bar")]] int x2;
Aaron Ballman3cd6feb2013-07-30 01:31:03 +00006 __attribute__((annotate(1))) int y; // expected-error {{'annotate' attribute requires a string}}
Aaron Ballmanf09294c2018-01-03 22:22:48 +00007 [[clang::annotate(1)]] int y2; // expected-error {{'annotate' attribute requires a string}}
Aaron Ballmanbaec7782013-07-23 19:30:11 +00008 __attribute__((annotate("bar", 1))) int z; // expected-error {{'annotate' attribute takes one argument}}
Aaron Ballmanf09294c2018-01-03 22:22:48 +00009 [[clang::annotate("bar", 1)]] int z2; // expected-error {{'annotate' attribute takes one argument}}
10
Julien Lerougee5939212012-04-28 17:39:16 +000011 int u = __builtin_annotation(z, (char*) 0); // expected-error {{second argument to __builtin_annotation must be a non-wide string constant}}
12 int v = __builtin_annotation(z, (char*) L"bar"); // expected-error {{second argument to __builtin_annotation must be a non-wide string constant}}
Julien Lerouge77f68bb2011-09-09 22:41:49 +000013 int w = __builtin_annotation(z, "foo");
Julien Lerougee5939212012-04-28 17:39:16 +000014 float b = __builtin_annotation(*a, "foo"); // expected-error {{first argument to __builtin_annotation must be an integer}}
Nate Begeman86e07b62008-02-21 19:44:16 +000015}