Don't produce output only if *all* files are unused.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 14 Jun 2010 21:20:52 +0000 (21:20 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 14 Jun 2010 21:20:52 +0000 (21:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105962 91177308-0d34-0410-b5e6-96231b3b80d8

tools/gold/gold-plugin.cpp

index 2b055a2272feeac55acc4c8ef349b12c5b094ff2..15df7d031526f06d0407fbc81a6b15c409bd6724 100644 (file)
@@ -368,15 +368,15 @@ static ld_plugin_status all_symbols_read_hook(void) {
           api_file << I->syms[i].name << "\n";
       }
     }
+  }
 
-    if (options::generate_api_file)
-      api_file.close();
+  if (options::generate_api_file)
+    api_file.close();
 
-    if (!anySymbolsPreserved) {
-      // This entire file is unnecessary!
-      lto_codegen_dispose(cg);
-      return LDPS_OK;
-    }
+  if (!anySymbolsPreserved) {
+    // All of the IL is unnecessary!
+    lto_codegen_dispose(cg);
+    return LDPS_OK;
   }
 
   lto_codegen_set_pic_model(cg, output_type);