llvm-project/clang/test/CodeGen/attr-target-version-riscv-invalid.c
Piyou Chen f658c1bf4a
Recommit "[RISCV][FMV] Support target_version" (#111096)" (#111333)
Fix the buildbot failure caused by heap use-after-free error.

Origin message:

    This patch enable `target_version` attribute for RISC-V target.

    The proposal of `target_version` syntax can be found at the
    https://github.com/riscv-non-isa/riscv-c-api-doc/pull/48 (which has
    landed), as modified by the proposed
https://github.com/riscv-non-isa/riscv-c-api-doc/pull/85 (which adds the
    priority syntax).

`target_version` attribute will trigger the function multi-versioning
    feature and act like `target_clones` attribute. See
https://github.com/llvm/llvm-project/pull/85786 for the implementation
    of `target_clones`.
2024-10-08 16:26:55 +08:00

14 lines
401 B
C

// RUN: not %clang_cc1 -triple riscv64 -target-feature +i -emit-llvm -o - %s 2>&1 | FileCheck %s --check-prefix=CHECK-UNSUPPORT-OS
// CHECK-UNSUPPORT-OS: error: function multiversioning is currently only supported on Linux
__attribute__((target_version("default"))) int foo(void) {
return 2;
}
__attribute__((target_version("arch=+c"))) int foo(void) {
return 2;
}
int bar() { return foo(); }