mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Clang importer] Import incomplete SWIFT_SHARED_REFERENCE types
Normally, Swift cannot import an incomplete type. However, when we are
importing a SWIFT_SHARED_REFERENCE type, we're always dealing with
pointers to the type, and there is no need for the underlying type to
be complete. This permits a common pattern in C libraries where the
actual underlying storage is opaque and all APIs traffic in the
pointer, e.g.,
typedef struct MyTypeImpl *MyType;
void MyTypeRetain(MyType ptr);
void MyTypeRelease(MyType ptr);
to use SWIFT_SHARED_REFERENCE to import such types as foreign
references, rather than as OpaquePointer.
Fixes rdar://155970441.
This commit is contained in:
@@ -2560,7 +2560,7 @@ llvm::SmallVector<clang::CXXMethodDecl *, 4>
|
||||
SwiftDeclSynthesizer::synthesizeStaticFactoryForCXXForeignRef(
|
||||
const clang::CXXRecordDecl *cxxRecordDecl) {
|
||||
|
||||
if (cxxRecordDecl->isAbstract())
|
||||
if (!cxxRecordDecl->isCompleteDefinition() || cxxRecordDecl->isAbstract())
|
||||
return {};
|
||||
|
||||
clang::ASTContext &clangCtx = cxxRecordDecl->getASTContext();
|
||||
|
||||
Reference in New Issue
Block a user