| 1 |
// RUN: %clang_cc1 %s -verify -fsyntax-only -triple arm-none-linux |
| 2 |
// RUN: %clang_cc1 %s -verify -fsyntax-only -fms-compatibility -DDECLSPEC -triple i686-pc-win32 |
| 3 |
|
| 4 |
class Foo { |
| 5 |
void bar(); |
| 6 |
static void bar2(); |
| 7 |
unsigned v; |
| 8 |
static unsigned s; |
| 9 |
}; |
| 10 |
|
| 11 |
void __attribute__((naked)) Foo::bar() { // expected-note{{attribute is here}} |
| 12 |
asm("mov r2, %0" : : "r"(v)); // expected-error{{'this' pointer references not allowed in naked functions}} |
| 13 |
} |
| 14 |
|
| 15 |
void __attribute__((naked)) Foo::bar2() { |
| 16 |
asm("mov r2, %0" : : "r"(s)); // static member reference is OK |
| 17 |
} |
| 18 |
|
| 19 |
struct Bar { |
| 20 |
#ifdef DECLSPEC |
| 21 |
__declspec(naked) void func1(); // expected-error {{'naked' attribute only applies to non-member functions}} |
| 22 |
__declspec(naked) static void func2(); // expected-error {{'naked' attribute only applies to non-member functions}} |
| 23 |
#endif |
| 24 |
__attribute__((naked)) void func3(); // OK |
| 25 |
__attribute__((naked)) static void func4(); // OK |
| 26 |
}; |