Skip to content

Commit

Permalink
Handle removal of llvm::make_unique()
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Jan 7, 2020
1 parent 3ec3aa7 commit 30ec68a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/rustllvm/ArchiveWrapper.cpp
Expand Up @@ -89,7 +89,11 @@ extern "C" void LLVMRustDestroyArchive(LLVMRustArchiveRef RustArchive) {
extern "C" LLVMRustArchiveIteratorRef
LLVMRustArchiveIteratorNew(LLVMRustArchiveRef RustArchive) {
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());
#endif
auto Cur = Archive->child_begin(*Err);
if (*Err) {
LLVMRustSetLastError(toString(std::move(*Err)).c_str());
Expand Down
3 changes: 1 addition & 2 deletions src/rustllvm/Linker.cpp
Expand Up @@ -18,8 +18,7 @@ extern "C" RustLinker*
LLVMRustLinkerNew(LLVMModuleRef DstRef) {
Module *Dst = unwrap(DstRef);

auto Ret = llvm::make_unique<RustLinker>(*Dst);
return Ret.release();
return new RustLinker(*Dst);
}

extern "C" void
Expand Down
8 changes: 8 additions & 0 deletions src/rustllvm/PassWrapper.cpp
Expand Up @@ -863,7 +863,11 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
int num_modules,
const char **preserved_symbols,
int num_symbols) {
#if LLVM_VERSION_GE(10, 0)
auto Ret = std::make_unique<LLVMRustThinLTOData>();
#else
auto Ret = llvm::make_unique<LLVMRustThinLTOData>();
#endif

// Load each module's summary and merge it into one combined index
for (int i = 0; i < num_modules; i++) {
Expand Down Expand Up @@ -1095,7 +1099,11 @@ struct LLVMRustThinLTOBuffer {

extern "C" LLVMRustThinLTOBuffer*
LLVMRustThinLTOBufferCreate(LLVMModuleRef M) {
#if LLVM_VERSION_GE(10, 0)
auto Ret = std::make_unique<LLVMRustThinLTOBuffer>();
#else
auto Ret = llvm::make_unique<LLVMRustThinLTOBuffer>();
#endif
{
raw_string_ostream OS(Ret->data);
{
Expand Down
4 changes: 4 additions & 0 deletions src/rustllvm/RustWrapper.cpp
Expand Up @@ -1450,7 +1450,11 @@ struct LLVMRustModuleBuffer {

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

0 comments on commit 30ec68a

Please sign in to comment.