Skip to content

Commit 326fc7b

Browse files
committed
Add back llvm::make_unique uses for older versions
1 parent 1b15b7f commit 326fc7b

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

src/rustllvm/ArchiveWrapper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ extern "C" void LLVMRustDestroyArchive(LLVMRustArchiveRef RustArchive) {
8989
extern "C" LLVMRustArchiveIteratorRef
9090
LLVMRustArchiveIteratorNew(LLVMRustArchiveRef RustArchive) {
9191
Archive *Archive = RustArchive->getBinary();
92+
#if LLVM_VERSION_GE(10, 0)
9293
std::unique_ptr<Error> Err = std::make_unique<Error>(Error::success());
94+
#else
95+
std::unique_ptr<Error> Err = llvm::make_unique<Error>(Error::success());
96+
#endif
9397
auto Cur = Archive->child_begin(*Err);
9498
if (*Err) {
9599
LLVMRustSetLastError(toString(std::move(*Err)).c_str());

src/rustllvm/Linker.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ extern "C" RustLinker*
1818
LLVMRustLinkerNew(LLVMModuleRef DstRef) {
1919
Module *Dst = unwrap(DstRef);
2020

21-
auto Ret = std::make_unique<RustLinker>(*Dst);
22-
return Ret.release();
21+
return new RustLinker(*Dst);
2322
}
2423

2524
extern "C" void

src/rustllvm/PassWrapper.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,11 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
863863
int num_modules,
864864
const char **preserved_symbols,
865865
int num_symbols) {
866+
#if LLVM_VERSION_GE(10, 0)
866867
auto Ret = std::make_unique<LLVMRustThinLTOData>();
868+
#else
869+
auto Ret = llvm::make_unique<LLVMRustThinLTOData>();
870+
#endif
867871

868872
// Load each module's summary and merge it into one combined index
869873
for (int i = 0; i < num_modules; i++) {
@@ -1105,7 +1109,11 @@ struct LLVMRustThinLTOBuffer {
11051109

11061110
extern "C" LLVMRustThinLTOBuffer*
11071111
LLVMRustThinLTOBufferCreate(LLVMModuleRef M) {
1112+
#if LLVM_VERSION_GE(10, 0)
11081113
auto Ret = std::make_unique<LLVMRustThinLTOBuffer>();
1114+
#else
1115+
auto Ret = llvm::make_unique<LLVMRustThinLTOBuffer>();
1116+
#endif
11091117
{
11101118
raw_string_ostream OS(Ret->data);
11111119
{

src/rustllvm/RustWrapper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,7 +1477,11 @@ struct LLVMRustModuleBuffer {
14771477

14781478
extern "C" LLVMRustModuleBuffer*
14791479
LLVMRustModuleBufferCreate(LLVMModuleRef M) {
1480+
#if LLVM_VERSION_GE(10, 0)
14801481
auto Ret = std::make_unique<LLVMRustModuleBuffer>();
1482+
#else
1483+
auto Ret = llvm::make_unique<LLVMRustModuleBuffer>();
1484+
#endif
14811485
{
14821486
raw_string_ostream OS(Ret->data);
14831487
{

0 commit comments

Comments
 (0)