[Clang][Modules] Merge availability attributes on imported decls
authorMichael Spencer <bigcheesegs@gmail.com>
Thu, 16 Jun 2022 00:45:51 +0000 (17:45 -0700)
committerMichael Spencer <bigcheesegs@gmail.com>
Thu, 16 Jun 2022 00:46:16 +0000 (17:46 -0700)
commit169417531578501e955f12c79ecb8ff05333ae15
tree94722c1cbb2358871331538beff93cac79453dd6
parentf3bc0fccd68a1208d568360b0e3f6483759bae4a
[Clang][Modules] Merge availability attributes on imported decls

Currently we do not in general merge attributes when importing decls from modules. This patch handles availability, but long term we need to properly handle all attributes.

I tried to use Sema::mergeDeclAttributes, but it caused test crashes as I don't think it expects to be called in this context. We really shouldn't have duplicate code for merging attributes long term, but for now this fixes availability. There's already a TODO for this in the declaration of ASTDeclReader::mergeInheritableAttributes.

Differential Revision: https://reviews.llvm.org/D127182

rdar://85820301
clang/lib/Serialization/ASTReaderDecl.cpp
clang/test/Modules/decl-attr-merge.mm [new file with mode: 0644]