aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/WindowsResource.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2019-05-02 21:21:55 +0000
committerNico Weber <nicolasweber@gmx.de>2019-05-02 21:21:55 +0000
commit81862f82ee3dd6d7be5c441422734e10615acef8 (patch)
tree2ee927e662d8219e12adcbab049cfb34e0b34389 /llvm/lib/Object/WindowsResource.cpp
parent6e9cfee63a7e0a71167f8bff25123bf6b2e9853d (diff)
downloadllvm-81862f82ee3dd6d7be5c441422734e10615acef8.zip
llvm-81862f82ee3dd6d7be5c441422734e10615acef8.tar.gz
llvm-81862f82ee3dd6d7be5c441422734e10615acef8.tar.bz2
lld-link: Add /force:multipleres extension to make dupe resource diag non-fatal
As a side benefit, lld-link now reports more than one duplicate resource entry before exiting with an error even if the new flag is not passed. llvm-svn: 359829
Diffstat (limited to 'llvm/lib/Object/WindowsResource.cpp')
-rw-r--r--llvm/lib/Object/WindowsResource.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/Object/WindowsResource.cpp b/llvm/lib/Object/WindowsResource.cpp
index e841335..0fdbcc2 100644
--- a/llvm/lib/Object/WindowsResource.cpp
+++ b/llvm/lib/Object/WindowsResource.cpp
@@ -168,8 +168,8 @@ static bool convertUTF16LEToUTF8String(ArrayRef<UTF16> Src, std::string &Out) {
return convertUTF16ToUTF8String(makeArrayRef(EndianCorrectedSrc), Out);
}
-static Error makeDuplicateResourceError(const ResourceEntryRef &Entry,
- StringRef File1, StringRef File2) {
+static std::string makeDuplicateResourceError(
+ const ResourceEntryRef &Entry, StringRef File1, StringRef File2) {
std::string Ret;
raw_string_ostream OS(Ret);
@@ -197,10 +197,11 @@ static Error makeDuplicateResourceError(const ResourceEntryRef &Entry,
OS << "/language " << Entry.getLanguage() << ", in " << File1 << " and in "
<< File2;
- return make_error<GenericBinaryError>(OS.str(), object_error::parse_failed);
+ return OS.str();
}
-Error WindowsResourceParser::parse(WindowsResource *WR) {
+Error WindowsResourceParser::parse(WindowsResource *WR,
+ std::vector<std::string> &Duplicates) {
auto EntryOrErr = WR->getHeadEntry();
if (!EntryOrErr) {
auto E = EntryOrErr.takeError();
@@ -229,9 +230,10 @@ Error WindowsResourceParser::parse(WindowsResource *WR) {
bool IsNewNode = Root.addEntry(Entry, InputFilenames.size(),
IsNewTypeString, IsNewNameString, Node);
InputFilenames.push_back(WR->getFileName());
- if (!IsNewNode)
- return makeDuplicateResourceError(Entry, InputFilenames[Node->Origin],
- WR->getFileName());
+ if (!IsNewNode) {
+ Duplicates.push_back(makeDuplicateResourceError(
+ Entry, InputFilenames[Node->Origin], WR->getFileName()));
+ }
if (IsNewTypeString)
StringTable.push_back(Entry.getTypeString());