Index: llvm/tools/lto/lto.cpp =================================================================== --- llvm/tools/lto/lto.cpp +++ llvm/tools/lto/lto.cpp @@ -106,6 +106,7 @@ static LLVMContext Context; LTOContext = &Context; + LTOContext->setOpaquePointers(true); LTOContext->setDiagnosticHandler( std::make_unique(), true); initialized = true; @@ -133,7 +134,10 @@ // Module must be destructed before its context gets destructed. ~LibLTOCodeGenerator() { resetMergedModule(); } - void init() { setDiagnosticHandler(handleLibLTODiagnostic, nullptr); } + void init() { + OwnedContext->setOpaquePointers(true); + setDiagnosticHandler(handleLibLTODiagnostic, nullptr); + } std::unique_ptr NativeObjectFile; std::unique_ptr OwnedContext; @@ -271,6 +275,7 @@ // Create a local context. Ownership will be transferred to LTOModule. std::unique_ptr Context = std::make_unique(); + Context->setOpaquePointers(true); Context->setDiagnosticHandler(std::make_unique(), true);