[clang] [Clang] Fix isWeakImported() to traverse redeclaration chain for avai… (PR #181482)

Volodymyr Sapsai via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 30 12:52:47 PDT 2026


================
@@ -0,0 +1,39 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -triple arm64-apple-ios12.0 -fmodules-cache-path=%t \
+// RUN:   -fmodules -fimplicit-module-maps \
+// RUN:   -I %S/Inputs/availability-redecl-weak \
+// RUN:   -DINTERFACE_FIRST -emit-llvm -o - %s | FileCheck %s
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -triple arm64-apple-ios12.0 -fmodules-cache-path=%t \
+// RUN:   -fmodules -fimplicit-module-maps \
+// RUN:   -I %S/Inputs/availability-redecl-weak \
+// RUN:   -emit-llvm -o - %s | FileCheck %s
+
+// Test that isWeakImported() traverses the redeclaration chain across module
+// boundaries to find availability attributes.
----------------
vsapsai wrote:

I'm not sure you need a new test case. clang/test/Modules/decl-attr-merge.mm seems to be awfully similar to what you are testing. And for me
```diff
--- a/clang/test/Modules/decl-attr-merge.mm
+++ b/clang/test/Modules/decl-attr-merge.mm
@@ -7,7 +7,9 @@
 
 //--- headers/a.h
 
+__attribute__((availability(ios,introduced=14.0)))
 __attribute__((availability(macos,introduced=10.16)))
+__attribute__((availability(watchos, introduced = 4)))
 @interface INIntent
 - (instancetype)self;
 @end
```

triggers the error.

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


More information about the cfe-commits mailing list