Skip to content

Commit 2d961d9

Browse files
committed
[interop][SwiftToCxx] do not print documentation comment for emitted methods if they're not actually emitted
1 parent af99c52 commit 2d961d9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/PrintAsClang/DeclAndTypePrinter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,8 +902,6 @@ class DeclAndTypePrinter::Implementation
902902
bool isClassMethod,
903903
bool isNSUIntegerSubscript = false,
904904
const SubscriptDecl *SD = nullptr) {
905-
printDocumentationComment(AFD);
906-
907905
Optional<ForeignAsyncConvention> asyncConvention =
908906
AFD->getForeignAsyncConvention();
909907
Optional<ForeignErrorConvention> errorConvention =
@@ -930,6 +928,7 @@ class DeclAndTypePrinter::Implementation
930928
return;
931929
owningPrinter.prologueOS << cFuncPrologueOS.str();
932930

931+
printDocumentationComment(AFD);
933932
DeclAndTypeClangFunctionPrinter declPrinter(
934933
os, owningPrinter.prologueOS, owningPrinter.typeMapping,
935934
owningPrinter.interopContext, owningPrinter);
@@ -978,6 +977,7 @@ class DeclAndTypePrinter::Implementation
978977
// FIXME: availability
979978
return;
980979
}
980+
printDocumentationComment(AFD);
981981

982982
if (isClassMethod)
983983
os << "+ (";

test/Interop/SwiftToCxx/stdlib/stdlib-dep-inline-in-cxx.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
// RUN: cat %t/stdlib.h %t/stdlib2.h > %t/two_includes.h
99

10-
// RUN: %check-generic-interop-cxx-header-in-clang(%t/two_includes.h -Wno-unused-private-field -Wno-unused-function -Wno-shadow -Wno-documentation)
10+
// RUN: %check-generic-interop-cxx-header-in-clang(%t/two_includes.h -Wno-unused-private-field -Wno-unused-function -Wno-shadow)
1111

1212
@_expose(Cxx)
1313
public func test() -> String {

0 commit comments

Comments
 (0)