mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[cxx-interop] Add attribute to hide Swift declarations from interop
Explanation: We generate declarations in the C++ interop header with "unavailable" annotations when we cannot export something to C++. These declarations can collide with existing names. Previously, there were no ways to resolve these name collisions. This PR introduces a new attribute to hide declarations from the interop header. Issues: rdar://158843666 Original PRs: #82616 Risk: Low, this adds a new, straightforward code path. Testing: Added a compiler test. Reviewers: @egorzhdan
This commit is contained in:
committed by
Gabor Horvath
parent
f15d600460
commit
fa65cc9b2b
@@ -1018,7 +1018,8 @@ public:
|
||||
// library. Also skip structs from the standard library, they can cause
|
||||
// ambiguities because of the arithmetic types that conflict with types we
|
||||
// already have in `swift::` namespace. Also skip `Error` protocol from
|
||||
// stdlib, we have experimental support for it.
|
||||
// stdlib, we have experimental support for it. Also skip explicitly exluded
|
||||
// declarations.
|
||||
removedVDList.erase(
|
||||
llvm::remove_if(
|
||||
removedVDList,
|
||||
@@ -1028,7 +1029,8 @@ public:
|
||||
vd->getBaseIdentifier().hasUnderscoredNaming()) ||
|
||||
(vd->isStdlibDecl() && isa<StructDecl>(vd)) ||
|
||||
(vd->isStdlibDecl() &&
|
||||
vd->getASTContext().getErrorDecl() == vd);
|
||||
vd->getASTContext().getErrorDecl() == vd) ||
|
||||
swift::hasExposeNotCxxAttr(vd);
|
||||
}),
|
||||
removedVDList.end());
|
||||
// Sort the unavaiable decls by their name and kind.
|
||||
|
||||
Reference in New Issue
Block a user