mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #39387 from nkcsgexi/emit-module-emit-abi
Frontend: teach -emit-module and -merge-modules to emit ABI descriptor files
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include "swift/AST/SynthesizedFileUnit.h"
|
||||
#include "swift/AST/TypeCheckRequests.h"
|
||||
#include "swift/AST/TypeVisitor.h"
|
||||
#include "swift/APIDigester/ModuleAnalyzerNodes.h"
|
||||
#include "swift/Basic/Defer.h"
|
||||
#include "swift/Basic/Dwarf.h"
|
||||
#include "swift/Basic/FileSystem.h"
|
||||
@@ -5624,6 +5625,17 @@ bool Serializer::allowCompilerErrors() const {
|
||||
return getASTContext().LangOpts.AllowModuleWithCompilerErrors;
|
||||
}
|
||||
|
||||
|
||||
static void emitABIDescriptor(ModuleOrSourceFile DC,
|
||||
const SerializationOptions &options) {
|
||||
if (!options.ABIDescriptorPath.empty()) {
|
||||
if (DC.is<ModuleDecl*>()) {
|
||||
swift::ide::api::dumpModuleContent(DC.get<ModuleDecl*>(),
|
||||
options.ABIDescriptorPath, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void swift::serializeToBuffers(
|
||||
ModuleOrSourceFile DC, const SerializationOptions &options,
|
||||
std::unique_ptr<llvm::MemoryBuffer> *moduleBuffer,
|
||||
@@ -5647,6 +5659,7 @@ void swift::serializeToBuffers(
|
||||
});
|
||||
if (hadError)
|
||||
return;
|
||||
emitABIDescriptor(DC, options);
|
||||
if (moduleBuffer)
|
||||
*moduleBuffer = std::make_unique<llvm::SmallVectorMemoryBuffer>(
|
||||
std::move(buf), options.OutputPath);
|
||||
@@ -5751,4 +5764,5 @@ void swift::serialize(ModuleOrSourceFile DC,
|
||||
symbolgraphgen::emitSymbolGraphForModule(M, SGOpts);
|
||||
}
|
||||
}
|
||||
emitABIDescriptor(DC, options);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user