gollvm: sync with LLVM trunk at r369531
Sync with trunk, primarily replacing llvm::make_unique with
std::make_unique.
Fixes golang/go#33782.
Change-Id: I16f2e828042859903e673be0327ae5f6c5d420f3
Reviewed-on: https://go-review.googlesource.com/c/gollvm/+/191139
Reviewed-by: Cherry Zhang <cherryyz@google.com>
diff --git a/bridge/go-backend.cpp b/bridge/go-backend.cpp
index cf3a7ef..ba880bf 100644
--- a/bridge/go-backend.cpp
+++ b/bridge/go-backend.cpp
@@ -63,11 +63,10 @@
for (llvm::object::section_iterator si = obj->section_begin(),
se = obj->section_end(); si != se; ++si) {
llvm::object::SectionRef sref = *si;
- llvm::StringRef sname;
- std::error_code error = sref.getName(sname);
- if (error)
+ llvm::Expected<llvm::StringRef> sname = sref.getName();
+ if (! sname)
break;
- if (sname == GO_EXPORT_SECTION_NAME) {
+ if (*sname == GO_EXPORT_SECTION_NAME) {
// Extract section of interest
llvm::Expected<llvm::StringRef> bytes = sref.getContents();
if (! bytes) {
diff --git a/driver-main/llvm-goc.cpp b/driver-main/llvm-goc.cpp
index 3970074..411083d 100644
--- a/driver-main/llvm-goc.cpp
+++ b/driver-main/llvm-goc.cpp
@@ -150,7 +150,7 @@
auto llvmargs = args_.getAllArgValues(gollvm::options::OPT_mllvm);
if (! llvmargs.empty()) {
unsigned nargs = llvmargs.size();
- auto args = llvm::make_unique<const char*[]>(nargs + 2);
+ auto args = std::make_unique<const char*[]>(nargs + 2);
args[0] = "gollvm (LLVM option parsing)";
for (unsigned i = 0; i != nargs; ++i)
args[i + 1] = llvmargs[i].c_str();
diff --git a/driver/Compilation.cpp b/driver/Compilation.cpp
index 34c5c3f..ac0291e 100644
--- a/driver/Compilation.cpp
+++ b/driver/Compilation.cpp
@@ -134,10 +134,10 @@
const char *executable,
llvm::opt::ArgStringList &args)
{
- ownedCommands_.push_back(llvm::make_unique<Command>(srcAction,
- creatingTool,
- executable,
- args));
+ ownedCommands_.push_back(std::make_unique<Command>(srcAction,
+ creatingTool,
+ executable,
+ args));
commands_.push_back(ownedCommands_.back().get());
}
diff --git a/driver/CompileGo.cpp b/driver/CompileGo.cpp
index e3fa441..c0c5caa 100644
--- a/driver/CompileGo.cpp
+++ b/driver/CompileGo.cpp
@@ -313,8 +313,8 @@
// Open output file.
std::error_code EC;
sys::fs::OpenFlags OpenFlags = sys::fs::F_Text;
- auto FDOut = llvm::make_unique<ToolOutputFile>(asmOutFileName_, EC,
- OpenFlags);
+ auto FDOut = std::make_unique<ToolOutputFile>(asmOutFileName_, EC,
+ OpenFlags);
if (EC) {
errs() << progname_ << ": error opening " << asmOutFileName_ << ": "
<< EC.message() << '\n';
@@ -432,16 +432,16 @@
if (fnamearg != nullptr) {
StringRef fname = fnamearg->getValue();
std::error_code EC;
- optRecordFile_ = llvm::make_unique<llvm::ToolOutputFile>(
+ optRecordFile_ = std::make_unique<llvm::ToolOutputFile>(
fname, EC, llvm::sys::fs::F_None);
if (EC) {
errs() << "error: unable to open file '"
<< fname << "' to emit optimization remarks\n";
return false;
}
- context_.setRemarkStreamer(llvm::make_unique<llvm::RemarkStreamer>(
+ context_.setRemarkStreamer(std::make_unique<llvm::RemarkStreamer>(
fname,
- llvm::make_unique<llvm::remarks::YAMLRemarkSerializer>(optRecordFile_->os(),
+ std::make_unique<llvm::remarks::YAMLRemarkSerializer>(optRecordFile_->os(),
llvm::remarks::SerializerMode::Separate)));
if (! sampleProfileFile_.empty())
context_.setDiagnosticsHotnessRequested(true);
@@ -580,7 +580,8 @@
{
// Set up the LLVM context
context_.setDiagnosticHandler(
- llvm::make_unique<BEDiagnosticHandler>(&this->hasError_, this->remarkCtl_));
+ std::make_unique<BEDiagnosticHandler>(&this->hasError_,
+ this->remarkCtl_));
llvm::Optional<unsigned> enable_gc =
driver_.getLastArgAsInteger(gollvm::options::OPT_enable_gc_EQ, 0u);
diff --git a/driver/Driver.cpp b/driver/Driver.cpp
index 8323881..62c62dd 100644
--- a/driver/Driver.cpp
+++ b/driver/Driver.cpp
@@ -301,7 +301,7 @@
if (!tc) {
switch (triple_.getOS()) {
case Triple::Linux:
- tc = make_unique<toolchains::Linux>(*this, triple_);
+ tc = std::make_unique<toolchains::Linux>(*this, triple_);
break;
default:
errs() << progname_ << ": error: unsupported target "
diff --git a/driver/GollvmOptions.cpp b/driver/GollvmOptions.cpp
index 859ef21..4455b1a 100644
--- a/driver/GollvmOptions.cpp
+++ b/driver/GollvmOptions.cpp
@@ -40,7 +40,7 @@
}
std::unique_ptr<OptTable> createGollvmDriverOptTable() {
- auto Result = llvm::make_unique<DriverOptTable>();
+ auto Result = std::make_unique<DriverOptTable>();
return std::move(Result);
}
diff --git a/libgo/godumpspec/godumpspec.cpp b/libgo/godumpspec/godumpspec.cpp
index 68507d4..edf7705 100644
--- a/libgo/godumpspec/godumpspec.cpp
+++ b/libgo/godumpspec/godumpspec.cpp
@@ -1265,8 +1265,8 @@
std::unique_ptr<ToolOutputFile> OutputFile;
if (!OutputFilename.empty()) {
std::error_code EC;
- OutputFile = llvm::make_unique<ToolOutputFile>(OutputFilename, EC,
- sys::fs::F_None);
+ OutputFile = std::make_unique<ToolOutputFile>(OutputFilename, EC,
+ sys::fs::F_None);
// Don't remove output file if we exit with an error.
OutputFile->keep();
error("Unable to open output file" + OutputFilename, EC);