3636#include " swift/AST/SynthesizedFileUnit.h"
3737#include " swift/AST/TypeCheckRequests.h"
3838#include " swift/AST/TypeVisitor.h"
39+ #include " swift/APIDigester/ModuleAnalyzerNodes.h"
3940#include " swift/Basic/Defer.h"
4041#include " swift/Basic/Dwarf.h"
4142#include " swift/Basic/FileSystem.h"
@@ -5547,6 +5548,17 @@ bool Serializer::allowCompilerErrors() const {
55475548 return getASTContext ().LangOpts .AllowModuleWithCompilerErrors ;
55485549}
55495550
5551+
5552+ static void emitABIDescriptor (ModuleOrSourceFile DC,
5553+ const SerializationOptions &options) {
5554+ if (!options.ABIDescriptorPath .empty ()) {
5555+ if (DC.is <ModuleDecl*>()) {
5556+ swift::ide::api::dumpModuleContent (DC.get <ModuleDecl*>(),
5557+ options.ABIDescriptorPath , true );
5558+ }
5559+ }
5560+ }
5561+
55505562void swift::serializeToBuffers (
55515563 ModuleOrSourceFile DC, const SerializationOptions &options,
55525564 std::unique_ptr<llvm::MemoryBuffer> *moduleBuffer,
@@ -5570,6 +5582,7 @@ void swift::serializeToBuffers(
55705582 });
55715583 if (hadError)
55725584 return ;
5585+ emitABIDescriptor (DC, options);
55735586 if (moduleBuffer)
55745587 *moduleBuffer = std::make_unique<llvm::SmallVectorMemoryBuffer>(
55755588 std::move (buf), options.OutputPath );
@@ -5674,4 +5687,5 @@ void swift::serialize(ModuleOrSourceFile DC,
56745687 symbolgraphgen::emitSymbolGraphForModule (M, SGOpts);
56755688 }
56765689 }
5690+ emitABIDescriptor (DC, options);
56775691}
0 commit comments