[PATCH] D66821: [07/10] [WindowsResource] Avoid duplicating the input filenames for each resource. NFC.

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 12:10:29 PDT 2019


mstorsjo created this revision.
mstorsjo added reviewers: thakis, rnk, ruiu.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66821

Files:
  llvm/lib/Object/WindowsResource.cpp


Index: llvm/lib/Object/WindowsResource.cpp
===================================================================
--- llvm/lib/Object/WindowsResource.cpp
+++ llvm/lib/Object/WindowsResource.cpp
@@ -219,6 +219,8 @@
   }
 
   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 @@
     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()));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66821.217469.patch
Type: text/x-patch
Size: 1010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190827/e7227d8b/attachment.bin>


More information about the llvm-commits mailing list