John McCall | 4188760 | 2012-01-29 01:20:30 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s |
| 2 | |
| 3 | void test0() __attribute__((visibility("default"))); |
| 4 | void test1() __attribute__((visibility("hidden"))); |
| 5 | void test2() __attribute__((visibility("internal"))); |
| 6 | |
| 7 | // rdar://problem/10753392 |
| 8 | void test3() __attribute__((visibility("protected"))); // expected-warning {{target does not support 'protected' visibility; using 'default'}} |
| 9 | |
Rafael Espindola | 45a0b26 | 2012-04-26 01:26:03 +0000 | [diff] [blame] | 10 | struct __attribute__((visibility("hidden"))) test4; // expected-note {{previous attribute is here}} |
Rafael Espindola | 4e31b4d | 2012-05-01 20:58:29 +0000 | [diff] [blame] | 11 | struct test4; |
Rafael Espindola | 45a0b26 | 2012-04-26 01:26:03 +0000 | [diff] [blame] | 12 | struct __attribute__((visibility("default"))) test4; // expected-error {{visibility does not match previous declaration}} |
Rafael Espindola | 548d17c | 2012-05-02 20:36:57 +0000 | [diff] [blame] | 13 | |
| 14 | struct test5; |
| 15 | struct __attribute__((visibility("hidden"))) test5; // expected-note {{previous attribute is here}} |
| 16 | struct __attribute__((visibility("default"))) test5; // expected-error {{visibility does not match previous declaration}} |
Rafael Espindola | 9b79fc9 | 2012-05-07 23:58:18 +0000 | [diff] [blame] | 17 | |
| 18 | void test6() __attribute__((visibility("hidden"), // expected-note {{previous attribute is here}} |
| 19 | visibility("default"))); // expected-error {{visibility does not match previous declaration}} |
Rafael Espindola | 98ae834 | 2012-05-10 02:50:16 +0000 | [diff] [blame] | 20 | |
| 21 | extern int test7 __attribute__((visibility("default"))); // expected-note {{previous attribute is here}} |
| 22 | extern int test7 __attribute__((visibility("hidden"))); // expected-error {{visibility does not match previous declaration}} |
Rafael Espindola | dd44f34 | 2012-05-10 03:01:34 +0000 | [diff] [blame] | 23 | |
John McCall | d4c3d66 | 2013-02-20 01:54:26 +0000 | [diff] [blame] | 24 | typedef int __attribute__((visibility("default"))) bar; // expected-warning {{'visibility' attribute ignored}} |
| 25 | |
| 26 | int x __attribute__((type_visibility("default"))); // expected-error {{'type_visibility' attribute only applies to types and namespaces}} |
Benjamin Kramer | ae3a83f | 2013-09-09 15:08:57 +0000 | [diff] [blame] | 27 | |
| 28 | int PR17105 __attribute__((visibility(hidden))); // expected-error {{'visibility' attribute requires a string}} |