1
Fork 0

Handle removal of llvm::make_unique()

This commit is contained in:
Nikita Popov 2019-12-31 14:08:25 +01:00
parent 3ec3aa72d4
commit 30ec68a545
4 changed files with 17 additions and 2 deletions

View file

@ -89,7 +89,11 @@ extern "C" void LLVMRustDestroyArchive(LLVMRustArchiveRef RustArchive) {
extern "C" LLVMRustArchiveIteratorRef extern "C" LLVMRustArchiveIteratorRef
LLVMRustArchiveIteratorNew(LLVMRustArchiveRef RustArchive) { LLVMRustArchiveIteratorNew(LLVMRustArchiveRef RustArchive) {
Archive *Archive = RustArchive->getBinary(); Archive *Archive = RustArchive->getBinary();
#if LLVM_VERSION_GE(10, 0)
std::unique_ptr<Error> Err = std::make_unique<Error>(Error::success());
#else
std::unique_ptr<Error> Err = llvm::make_unique<Error>(Error::success()); std::unique_ptr<Error> Err = llvm::make_unique<Error>(Error::success());
#endif
auto Cur = Archive->child_begin(*Err); auto Cur = Archive->child_begin(*Err);
if (*Err) { if (*Err) {
LLVMRustSetLastError(toString(std::move(*Err)).c_str()); LLVMRustSetLastError(toString(std::move(*Err)).c_str());

View file

@ -18,8 +18,7 @@ extern "C" RustLinker*
LLVMRustLinkerNew(LLVMModuleRef DstRef) { LLVMRustLinkerNew(LLVMModuleRef DstRef) {
Module *Dst = unwrap(DstRef); Module *Dst = unwrap(DstRef);
auto Ret = llvm::make_unique<RustLinker>(*Dst); return new RustLinker(*Dst);
return Ret.release();
} }
extern "C" void extern "C" void

View file

@ -863,7 +863,11 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
int num_modules, int num_modules,
const char **preserved_symbols, const char **preserved_symbols,
int num_symbols) { int num_symbols) {
#if LLVM_VERSION_GE(10, 0)
auto Ret = std::make_unique<LLVMRustThinLTOData>();
#else
auto Ret = llvm::make_unique<LLVMRustThinLTOData>(); auto Ret = llvm::make_unique<LLVMRustThinLTOData>();
#endif
// Load each module's summary and merge it into one combined index // Load each module's summary and merge it into one combined index
for (int i = 0; i < num_modules; i++) { for (int i = 0; i < num_modules; i++) {
@ -1095,7 +1099,11 @@ struct LLVMRustThinLTOBuffer {
extern "C" LLVMRustThinLTOBuffer* extern "C" LLVMRustThinLTOBuffer*
LLVMRustThinLTOBufferCreate(LLVMModuleRef M) { LLVMRustThinLTOBufferCreate(LLVMModuleRef M) {
#if LLVM_VERSION_GE(10, 0)
auto Ret = std::make_unique<LLVMRustThinLTOBuffer>();
#else
auto Ret = llvm::make_unique<LLVMRustThinLTOBuffer>(); auto Ret = llvm::make_unique<LLVMRustThinLTOBuffer>();
#endif
{ {
raw_string_ostream OS(Ret->data); raw_string_ostream OS(Ret->data);
{ {

View file

@ -1450,7 +1450,11 @@ struct LLVMRustModuleBuffer {
extern "C" LLVMRustModuleBuffer* extern "C" LLVMRustModuleBuffer*
LLVMRustModuleBufferCreate(LLVMModuleRef M) { LLVMRustModuleBufferCreate(LLVMModuleRef M) {
#if LLVM_VERSION_GE(10, 0)
auto Ret = std::make_unique<LLVMRustModuleBuffer>();
#else
auto Ret = llvm::make_unique<LLVMRustModuleBuffer>(); auto Ret = llvm::make_unique<LLVMRustModuleBuffer>();
#endif
{ {
raw_string_ostream OS(Ret->data); raw_string_ostream OS(Ret->data);
{ {