Skip to content

Commit ea4f20a

Browse files
authored
Merge pull request #39949 from nkcsgexi/wmo-abi-json
ABIChecker: teach wmo mode to emit ABI descriptor files
2 parents 60f3d61 + 495bd36 commit ea4f20a

File tree

2 files changed

+9
-38
lines changed

2 files changed

+9
-38
lines changed

lib/Frontend/FrontendOptions.cpp

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -567,45 +567,11 @@ bool FrontendOptions::canActionEmitModuleSemanticInfo(ActionType action) {
567567
llvm_unreachable("unhandled action");
568568
}
569569
bool FrontendOptions::canActionEmitABIDescriptor(ActionType action) {
570-
switch (action) {
571-
case ActionType::MergeModules:
572-
case ActionType::EmitModuleOnly:
573-
case ActionType::CompileModuleFromInterface:
570+
if (canActionEmitModule(action))
574571
return true;
575-
case ActionType::NoneAction:
576-
case ActionType::Parse:
577-
case ActionType::ResolveImports:
578-
case ActionType::Typecheck:
579-
case ActionType::DumpParse:
580-
case ActionType::DumpInterfaceHash:
581-
case ActionType::DumpAST:
582-
case ActionType::EmitSyntax:
583-
case ActionType::PrintAST:
584-
case ActionType::EmitPCH:
585-
case ActionType::DumpScopeMaps:
586-
case ActionType::DumpTypeRefinementContexts:
587-
case ActionType::DumpTypeInfo:
588-
case ActionType::EmitSILGen:
589-
case ActionType::TypecheckModuleFromInterface:
590-
case ActionType::Immediate:
591-
case ActionType::REPL:
592-
case ActionType::EmitPCM:
593-
case ActionType::DumpPCM:
594-
case ActionType::ScanDependencies:
595-
case ActionType::PrintVersion:
596-
case ActionType::PrintFeature:
597-
case ActionType::EmitSIL:
598-
case ActionType::EmitSIBGen:
599-
case ActionType::EmitSIB:
600-
case ActionType::EmitIRGen:
601-
case ActionType::EmitIR:
602-
case ActionType::EmitBC:
603-
case ActionType::EmitAssembly:
604-
case ActionType::EmitObject:
605-
case ActionType::EmitImportedModules:
606-
return false;
607-
}
608-
llvm_unreachable("unhandled action");
572+
if (action == ActionType::CompileModuleFromInterface)
573+
return true;
574+
return false;
609575
}
610576
bool FrontendOptions::canActionEmitModule(ActionType action) {
611577
switch (action) {

test/ModuleInterface/emit-abi-descriptor.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121

2222
// RUN: %FileCheck %s < %t/FooBar.json
2323

24+
// RUN: %target-swift-frontend -c -emit-module -emit-module-path %t/FooC.swiftmodule %t/Foo.swift -module-name Foo -emit-abi-descriptor-path %t/Foo-c.json -o %t/Foo.o
25+
26+
// RUN: %FileCheck %s < %t/Foo-c.json
27+
2428
// CHECK: "kind": "Root"
2529
// CHECK-NEXT: "name": "TopLevel"
2630
// CHECK-NEXT: "printedName": "TopLevel"
31+
// CHECK: "kind": "Function"

0 commit comments

Comments
 (0)