mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This fixes a compiler crash that happened when emitting a Clang header for a Swift module that declares multiple macros with the same base name and different argument names. Swift macros are not currently designed to be exposed to C++. This teaches the compiler to explicitly mark them as unavailable in C++. rdar://117969472 / resolves https://github.com/apple/swift/issues/69656
17 lines
769 B
Swift
17 lines
769 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend %s -typecheck -module-name MacroNameCollision -clang-header-expose-decls=all-public -emit-clang-header-path %t/macros.h
|
|
// RUN: %FileCheck %s < %t/macros.h
|
|
|
|
// RUN: %check-interop-cxx-header-in-clang(%t/macros.h)
|
|
|
|
// CHECK-LABEL: namespace MacroNameCollision SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("MacroNameCollision") {
|
|
|
|
@freestanding(expression)
|
|
public macro myLogMacro(error: String) = #externalMacro(module: "CompilerPlugin", type: "LogMacro")
|
|
|
|
@freestanding(expression)
|
|
public macro myLogMacro(fault: String) = #externalMacro(module: "CompilerPlugin", type: "LogMacro")
|
|
|
|
// CHECK: // Unavailable in C++: Swift macro 'myLogMacro(error:)'
|
|
// CHECK: // Unavailable in C++: Swift macro 'myLogMacro(fault:)'
|