[clang] [Clang][RISCV] Support -fcf-protection=return for RISC-V (PR #112477)

Ming-Yi Lai via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 24 23:51:31 PDT 2024


================
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -triple riscv64-linux-unknown -target-feature +zimop -emit-llvm -o - %s -fcf-protection=return | FileCheck -check-prefix=NOTIGNORELISTED %s
+// RUN: %clang_cc1 -triple riscv64-linux-unknown -target-feature +zimop -emit-llvm -o - %s | FileCheck -check-prefix=IGNORELISTED %s
+
+int foo(int *a) { return *a; }
+
+// CHECK: define i32 @foo(ptr %a)
----------------
mylai-mtk wrote:

It looks like this line is not checked if you specify the `--check-prefix` option to FileCheck:

> --check-prefix prefix
> FileCheck searches the contents of match-filename for patterns to match. By default, these patterns are prefixed with “CHECK:”. If you’d like to use a different prefix (e.g. because the same input file is checking multiple different tool or options), the [--check-prefix](https://llvm.org/docs/CommandGuide/FileCheck.html#cmdoption-FileCheck-check-prefix) argument allows you to specify (without the trailing “:”) one or more prefixes to match. Multiple prefixes are useful for tests which might change for different run options, but most lines remain the same.

(ref. https://llvm.org/docs/CommandGuide/FileCheck.html)

https://github.com/llvm/llvm-project/pull/112477


More information about the cfe-commits mailing list