mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 20:29:53 +00:00
LTO: Use a common LibLTOCodeGenerator::init, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266538 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fcbd2d6ed3
commit
9c9a101118
@ -119,16 +119,18 @@ static void handleLibLTODiagnostic(lto_codegen_diagnostic_severity_t Severity,
|
||||
// libLTO API semantics, which require that the code generator owns the object
|
||||
// file.
|
||||
struct LibLTOCodeGenerator : LTOCodeGenerator {
|
||||
LibLTOCodeGenerator() : LTOCodeGenerator(*LTOContext) {
|
||||
setDiagnosticHandler(handleLibLTODiagnostic, nullptr); }
|
||||
LibLTOCodeGenerator() : LTOCodeGenerator(*LTOContext) { init(); }
|
||||
LibLTOCodeGenerator(std::unique_ptr<LLVMContext> Context)
|
||||
: LTOCodeGenerator(*Context), OwnedContext(std::move(Context)) {
|
||||
setDiagnosticHandler(handleLibLTODiagnostic, nullptr); }
|
||||
init();
|
||||
}
|
||||
|
||||
// Reset the module first in case MergedModule is created in OwnedContext.
|
||||
// Module must be destructed before its context gets destructed.
|
||||
~LibLTOCodeGenerator() { resetMergedModule(); }
|
||||
|
||||
void init() { setDiagnosticHandler(handleLibLTODiagnostic, nullptr); }
|
||||
|
||||
std::unique_ptr<MemoryBuffer> NativeObjectFile;
|
||||
std::unique_ptr<LLVMContext> OwnedContext;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user