]> granicus.if.org Git - llvm/commitdiff
[WindowsResource] Avoid duplicating the input filenames for each resource. NFC.
authorMartin Storsjo <martin@martin.st>
Fri, 30 Aug 2019 06:55:54 +0000 (06:55 +0000)
committerMartin Storsjo <martin@martin.st>
Fri, 30 Aug 2019 06:55:54 +0000 (06:55 +0000)
Differential Revision: https://reviews.llvm.org/D66821

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370434 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Object/WindowsResource.cpp

index 762e8bc81d85322d183edad9a528d36bf933b8be..5b09ce3a68aa876a692617e1b18b4db36075f340 100644 (file)
@@ -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()));