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"
@@ -5550,6 +5551,17 @@ bool Serializer::allowCompilerErrors() const {
5550
5551
return getASTContext ().LangOpts .AllowModuleWithCompilerErrors ;
5551
5552
}
5552
5553
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
+
5553
5565
void swift::serializeToBuffers (
5554
5566
ModuleOrSourceFile DC, const SerializationOptions &options,
5555
5567
std::unique_ptr<llvm::MemoryBuffer> *moduleBuffer,
@@ -5573,6 +5585,7 @@ void swift::serializeToBuffers(
5573
5585
});
5574
5586
if (hadError)
5575
5587
return ;
5588
+ emitABIDescriptor (DC, options);
5576
5589
if (moduleBuffer)
5577
5590
*moduleBuffer = std::make_unique<llvm::SmallVectorMemoryBuffer>(
5578
5591
std::move (buf), options.OutputPath );
@@ -5677,4 +5690,5 @@ void swift::serialize(ModuleOrSourceFile DC,
5677
5690
symbolgraphgen::emitSymbolGraphForModule (M, SGOpts);
5678
5691
}
5679
5692
}
5693
+ emitABIDescriptor (DC, options);
5680
5694
}
0 commit comments