llvm-dwp: Simplify duplicate DWO ID error handling

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269805 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2016-05-17 19:40:28 +00:00
parent bd9d3e007e
commit 293233a048

View File

@ -372,13 +372,13 @@ std::string buildDWODescription(StringRef Name, StringRef DWPName, StringRef DWO
return Text;
}
std::string
buildDuplicateError(const std::pair<uint64_t, UnitIndexEntry> &PrevE,
const CompileUnitIdentifiers &ID, StringRef DWPName) {
return std::string("Duplicate DWO ID (") + utohexstr(PrevE.first) + ") in " +
buildDWODescription(PrevE.second.Name, PrevE.second.DWPName,
PrevE.second.DWOName) +
" and " + buildDWODescription(ID.Name, DWPName, ID.DWOName);
Error buildDuplicateError(const std::pair<uint64_t, UnitIndexEntry> &PrevE,
const CompileUnitIdentifiers &ID, StringRef DWPName) {
return make_error<DWPError>(
std::string("Duplicate DWO ID (") + utohexstr(PrevE.first) + ") in " +
buildDWODescription(PrevE.second.Name, PrevE.second.DWPName,
PrevE.second.DWOName) +
" and " + buildDWODescription(ID.Name, DWPName, ID.DWOName));
}
static Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
const auto &MCOFI = *Out.getContext().getObjectFileInfo();
@ -523,7 +523,7 @@ static Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
return EID.takeError();
const auto &ID = *EID;
if (!P.second)
return make_error<DWPError>(buildDuplicateError(*P.first, ID, Input));
return buildDuplicateError(*P.first, ID, Input);
auto &NewEntry = P.first->second;
NewEntry.Name = ID.Name;
NewEntry.DWOName = ID.DWOName;
@ -555,7 +555,7 @@ static Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
const auto &ID = *EID;
auto P = IndexEntries.insert(std::make_pair(ID.Signature, CurEntry));
if (!P.second)
return make_error<DWPError>(buildDuplicateError(*P.first, ID, ""));
return buildDuplicateError(*P.first, ID, "");
P.first->second.Name = ID.Name;
P.first->second.DWOName = ID.DWOName;
addAllTypes(Out, TypeIndexEntries, TypesSection, CurTypesSection,