36
36
#include " swift/AST/SynthesizedFileUnit.h"
37
37
#include " swift/AST/TypeCheckRequests.h"
38
38
#include " swift/AST/TypeVisitor.h"
39
+ #include " swift/APIDigester/ModuleAnalyzerNodes.h"
39
40
#include " swift/Basic/Defer.h"
40
41
#include " swift/Basic/Dwarf.h"
41
42
#include " swift/Basic/FileSystem.h"
@@ -5624,6 +5625,17 @@ bool Serializer::allowCompilerErrors() const {
5624
5625
return getASTContext ().LangOpts .AllowModuleWithCompilerErrors ;
5625
5626
}
5626
5627
5628
+
5629
+ static void emitABIDescriptor (ModuleOrSourceFile DC,
5630
+ const SerializationOptions &options) {
5631
+ if (!options.ABIDescriptorPath .empty ()) {
5632
+ if (DC.is <ModuleDecl*>()) {
5633
+ swift::ide::api::dumpModuleContent (DC.get <ModuleDecl*>(),
5634
+ options.ABIDescriptorPath , true );
5635
+ }
5636
+ }
5637
+ }
5638
+
5627
5639
void swift::serializeToBuffers (
5628
5640
ModuleOrSourceFile DC, const SerializationOptions &options,
5629
5641
std::unique_ptr<llvm::MemoryBuffer> *moduleBuffer,
@@ -5647,6 +5659,7 @@ void swift::serializeToBuffers(
5647
5659
});
5648
5660
if (hadError)
5649
5661
return ;
5662
+ emitABIDescriptor (DC, options);
5650
5663
if (moduleBuffer)
5651
5664
*moduleBuffer = std::make_unique<llvm::SmallVectorMemoryBuffer>(
5652
5665
std::move (buf), options.OutputPath );
@@ -5751,4 +5764,5 @@ void swift::serialize(ModuleOrSourceFile DC,
5751
5764
symbolgraphgen::emitSymbolGraphForModule (M, SGOpts);
5752
5765
}
5753
5766
}
5767
+ emitABIDescriptor (DC, options);
5754
5768
}
0 commit comments