view clang/test/Sema/attr-naked.cpp @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 1d019706d866
children c4bab56944e8
line wrap: on
line source

// 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
}