Skip to content

Change macro expansion mangling to avoid request cycles #74201

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
Jun 14, 2024
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
1 change: 1 addition & 0 deletions include/swift/Demangling/DemangleNodes.def
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ NODE(LazyProtocolWitnessTableAccessor)
NODE(LazyProtocolWitnessTableCacheVariable)
NODE(LocalDeclName)
NODE(Macro)
NODE(MacroExpansionLoc)
NODE(MacroExpansionUniqueName)
CONTEXT_NODE(MaterializeForSet)
NODE(MemberAttachedMacroExpansion)
Expand Down
19 changes: 15 additions & 4 deletions lib/AST/ASTMangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4441,10 +4441,21 @@ void ASTMangler::appendMacroExpansionContext(
ASTContext &ctx = origDC->getASTContext();
SourceManager &sourceMgr = ctx.SourceMgr;

auto appendMacroExpansionLoc = [&]() {
appendIdentifier(origDC->getParentModule()->getName().str());

auto *SF = origDC->getParentSourceFile();
appendIdentifier(llvm::sys::path::filename(SF->getFilename()));

auto lineColumn = sourceMgr.getLineAndColumnInBuffer(loc);
appendOperator("fMX", Index(lineColumn.first), Index(lineColumn.second));
};

auto bufferID = sourceMgr.findBufferContainingLoc(loc);
auto generatedSourceInfo = sourceMgr.getGeneratedSourceInfo(bufferID);
if (!generatedSourceInfo)
return appendContext(origDC, nullBase, StringRef());
if (!generatedSourceInfo) {
return appendMacroExpansionLoc();
}

SourceLoc outerExpansionLoc;
DeclContext *outerExpansionDC;
Expand All @@ -4463,7 +4474,7 @@ void ASTMangler::appendMacroExpansionContext(
case GeneratedSourceInfo::PrettyPrinted:
case GeneratedSourceInfo::ReplacedFunctionBody:
case GeneratedSourceInfo::DefaultArgument:
return appendContext(origDC, nullBase, StringRef());
return appendMacroExpansionLoc();
}

switch (generatedSourceInfo->kind) {
Expand Down Expand Up @@ -4520,7 +4531,7 @@ void ASTMangler::appendMacroExpansionContext(
// If we hit the point where the structure is represented as a DeclContext,
// we're done.
if (origDC->isChildContextOf(outerExpansionDC))
return appendContext(origDC, nullBase, StringRef());
return appendMacroExpansionLoc();

// Append our own context and discriminator.
appendMacroExpansionContext(outerExpansionLoc, origDC);
Expand Down
17 changes: 16 additions & 1 deletion lib/Demangling/Demangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4294,7 +4294,8 @@ static bool isMacroExpansionNodeKind(Node::Kind kind) {
kind == Node::Kind::MemberAttachedMacroExpansion ||
kind == Node::Kind::PeerAttachedMacroExpansion ||
kind == Node::Kind::ConformanceAttachedMacroExpansion ||
kind == Node::Kind::ExtensionAttachedMacroExpansion;
kind == Node::Kind::ExtensionAttachedMacroExpansion ||
kind == Node::Kind::MacroExpansionLoc;
}

NodePointer Demangler::demangleMacroExpansion() {
Expand Down Expand Up @@ -4323,6 +4324,20 @@ NodePointer Demangler::demangleMacroExpansion() {
isFreestanding = false;
break;

case 'X': {
kind = Node::Kind::MacroExpansionLoc;

int line = demangleIndex();
int col = demangleIndex();

auto lineNode = createNode(Node::Kind::Index, line);
auto colNode = createNode(Node::Kind::Index, col);

NodePointer buffer = popNode(Node::Kind::Identifier);
NodePointer module = popNode(Node::Kind::Identifier);
return createWithChildren(kind, module, buffer, lineNode, colNode);
}

default:
return nullptr;
}
Expand Down
19 changes: 19 additions & 0 deletions lib/Demangling/NodePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ class NodePrinter {
case Node::Kind::LazyProtocolWitnessTableCacheVariable:
case Node::Kind::LocalDeclName:
case Node::Kind::Macro:
case Node::Kind::MacroExpansionLoc:
case Node::Kind::MacroExpansionUniqueName:
case Node::Kind::MaterializeForSet:
case Node::Kind::MemberAttributeAttachedMacroExpansion:
Expand Down Expand Up @@ -1544,6 +1545,24 @@ NodePointer NodePrinter::print(NodePointer Node, unsigned depth,
return printEntity(Node, depth, asPrefixContext, TypePrinting::NoType,
/*hasName*/true, "freestanding macro expansion #",
(int)Node->getChild(2)->getIndex() + 1);
case Node::Kind::MacroExpansionLoc:
if (Node->getNumChildren() > 0) {
Printer << "module ";
print(Node->getChild(0), depth + 1);
}
if (Node->getNumChildren() > 1) {
Printer << " file ";
print(Node->getChild(1), depth + 1);
}
if (Node->getNumChildren() > 2) {
Printer << " line ";
print(Node->getChild(2), depth + 1);
}
if (Node->getNumChildren() > 3) {
Printer << " column ";
print(Node->getChild(3), depth + 1);
}
return nullptr;
case Node::Kind::MacroExpansionUniqueName:
return printEntity(Node, depth, asPrefixContext, TypePrinting::NoType,
/*hasName*/true, "unique name #",
Expand Down
5 changes: 5 additions & 0 deletions lib/Demangling/OldRemangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,11 @@ ManglingError Remangler::mangleMacroExpansionUniqueName(
return mangleChildNodes(node, depth + 1);
}

ManglingError Remangler::mangleMacroExpansionLoc(
Node *node, unsigned depth) {
return MANGLING_ERROR(ManglingError::UnsupportedNodeKind, node);
}

ManglingError Remangler::mangleAccessor(Node *storageNode,
StringRef accessorCode,
EntityContext &ctx, unsigned depth) {
Expand Down
15 changes: 15 additions & 0 deletions lib/Demangling/Remangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3120,6 +3120,21 @@ ManglingError Remangler::mangle##Name##AttachedMacroExpansion( \
}
#include "swift/Basic/MacroRoles.def"

ManglingError Remangler::mangleMacroExpansionLoc(
Node *node, unsigned depth) {
RETURN_IF_ERROR(mangleChildNode(node, 0, depth + 1));
RETURN_IF_ERROR(mangleChildNode(node, 1, depth + 1));

auto line = node->getChild(2)->getIndex();
auto col = node->getChild(3)->getIndex();

Buffer << "fMX";
mangleIndex(line);
mangleIndex(col);

return ManglingError::Success;
}

ManglingError Remangler::mangleMacroExpansionUniqueName(
Node *node, unsigned depth) {
RETURN_IF_ERROR(mangleChildNode(node, 0, depth + 1));
Expand Down
15 changes: 15 additions & 0 deletions test/Concurrency/isolation_macro_local_functions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// RUN: %target-swift-frontend -emit-silgen %s -disable-availability-checking

public func hasIsolatedParam<T>(isolation: isolated (any Actor)? = #isolation) async -> T {}

func callee<T>(_: @autoclosure () -> T, _: @autoclosure () -> T) {}

func outer() async {
func inner() async -> String {
let x = #isolation
return await hasIsolatedParam()
}

var value = await inner()
callee(value, "hi")
}
2 changes: 2 additions & 0 deletions test/Demangle/Inputs/manglings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,5 @@ $sSRyxG15Synchronization19AtomicRepresentableABRi0_zrlMc ---> protocol conforman
$sSRyxG15Synchronization19AtomicRepresentableABRi1_zrlMc ---> protocol conformance descriptor for < where A: ~Swift.<bit 2>> Swift.UnsafeBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization

$s23variadic_generic_opaque2G2VyAA2S1V_AA2S2VQPGAA1PHPAeA1QHPyHC_AgaJHPyHCHX_HC ---> concrete protocol conformance variadic_generic_opaque.G2<Pack{variadic_generic_opaque.S1, variadic_generic_opaque.S2}> to protocol conformance ref (type's module) variadic_generic_opaque.P with conditional requirements: (pack protocol conformance (concrete protocol conformance variadic_generic_opaque.S1 to protocol conformance ref (type's module) variadic_generic_opaque.Q, concrete protocol conformance variadic_generic_opaque.S2 to protocol conformance ref (type's module) variadic_generic_opaque.Q))

$s9MacroUser0023macro_expandswift_elFCffMX436_4_23bitwidthNumberedStructsfMf_ ---> freestanding macro expansion #1 of bitwidthNumberedStructs in module MacroUser file macro_expand.swift line 437 column 5
8 changes: 4 additions & 4 deletions test/Macros/freestanding_multifile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ macro anonymousTypes(public: Bool, _: () -> String) = #externalMacro(module: "Ma

// RUN: %target-swift-frontend -swift-version 5 -emit-ir -load-plugin-library %t/%target-library-name(MacroDefinition) -module-name MacroUser %S/Inputs/AnonTypes1.swift %S/Inputs/AnonTypes2.swift %s -o - -g | %FileCheck --check-prefix CHECK-IR %s

// CHECK-IR: $s9MacroUser33{{.*}}14anonymousTypesfMf_4namefMu_
// CHECK-IR-NOT: $s9MacroUser33{{.*}}14anonymousTypesfMf0_4namefMu_
// CHECK-IR: $s9MacroUser33{{.*}}14anonymousTypesfMf_4namefMu_
// CHECK-IR-NOT: $s9MacroUser33{{.*}}14anonymousTypesfMf0_4namefMu_
// CHECK-IR: $s9MacroUser{{.*}}fMX{{.*}}_33{{.*}}14anonymousTypesfMf_4namefMu_
// CHECK-IR-NOT: $s9MacroUser{{.*}}fMX{{.*}}_33{{.*}}14anonymousTypesfMf0_4namefMu_
// CHECK-IR: $s9MacroUser{{.*}}fMX{{.*}}_33{{.*}}14anonymousTypesfMf_4namefMu_
// CHECK-IR-NOT: $s9MacroUser{{.*}}fMX{{.*}}_33{{.*}}14anonymousTypesfMf0_4namefMu_
28 changes: 14 additions & 14 deletions test/Macros/macro_expand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct MemberNotCovered {
// expected-note@-1 {{in expansion of macro 'NotCovered' here}}

// CHECK-DIAGS: error: declaration name 'value' is not covered by macro 'NotCovered'
// CHECK-DIAGS: CONTENTS OF FILE @__swiftmacro_9MacroUser16MemberNotCoveredV33_4361AD9339943F52AE6186DD51E04E91Ll0dE0fMf_.swift
// CHECK-DIAGS: CONTENTS OF FILE @__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX69_2_33_4361AD9339943F52AE6186DD51E04E91Ll10NotCoveredfMf_.swift
// CHECK-DIAGS: var value: Int
// CHECK-DIAGS: END CONTENTS OF FILE
}
Expand Down Expand Up @@ -137,7 +137,7 @@ macro AccidentalCodeItem() = #externalMacro(module: "MacroDefinition", type: "Fa
func invalidDeclarationMacro() {
#accidentalCodeItem
// expected-note@-1 {{in expansion of macro 'accidentalCodeItem' here}}
// CHECK-DIAGS: @__swiftmacro_9MacroUser018invalidDeclarationA0yyF18accidentalCodeItemfMf_.swift:1:1: error: expected macro expansion to produce a declaration
// CHECK-DIAGS: @__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX{{.*}}_18accidentalCodeItemfMf_.swift:1:1: error: expected macro expansion to produce a declaration

@AccidentalCodeItem struct S {}
// expected-note@-1 {{in expansion of macro 'AccidentalCodeItem' on struct 'S' here}}
Expand All @@ -155,17 +155,17 @@ func testFileID(a: Int, b: Int) {
print("Result is \(#customFileID)")
// CHECK-SIL: sil_scope [[SRC_SCOPE:[0-9]+]] { loc "{{.*}}macro_expand.swift":[[@LINE-3]]:6 parent {{.*}}testFileID
// CHECK-SIL: sil_scope [[EXPANSION_SCOPE:[0-9]+]] { loc "{{.*}}macro_expand.swift":[[@LINE-2]]:22 parent [[SRC_SCOPE]]
// CHECK-SIL: sil_scope [[MACRO_SCOPE:[0-9]+]] { loc "@__swiftmacro{{.*}}":1:1 parent @$s9MacroUser10testFileID1a1bySi_SitF06customdE0fMf_ {{.*}} inlined_at [[EXPANSION_SCOPE]] }
// CHECK-SIL: string_literal utf8 "MacroUser/macro_expand.swift", loc "@__swiftmacro_9MacroUser10testFileID1a1bySi_SitF06customdE0fMf_.swift":1:1, scope [[MACRO_SCOPE]]
// CHECK-IR-DAG: !DISubprogram(name: "customFileID", linkageName: "$s9MacroUser10testFileID1a1bySi_SitF06customdE0fMf_"
// CHECK-SIL: sil_scope [[MACRO_SCOPE:[0-9]+]] { loc "@__swiftmacro{{.*}}":1:1 parent @$s9MacroUser0023macro_expandswift_elFCffMX{{.*}}_12customFileIDfMf_ {{.*}} inlined_at [[EXPANSION_SCOPE]] }
// CHECK-SIL: string_literal utf8 "MacroUser/macro_expand.swift", loc "@__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX{{.*}}_12customFileIDfMf_.swift":1:1, scope [[MACRO_SCOPE]]
// CHECK-IR-DAG: !DISubprogram(name: "customFileID", linkageName: "$s9MacroUser0023macro_expandswift_elFCffMX{{.*}}_12customFileIDfMf_"

// CHECK: Builtin result is MacroUser/macro_expand.swift
// CHECK-AST: macro_expansion_expr type='String'{{.*}}name=line
print("Builtin result is \(#fileID)")
print(
// CHECK-IR-DAG: ![[L1:[0-9]+]] = distinct !DILocation(line: [[@LINE+3]], column: 5
// CHECK-IR-DAG: ![[L2:[0-9]+]] = distinct !DILocation({{.*}}inlinedAt: ![[L1]])
// CHECK-IR-DAG: !DIFile(filename: "{{.*}}@__swiftmacro_9MacroUser10testFileID1a1bySi_SitF06customdE0fMf_.swift", {{.*}}source: "{{.*}}MacroUser/macro_expand.swift{{.*}}// original-source-range: {{.*}}")
// CHECK-IR-DAG: !DIFile(filename: "{{.*}}@__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX{{.*}}_12customFileIDfMf_.swift", {{.*}}source: "{{.*}}MacroUser/macro_expand.swift{{.*}}// original-source-range: {{.*}}")
#addBlocker(
#stringify(a - b)
)
Expand Down Expand Up @@ -278,7 +278,7 @@ func testNested() {
_ = #stringify(#assertAny(Nested()))
// expected-note@-1 {{in expansion of macro 'stringify' here}}
// CHECK-DIAGS-NOT: error: cannot convert value of type 'Nested' to expected argument type 'Bool'
// CHECK-DIAGS: @__swiftmacro_9MacroUser10testNestedyyF9stringifyfMf_9assertAnyfMf_.swift:1:8: error: cannot convert value of type 'Nested' to expected argument type 'Bool'
// CHECK-DIAGS: @__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX{{.*}}_9stringifyfMf_9assertAnyfMf_.swift:1:8: error: cannot convert value of type 'Nested' to expected argument type 'Bool'
// CHECK-DIAGS-NOT: error: cannot convert value of type 'Nested' to expected argument type 'Bool'

// PRETTY-DIAGS: 1:8: error: cannot convert value of type 'Nested' to expected argument type 'Bool'
Expand All @@ -299,7 +299,7 @@ func testStringifyWithThrows() throws {
// FIXME: Lots of duplicate notes here
_ = #stringify(maybeThrowing()) // expected-note 4{{in expansion of macro 'stringify' here}}

// CHECK-DIAGS: @__swiftmacro_9MacroUser23testStringifyWithThrowsyyKF9stringifyfMf1_.swift:1:2: error: call can throw but is not marked with 'try'
// CHECK-DIAGS: @__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX{{.*}}_9stringifyfMf1_.swift:1:2: error: call can throw but is not marked with 'try'
#endif

// The macro adds the 'try' for us.
Expand Down Expand Up @@ -328,8 +328,8 @@ func testAddBlocker(a: Int, b: Int, c: Int, oa: OnlyAdds) {
// expected-note@-1{{in expansion of macro 'addBlocker' here}}
// expected-note@-2{{use '-'}}{{22-23=-}}

// CHECK-DIAGS: @__swiftmacro_9MacroUser14testAddBlocker1a1b1c2oaySi_S2iAA8OnlyAddsVtF03addE0fMf1_.swift:1:4: error: binary operator '-' cannot be applied to two 'OnlyAdds' operands [] []
// CHECK-DIAGS: CONTENTS OF FILE @__swiftmacro_9MacroUser14testAddBlocker1a1b1c2oaySi_S2iAA8OnlyAddsVtF03addE0fMf1_.swift:
// CHECK-DIAGS: @__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX{{.*}}_10addBlockerfMf1_.swift:1:4: error: binary operator '-' cannot be applied to two 'OnlyAdds' operands [] []
// CHECK-DIAGS: CONTENTS OF FILE @__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX{{.*}}_10addBlockerfMf1_.swift:
// CHECK-DIAGS-NEXT: Original source range: {{.*}}macro_expand.swift:[[@LINE-6]]:7 - {{.*}}macro_expand.swift:[[@LINE-6]]:27
// CHECK-DIAGS-NEXT: oa - oa
// CHECK-DIAGS-NEXT: END CONTENTS OF FILE
Expand Down Expand Up @@ -373,7 +373,7 @@ func testNestedDeclInExpr() {
macro defineDeclsWithKnownNames() = #externalMacro(module: "MacroDefinition", type: "DefineDeclsWithKnownNamesMacro")

// Freestanding macros are not in inlined scopes.
// CHECK-SIL: sil_scope {{.*}} { loc "@__swiftmacro_9MacroUser016testFreestandingA9ExpansionyyF4Foo2L_V25defineDeclsWithKnownNamesfMf_.swift"{{.*}} -> Int }
// CHECK-SIL: sil_scope {{.*}} { loc "@__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX{{.*}}_25defineDeclsWithKnownNamesfMf_.swift"{{.*}} -> Int }

// FIXME: Macros producing arbitrary names are not supported yet
#if false
Expand Down Expand Up @@ -436,10 +436,10 @@ func testFreestandingMacroExpansion() {
struct Foo3 {
#bitwidthNumberedStructs("BUG", blah: false)
// expected-note@-1 4{{in expansion of macro 'bitwidthNumberedStructs' here}}
// CHECK-DIAGS: CONTENTS OF FILE @__swiftmacro_9MacroUser016testFreestandingA9ExpansionyyF4Foo3L_V23bitwidthNumberedStructsfMf_.swift
// CHECK-DIAGS: CONTENTS OF FILE @__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX{{.*}}_23bitwidthNumberedStructsfMf_.swift
// CHECK-DIAGS: struct BUG {
// CHECK-DIAGS: func $s9MacroUser016testFreestandingA9ExpansionyyF4Foo3L_V23bitwidthNumberedStructsfMf_6methodfMu_()
// CHECK-DIAGS: func $s9MacroUser016testFreestandingA9ExpansionyyF4Foo3L_V23bitwidthNumberedStructsfMf_6methodfMu0{{_?}}()
// CHECK-DIAGS: func $s9MacroUser0023macro_expandswift_elFCffMX{{.*}}_23bitwidthNumberedStructsfMf_6methodfMu_()
// CHECK-DIAGS: func $s9MacroUser0023macro_expandswift_elFCffMX{{.*}}_23bitwidthNumberedStructsfMf_6methodfMu0{{_?}}()
}
#endif

Expand Down
6 changes: 3 additions & 3 deletions test/Macros/macro_expand_closure.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ func multiStatementInference() -> Int {

// The closure intruduced by the macro expansion should not contain any inline
// locations, but instead point directly into the macro buffer.
// CHECK-SIL: sil_scope [[S0:[0-9]+]] { loc "@__swiftmacro_9MacroUser23multiStatementInferenceSiyF0cD0fMf_.swift":1:1 parent @$s9MacroUser23multiStatementInferenceSiyFSiyXEfU_
// CHECK-SIL: sil_scope [[S2:[0-9]+]] { loc "@__swiftmacro_9MacroUser23multiStatementInferenceSiyF0cD0fMf_.swift":2:14 parent [[S0]] }
// CHECK-SIL: sil_scope [[S0:[0-9]+]] { loc "@__swiftmacro_9MacroUser0031macro_expand_closureswift_yFFIifMX16_2_14multiStatementfMf_.swift":1:1 parent @$s9MacroUser23multiStatementInferenceSiyFSiyXEfU_
// CHECK-SIL: sil_scope [[S2:[0-9]+]] { loc "@__swiftmacro_9MacroUser0031macro_expand_closureswift_yFFIifMX16_2_14multiStatementfMf_.swift":2:14 parent [[S0]] }

// CHECK-SIL: sil {{.*}} @$s9MacroUser23multiStatementInferenceSiyFSiyXEfU_
// CHECK-SIL-NOT: return
// CHECK-SIL: %0 = integer_literal $Builtin.Int{{64|32}}, 10, loc "@__swiftmacro_9MacroUser23multiStatementInferenceSiyF0cD0fMf_.swift":2:14, scope [[S2]]
// CHECK-SIL: %0 = integer_literal $Builtin.Int{{64|32}}, 10, loc "@__swiftmacro_9MacroUser0031macro_expand_closureswift_yFFIifMX16_2_14multiStatementfMf_.swift":2:14, scope [[S2]]

// CHECK: 10
print(multiStatementInference())
2 changes: 1 addition & 1 deletion test/Macros/macro_expand_codeitems.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func testFreestandingMacroExpansion() {
// CHECK: from stmt
// CHECK: from usedInExpandedStmt
// CHECK: from expr
// CHECK-DIAGS: struct $s9MacroUser016testFreestandingA9ExpansionyyF9codeItemsfMf_3foofMu_ {
// CHECK-DIAGS: struct $s9MacroUser0033macro_expand_codeitemsswift_DbGHjfMX25_2_9codeItemsfMf_3foofMu_ {
// CHECK-DIAGS: END CONTENTS OF FILE
#codeItems

Expand Down
7 changes: 5 additions & 2 deletions test/Macros/skip_non_exportable_decls.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
@freestanding(declaration)
macro anonymousTypes(public: Bool = false, causeErrors: Bool = false, _: () -> String) = #externalMacro(module: "MacroDefinition", type: "DefineAnonymousTypesMacro")

// CHECK: sil @$s9MacroUser03$s9A70User33_B2D49A1BE4DC7AF5CC327EB8EE2214BDLl14anonymousTypesfMf_4namefMu_C5helloSSyF : $@convention(method) (@guaranteed $s9MacroUser33_B2D49A1BE4DC7AF5CC327EB8EE2214BDLl14anonymousTypesfMf_4namefMu_) -> @owned String {
// CHECK: sil @$s9MacroUser03$s9A118User0036skip_non_exportable_declsswift_tjBBlfMX14_0_33_B2D49A1BE4DC7AF5CC327EB8EE2214BDLl14anonymousTypesfMf_4namefMu_C5helloSSyF : $@convention(method) (@guaranteed $s9MacroUser0036skip_non_exportable_declsswift_tjBBlfMX14_0_33_B2D49A1BE4DC7AF5CC327EB8EE2214BDLl14anonymousTypesfMf_4namefMu_) -> @owned String {

#anonymousTypes(public: true) { "hello" }

// CHECK-NOT: s9MacroUser03$s9A71User33_B2D49A1BE4DC7AF5CC327EB8EE2214BDLl14anonymousTypesfMf_4namefMu0_O5helloSSyF
#anonymousTypes(public: false) { "goodbye" }

// FIXME: Changing 'public: false' to 'public: true' above doesn't seem to
// have any effect on the generated SIL. Perhaps there is a bug here.
Loading