From: Martin Storsjo Date: Fri, 30 Aug 2019 06:55:54 +0000 (+0000) Subject: [WindowsResource] Avoid duplicating the input filenames for each resource. NFC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6ae1da9e67978462ae32a8203f69b5d1be8d4b7f;p=llvm [WindowsResource] Avoid duplicating the input filenames for each resource. NFC. Differential Revision: https://reviews.llvm.org/D66821 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370434 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Object/WindowsResource.cpp b/lib/Object/WindowsResource.cpp index 762e8bc81d8..5b09ce3a68a 100644 --- a/lib/Object/WindowsResource.cpp +++ b/lib/Object/WindowsResource.cpp @@ -219,6 +219,8 @@ Error WindowsResourceParser::parse(WindowsResource *WR, } ResourceEntryRef Entry = EntryOrErr.get(); + uint32_t Origin = InputFilenames.size(); + InputFilenames.push_back(WR->getFileName()); bool End = false; while (!End) { Data.push_back(Entry.getData()); @@ -226,10 +228,9 @@ Error WindowsResourceParser::parse(WindowsResource *WR, bool IsNewTypeString = false; bool IsNewNameString = false; - TreeNode* Node; - bool IsNewNode = Root.addEntry(Entry, InputFilenames.size(), - IsNewTypeString, IsNewNameString, Node); - InputFilenames.push_back(WR->getFileName()); + TreeNode *Node; + bool IsNewNode = + Root.addEntry(Entry, Origin, IsNewTypeString, IsNewNameString, Node); if (!IsNewNode) { Duplicates.push_back(makeDuplicateResourceError( Entry, InputFilenames[Node->Origin], WR->getFileName()));