Skip to content

Commit 9c54797

Browse files
author
Omar Habra
committed
This Patch solves "[SR-14031]: [C++] Pointer template type should not be imported as an OpaquePointer":
previously empty pointer used to be imported as OpaquePointer. This patch will translate void pointers to Swift Types UnsafeMutablePointer.
1 parent cc87566 commit 9c54797

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/ClangImporter/ImportType.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,11 +1920,9 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
19201920
Type swiftParamTy;
19211921
bool isParamTypeImplicitlyUnwrapped = false;
19221922
bool isInOut = false;
1923-
1924-
auto referenceType = dyn_cast<clang::ReferenceType>(paramTy);
1925-
if (referenceType &&
1926-
isa<clang::TemplateTypeParmType>(referenceType->getPointeeType())) {
1927-
auto pointeeType = referenceType->getPointeeType();
1923+
if ((isa<clang::ReferenceType>(paramTy) || isa<clang::PointerType>(paramTy)) &&
1924+
isa<clang::TemplateTypeParmType>(paramTy->getPointeeType())) {
1925+
auto pointeeType = paramTy->getPointeeType();
19281926
auto templateParamType = cast<clang::TemplateTypeParmType>(pointeeType);
19291927
PointerTypeKind pointerKind = pointeeType.getQualifiers().hasConst()
19301928
? PTK_UnsafePointer

0 commit comments

Comments
 (0)