attr-naked.cpp 455 B

123456789101112131415
  1. // RUN: %clang_cc1 %s -verify -fsyntax-only -triple arm-none-linux
  2. class Foo {
  3. void bar();
  4. static void bar2();
  5. unsigned v;
  6. static unsigned s;
  7. };
  8. void __attribute__((naked)) Foo::bar() { // expected-note{{attribute is here}}
  9. asm("mov r2, %0" : : "r"(v)); // expected-error{{'this' pointer references not allowed in naked functions}}
  10. }
  11. void __attribute__((naked)) Foo::bar2() {
  12. asm("mov r2, %0" : : "r"(s)); // static member reference is OK
  13. }