[lld] r250055 - Remove explicit Twine instantiation if possible.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 12 08:49:06 PDT 2015
Author: ruiu
Date: Mon Oct 12 10:49:06 2015
New Revision: 250055
URL: http://llvm.org/viewvc/llvm-project?rev=250055&view=rev
Log:
Remove explicit Twine instantiation if possible.
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/InputFiles.cpp
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/ELF/Target.cpp
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=250055&r1=250054&r2=250055&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Mon Oct 12 10:49:06 2015
@@ -81,7 +81,7 @@ void LinkerDriver::addFile(StringRef Pat
if (Config->Verbose)
llvm::outs() << Path << "\n";
auto MBOrErr = MemoryBuffer::getFile(Path);
- error(MBOrErr, Twine("cannot open ") + Path);
+ error(MBOrErr, "cannot open " + Path);
std::unique_ptr<MemoryBuffer> &MB = *MBOrErr;
MemoryBufferRef MBRef = MB->getMemBufferRef();
OwningMBs.push_back(std::move(MB)); // take MB ownership
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=250055&r1=250054&r2=250055&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Mon Oct 12 10:49:06 2015
@@ -231,15 +231,14 @@ void ArchiveFile::parse() {
// Returns a buffer pointing to a member file containing a given symbol.
MemoryBufferRef ArchiveFile::getMember(const Archive::Symbol *Sym) {
ErrorOr<Archive::child_iterator> ItOrErr = Sym->getMember();
- error(ItOrErr,
- Twine("Could not get the member for symbol ") + Sym->getName());
+ error(ItOrErr, "Could not get the member for symbol " + Sym->getName());
Archive::child_iterator It = *ItOrErr;
if (!Seen.insert(It->getChildOffset()).second)
return MemoryBufferRef();
ErrorOr<MemoryBufferRef> Ret = It->getMemoryBufferRef();
- error(Ret, Twine("Could not get the buffer for the member defining symbol ") +
+ error(Ret, "Could not get the buffer for the member defining symbol " +
Sym->getName());
return *Ret;
}
@@ -250,9 +249,8 @@ std::vector<MemoryBufferRef> ArchiveFile
std::vector<MemoryBufferRef> Result;
for (const Archive::Child &Child : File->children()) {
ErrorOr<MemoryBufferRef> MbOrErr = Child.getMemoryBufferRef();
- error(MbOrErr,
- Twine("Could not get the buffer for a child of the archive ") +
- File->getFileName());
+ error(MbOrErr, "Could not get the buffer for a child of the archive " +
+ File->getFileName());
Result.push_back(MbOrErr.get());
}
return Result;
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=250055&r1=250054&r2=250055&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Mon Oct 12 10:49:06 2015
@@ -192,7 +192,7 @@ void LinkerScript::readGroup() {
void LinkerScript::readInclude() {
StringRef Tok = next();
auto MBOrErr = MemoryBuffer::getFile(Tok);
- error(MBOrErr, Twine("cannot open ") + Tok);
+ error(MBOrErr, "cannot open " + Tok);
std::unique_ptr<MemoryBuffer> &MB = *MBOrErr;
StringRef S = Saver.save(MB->getMemBufferRef().getBuffer());
std::vector<StringRef> V = tokenize(S);
Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=250055&r1=250054&r2=250055&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Mon Oct 12 10:49:06 2015
@@ -82,7 +82,7 @@ void X86TargetInfo::relocateOne(uint8_t
add32le(Loc, SymVA);
break;
default:
- error(Twine("unrecognized reloc ") + Twine(Type));
+ error("unrecognized reloc " + Twine(Type));
break;
}
}
@@ -193,7 +193,7 @@ void X86_64TargetInfo::relocateOne(uint8
break;
}
default:
- error(Twine("unrecognized reloc ") + Twine(Type));
+ error("unrecognized reloc " + Twine(Type));
break;
}
}
@@ -228,7 +228,7 @@ void PPC64TargetInfo::relocateOne(uint8_
// We don't create a TOC yet.
break;
default:
- error(Twine("unrecognized reloc ") + Twine(Type));
+ error("unrecognized reloc " + Twine(Type));
break;
}
}
@@ -340,7 +340,7 @@ void AArch64TargetInfo::relocateOne(uint
break;
}
default:
- error(Twine("unrecognized reloc ") + Twine(Type));
+ error("unrecognized reloc " + Twine(Type));
break;
}
}
@@ -373,7 +373,7 @@ void MipsTargetInfo::relocateOne(uint8_t
add32le(Buf + Rel.r_offset, SymVA);
break;
default:
- error(Twine("unrecognized reloc ") + Twine(Type));
+ error("unrecognized reloc " + Twine(Type));
break;
}
}
More information about the llvm-commits
mailing list