summaryrefslogtreecommitdiff
path: root/test/Sema/attr-naked.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Sema/attr-naked.cpp')
-rw-r--r--test/Sema/attr-naked.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Sema/attr-naked.cpp b/test/Sema/attr-naked.cpp
new file mode 100644
index 0000000000000..eaa8e223b83e1
--- /dev/null
+++ b/test/Sema/attr-naked.cpp
@@ -0,0 +1,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
+}