From e62d5682fb31285d836d97bbe35fc3b64a248d58 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Fri, 30 Aug 2019 06:55:54 +0000 Subject: [WindowsResource] Avoid duplicating the input filenames for each resource. NFC. Differential Revision: https://reviews.llvm.org/D66821 llvm-svn: 370434 --- llvm/lib/Object/WindowsResource.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Object/WindowsResource.cpp') diff --git a/llvm/lib/Object/WindowsResource.cpp b/llvm/lib/Object/WindowsResource.cpp index 762e8bc..5b09ce3 100644 --- a/llvm/lib/Object/WindowsResource.cpp +++ b/llvm/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())); -- cgit v1.1