llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: syhhyl (syhhyl)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/211499.diff


1 Files Affected:

- (added) clang/test/CodeGen/pragma-weak-darwin.c (+14) 


``````````diff
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()

``````````

</details>


https://github.com/llvm/llvm-project/pull/211499
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to