[ThinLTO] Release files in gold plugin during combined index (take 2)
authorTeresa Johnson <tejohnson@google.com>
Thu, 10 Dec 2015 16:11:23 +0000 (16:11 +0000)
committerTeresa Johnson <tejohnson@google.com>
Thu, 10 Dec 2015 16:11:23 +0000 (16:11 +0000)
Ensure we release the files even when they don't hold a function index
summary section, by restructuring the control flow a little bit.

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

tools/gold/gold-plugin.cpp

index d73e949..e52606b 100644 (file)
@@ -855,10 +855,8 @@ static ld_plugin_status allSymbolsReadHook(raw_fd_ostream *ApiFile) {
           getFunctionIndexForFile(F, File);
 
       // Skip files without a function summary.
-      if (!Index)
-        continue;
-
-      CombinedIndex.mergeFrom(std::move(Index), ++NextModuleId);
+      if (Index)
+        CombinedIndex.mergeFrom(std::move(Index), ++NextModuleId);
 
       if (release_input_file(F.handle) != LDPS_OK)
         message(LDPL_FATAL, "Failed to release file information");