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"
@@ -5547,6 +5548,17 @@ bool Serializer::allowCompilerErrors() const {
5547
5548
return getASTContext ().LangOpts .AllowModuleWithCompilerErrors ;
5548
5549
}
5549
5550
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
+
5550
5562
void swift::serializeToBuffers (
5551
5563
ModuleOrSourceFile DC, const SerializationOptions &options,
5552
5564
std::unique_ptr<llvm::MemoryBuffer> *moduleBuffer,
@@ -5570,6 +5582,7 @@ void swift::serializeToBuffers(
5570
5582
});
5571
5583
if (hadError)
5572
5584
return ;
5585
+ emitABIDescriptor (DC, options);
5573
5586
if (moduleBuffer)
5574
5587
*moduleBuffer = std::make_unique<llvm::SmallVectorMemoryBuffer>(
5575
5588
std::move (buf), options.OutputPath );
@@ -5674,4 +5687,5 @@ void swift::serialize(ModuleOrSourceFile DC,
5674
5687
symbolgraphgen::emitSymbolGraphForModule (M, SGOpts);
5675
5688
}
5676
5689
}
5690
+ emitABIDescriptor (DC, options);
5677
5691
}
0 commit comments