mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-27 15:02:16 +00:00
LTO: Use a common LibLTOCodeGenerator::init, NFC
llvm-svn: 266538
This commit is contained in:
parent
0324d3a09d
commit
240c528f0c
@ -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
|
// libLTO API semantics, which require that the code generator owns the object
|
||||||
// file.
|
// file.
|
||||||
struct LibLTOCodeGenerator : LTOCodeGenerator {
|
struct LibLTOCodeGenerator : LTOCodeGenerator {
|
||||||
LibLTOCodeGenerator() : LTOCodeGenerator(*LTOContext) {
|
LibLTOCodeGenerator() : LTOCodeGenerator(*LTOContext) { init(); }
|
||||||
setDiagnosticHandler(handleLibLTODiagnostic, nullptr); }
|
|
||||||
LibLTOCodeGenerator(std::unique_ptr<LLVMContext> Context)
|
LibLTOCodeGenerator(std::unique_ptr<LLVMContext> Context)
|
||||||
: LTOCodeGenerator(*Context), OwnedContext(std::move(Context)) {
|
: LTOCodeGenerator(*Context), OwnedContext(std::move(Context)) {
|
||||||
setDiagnosticHandler(handleLibLTODiagnostic, nullptr); }
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
// Reset the module first in case MergedModule is created in OwnedContext.
|
// Reset the module first in case MergedModule is created in OwnedContext.
|
||||||
// Module must be destructed before its context gets destructed.
|
// Module must be destructed before its context gets destructed.
|
||||||
~LibLTOCodeGenerator() { resetMergedModule(); }
|
~LibLTOCodeGenerator() { resetMergedModule(); }
|
||||||
|
|
||||||
|
void init() { setDiagnosticHandler(handleLibLTODiagnostic, nullptr); }
|
||||||
|
|
||||||
std::unique_ptr<MemoryBuffer> NativeObjectFile;
|
std::unique_ptr<MemoryBuffer> NativeObjectFile;
|
||||||
std::unique_ptr<LLVMContext> OwnedContext;
|
std::unique_ptr<LLVMContext> OwnedContext;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user