annotate clang/test/Misc/inline-asm-clobber-warning.c @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /// This test checks that the warning includes the location in the C source
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 /// file that contains the inline asm. Instead of saying <inline asm> for both.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 /// Although this warning is emitted in llvm it cannot be tested from IR as
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 /// it does not have that location information at that stage.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 // RUN: %clang -target arm-arm-none-eabi -march=armv7-m -c %s -o /dev/null \
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 // RUN: 2>&1 | FileCheck %s
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 // REQUIRES: arm-registered-target
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 void bar(void) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 __asm__ __volatile__("nop"
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 :
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 :
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 : "sp");
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 // CHECK: inline-asm-clobber-warning.c:12:24: warning: inline asm clobber list contains reserved registers: SP [-Winline-asm]
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 // CHECK-NEXT: __asm__ __volatile__("nop"
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 // CHECK-NEXT: ^
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 // CHECK-NEXT: inline-asm-clobber-warning.c:12:24: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.