[6.2][cxx-interop] Types exposed from ObjC modules should be behind a macro

Explanation: We the generated reverse interop headers to be valid C++,
so every declaration coming from an Obj-C module should be behind an
ifdef. Unfortunately, we do not always have this information but we do
know that our frameworks contain Obj-C code. So this PR makes sure every
entity coming from our frameworks are behind ifdef.
Issues: rdar://152836730
Original PRs: #83002
Risk: Low, the change is narrow and straightforward.
Testing: Added a compiler test.
Reviewers: @egorzhdan
This commit is contained in:
Gábor Horváth
2025-07-15 17:07:53 +01:00
committed by Gabor Horvath
parent 234a41567f
commit ab123929f6
5 changed files with 63 additions and 5 deletions

View File

@@ -112,6 +112,9 @@ inline bool isExposableToCxx(
return !getDeclRepresentation(VD, isZeroSized).isUnsupported();
}
bool isObjCxxOnly(const ValueDecl *VD);
bool isObjCxxOnly(const clang::Decl *D);
/// Returns true if the given value decl D is visible to C++ of its
/// own accord (i.e. without considering its context)
bool isVisibleToCxx(const ValueDecl *VD, AccessLevel minRequiredAccess,