mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 10:16:07 +00:00

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`.
14 lines
401 B
C
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(); }
|