summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/attr-naked.cpp
blob: eaa8e223b83e10c5b85596ccce26e3a25857a321 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// RUN: %clang_cc1 %s -verify -fsyntax-only -triple arm-none-linux
class Foo {
  void bar();
  static void bar2();
  unsigned v;
  static unsigned s;
};

void __attribute__((naked)) Foo::bar() { // expected-note{{attribute is here}}
  asm("mov r2, %0" : : "r"(v)); // expected-error{{'this' pointer references not allowed in naked functions}}
}

void __attribute__((naked)) Foo::bar2() {
  asm("mov r2, %0" : : "r"(s)); // static member reference is OK
}
OpenPOWER on IntegriCloud