Clang Project

clang_source_code/test/Sema/riscv-interrupt-attr.cpp
1// RUN: %clang_cc1 -x c++ -triple riscv32-unknown-elf -emit-llvm  -DCHECK_IR < %s | FileCheck %s
2// RUN: %clang_cc1 -x c++ -triple riscv64-unknown-elf -emit-llvm  -DCHECK_IR < %s | FileCheck %s
3// RUN: %clang_cc1 %s -triple riscv32-unknown-elf -verify -fsyntax-only
4// RUN: %clang_cc1 %s -triple riscv64-unknown-elf -verify -fsyntax-only
5
6#if defined(CHECK_IR)
7// CHECK-LABEL: @_Z11foo_defaultv() #0
8// CHECK: ret void
9[[gnu::interrupt]] void foo_default() {}
10// CHECK: attributes #0
11// CHECK: "interrupt"="machine"
12#else
13[[gnu::interrupt]] [[gnu::interrupt]] void foo1() {} // expected-warning {{repeated RISC-V 'interrupt' attribute}} \
14                                                     // expected-note {{repeated RISC-V 'interrupt' attribute is here}}
15[[gnu::interrupt]] void foo2() {}
16#endif
17