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"
@@ -5550,6 +5551,17 @@ bool Serializer::allowCompilerErrors() const {
55505551 return getASTContext ().LangOpts .AllowModuleWithCompilerErrors ;
55515552}
55525553
5554+
5555+ static void emitABIDescriptor (ModuleOrSourceFile DC,
5556+ const SerializationOptions &options) {
5557+ if (!options.ABIDescriptorPath .empty ()) {
5558+ if (DC.is <ModuleDecl*>()) {
5559+ swift::ide::api::dumpModuleContent (DC.get <ModuleDecl*>(),
5560+ options.ABIDescriptorPath , true );
5561+ }
5562+ }
5563+ }
5564+
55535565void swift::serializeToBuffers (
55545566 ModuleOrSourceFile DC, const SerializationOptions &options,
55555567 std::unique_ptr<llvm::MemoryBuffer> *moduleBuffer,
@@ -5573,6 +5585,7 @@ void swift::serializeToBuffers(
55735585 });
55745586 if (hadError)
55755587 return ;
5588+ emitABIDescriptor (DC, options);
55765589 if (moduleBuffer)
55775590 *moduleBuffer = std::make_unique<llvm::SmallVectorMemoryBuffer>(
55785591 std::move (buf), options.OutputPath );
@@ -5677,4 +5690,5 @@ void swift::serialize(ModuleOrSourceFile DC,
56775690 symbolgraphgen::emitSymbolGraphForModule (M, SGOpts);
56785691 }
56795692 }
5693+ emitABIDescriptor (DC, options);
56805694}
0 commit comments