https://github.com/syhhyl created https://github.com/llvm/llvm-project/pull/211499
Add Clang IR coverage for `#pragma weak alias = target` on Darwin. The test verifies that Clang: - emits the alias with weak linkage; - keeps calls referencing the alias instead of replacing them with the aliasee. This is a test-only follow-up to #198148 and covers the Clang lowering path used by #111321. >From 0a6b3e71f918f046c850ff8629ad26fc46e7ae9d Mon Sep 17 00:00:00 2001 From: syhhyl <[email protected]> Date: Thu, 23 Jul 2026 16:48:53 +0800 Subject: [PATCH] [clang][test] Add Darwin pragma weak alias IR coverage --- clang/test/CodeGen/pragma-weak-darwin.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 clang/test/CodeGen/pragma-weak-darwin.c diff --git a/clang/test/CodeGen/pragma-weak-darwin.c b/clang/test/CodeGen/pragma-weak-darwin.c new file mode 100644 index 0000000000000..1ab8c96ec3066 --- /dev/null +++ b/clang/test/CodeGen/pragma-weak-darwin.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -triple arm64-apple-macosx -emit-llvm -o - %s | FileCheck %s + +void strong_target(void) {} + +#pragma weak weak_alias = strong_target + +void use_alias(void) { + weak_alias(); +} + +// CHECK-DAG: @weak_alias = weak alias void (), ptr @strong_target +// CHECK-LABEL: define{{.*}} void @strong_target() +// CHECK-LABEL: define{{.*}} void @use_alias() +// CHECK: call void @weak_alias() _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
