llvm-dwp: Simplify duplicate DWO ID error handling

llvm-svn: 269805
This commit is contained in:
David Blaikie 2016-05-17 19:40:28 +00:00
parent e15ef2f609
commit 11825c7237
1 changed files with 9 additions and 9 deletions

View File

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