From 2d961d9e8c04baed4e4cdad26c7aa0125dfaa8fb Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Tue, 4 Oct 2022 09:59:54 -0700 Subject: [PATCH] [interop][SwiftToCxx] do not print documentation comment for emitted methods if they're not actually emitted --- lib/PrintAsClang/DeclAndTypePrinter.cpp | 4 ++-- test/Interop/SwiftToCxx/stdlib/stdlib-dep-inline-in-cxx.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/PrintAsClang/DeclAndTypePrinter.cpp b/lib/PrintAsClang/DeclAndTypePrinter.cpp index 3d3dc3dbd2b97..638328c1a75a4 100644 --- a/lib/PrintAsClang/DeclAndTypePrinter.cpp +++ b/lib/PrintAsClang/DeclAndTypePrinter.cpp @@ -902,8 +902,6 @@ class DeclAndTypePrinter::Implementation bool isClassMethod, bool isNSUIntegerSubscript = false, const SubscriptDecl *SD = nullptr) { - printDocumentationComment(AFD); - Optional asyncConvention = AFD->getForeignAsyncConvention(); Optional errorConvention = @@ -930,6 +928,7 @@ class DeclAndTypePrinter::Implementation return; owningPrinter.prologueOS << cFuncPrologueOS.str(); + printDocumentationComment(AFD); DeclAndTypeClangFunctionPrinter declPrinter( os, owningPrinter.prologueOS, owningPrinter.typeMapping, owningPrinter.interopContext, owningPrinter); @@ -978,6 +977,7 @@ class DeclAndTypePrinter::Implementation // FIXME: availability return; } + printDocumentationComment(AFD); if (isClassMethod) os << "+ ("; diff --git a/test/Interop/SwiftToCxx/stdlib/stdlib-dep-inline-in-cxx.swift b/test/Interop/SwiftToCxx/stdlib/stdlib-dep-inline-in-cxx.swift index e0b3fddbbe5a8..3a47111cb72fc 100644 --- a/test/Interop/SwiftToCxx/stdlib/stdlib-dep-inline-in-cxx.swift +++ b/test/Interop/SwiftToCxx/stdlib/stdlib-dep-inline-in-cxx.swift @@ -7,7 +7,7 @@ // RUN: cat %t/stdlib.h %t/stdlib2.h > %t/two_includes.h -// RUN: %check-generic-interop-cxx-header-in-clang(%t/two_includes.h -Wno-unused-private-field -Wno-unused-function -Wno-shadow -Wno-documentation) +// RUN: %check-generic-interop-cxx-header-in-clang(%t/two_includes.h -Wno-unused-private-field -Wno-unused-function -Wno-shadow) @_expose(Cxx) public func test() -> String {