Skip to content

Commit

Permalink
[LLVM] Explicit llvm::StringRef to std::string conversion (#4859)
Browse files Browse the repository at this point in the history
  • Loading branch information
hlu1 authored Feb 11, 2020
1 parent 31c2f97 commit 91d2f5a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/target/llvm/codegen_llvm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/target/llvm/llvm_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand All @@ -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;
}
Expand Down

0 comments on commit 91d2f5a

Please sign in to comment.