Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for LLVM 10 upgrade #67900

Merged
merged 18 commits into from
Jan 13, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Handle removal of llvm::make_unique()
  • Loading branch information
nikic committed Jan 7, 2020
commit 30ec68a545ebc128ea8009186249b5b3616c3586
4 changes: 4 additions & 0 deletions src/rustllvm/ArchiveWrapper.cpp
Original file line number Diff line number Diff line change
@@ -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());
3 changes: 1 addition & 2 deletions src/rustllvm/Linker.cpp
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions src/rustllvm/PassWrapper.cpp
Original file line number Diff line number Diff line change
@@ -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++) {
@@ -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);
{
4 changes: 4 additions & 0 deletions src/rustllvm/RustWrapper.cpp
Original file line number Diff line number Diff line change
@@ -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);
{