[clang] [Clang] Fix isWeakImported() to traverse redeclaration chain for avai… (PR #181482)
via cfe-commits
cfe-commits at lists.llvm.org
Mon May 4 20:00:45 PDT 2026
================
@@ -3647,11 +3620,16 @@ void mergeInheritableAttributes(ASTReader &Reader, Decl *D, Decl *Previous) {
D->addAttr(NewAttr);
}
- const auto *AA = Previous->getAttr<AvailabilityAttr>();
- if (AA && !D->hasAttr<AvailabilityAttr>()) {
- NewAttr = AA->clone(Context);
- NewAttr->setInherited(true);
- D->addAttr(NewAttr);
+ // getAttr<AvailabilityAttr>() only returns the first match, but a
+ // declaration can carry multiple AvailabilityAttrs (one per platform,
+ // e.g. macos + ios). Iterate over all of them so every platform's
+ // availability is propagated to the new redeclaration.
----------------
kevinlzh1108 wrote:
Done. Removed the comment and updated the commit message — the explanation now lives there instead. Thanks for the review!
https://github.com/llvm/llvm-project/pull/181482
More information about the cfe-commits
mailing list