Skip to content

[cxx-interop] emit correct parameter name in the inline C++ function … #42100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/PrintAsClang/DeclAndTypePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ class DeclAndTypePrinter::Implementation
size_t index = 1;
interleaveComma(*params, os, [&](const ParamDecl *param) {
if (param->hasName()) {
os << param->getName();
ClangSyntaxPrinter(os).printIdentifier(param->getName().str());
} else {
os << "_" << index;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend %s -typecheck -module-name Functions -clang-header-expose-public-decls -emit-clang-header-path %t/functions.h
// RUN: %FileCheck %s < %t/functions.h

// RUN: %check-interop-cxx-header-in-clang(%t/functions.h)

// CHECK: inline void testKeywordArgument(swift::Int register_) noexcept
// CHECK-NEXT: return _impl::$s9Functions19testKeywordArgument8registerySi_tF(register_);

func testKeywordArgument(register: Int) {
}