Unverified Commit 91d2f5af by hlu1 Committed by GitHub

[LLVM] Explicit llvm::StringRef to std::string conversion (#4859)

parent 31c2f979
......@@ -88,7 +88,7 @@ void CodeGenLLVM::InitTarget(llvm::TargetMachine* tm) {
native_vector_bits_ = 128;
} else {
native_vector_bits_ = 128;
std::string arch_name = tm->getTargetTriple().getArchName();
std::string arch_name = std::string(tm->getTargetTriple().getArchName());
LOG(WARNING) << "Set native vector bits to be 128 for " << arch_name;
}
}
......@@ -186,7 +186,7 @@ void CodeGenLLVM::HandleImport(const std::string& code) {
code.substr(code.length() - 3) == ".bc")) {
mlib = llvm::parseIRFile(code, err, *ctx_);
if (mlib.get() == nullptr) {
std::string msg = err.getMessage();
std::string msg = std::string(err.getMessage());
LOG(FATAL) << "Fail to load bitcode file " << code << "\n"
<< "line " << err.getLineNo() << ":" << msg;
}
......@@ -195,7 +195,7 @@ void CodeGenLLVM::HandleImport(const std::string& code) {
llvm::MemoryBuffer::getMemBuffer(code);
mlib = llvm::parseIR(*buf, err, *ctx_);
if (mlib.get() == nullptr) {
std::string msg = err.getMessage();
std::string msg = std::string(err.getMessage());
LOG(FATAL) << "Fail to load llvm ir "
<< "line " << err.getLineNo() << ":" << msg
<< "\ncontent:\n" << code;
......
......@@ -231,7 +231,7 @@ class LLVMModuleNode final : public runtime::ModuleNode {
llvm::SMDiagnostic err;
module_ = std::move(module);
if (module_ == nullptr) {
std::string msg = err.getMessage();
std::string msg = std::string(err.getMessage());
LOG(FATAL) << "Fail to load module: " << msg;
}
std::string target_;
......@@ -254,7 +254,7 @@ class LLVMModuleNode final : public runtime::ModuleNode {
llvm::SMDiagnostic err;
auto module = llvm::parseIRFile(file_name, err, *ctx);
if (module == nullptr) {
std::string msg = err.getMessage();
std::string msg = std::string(err.getMessage());
LOG(FATAL) << "Fail to load ir file " << file_name << "\n"
<< "line " << err.getLineNo() << ":" << msg;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment