[llvm-commits] [123875] Clear llvm bytecode from asm_out_file after reading PCH.

dpatel at apple.com dpatel at apple.com
Wed Feb 14 14:42:10 PST 2007


Revision: 123875
Author:   dpatel
Date:     2007-02-14 14:42:10 -0800 (Wed, 14 Feb 2007)

Log Message:
-----------
Clear llvm bytecode from asm_out_file after reading PCH.

Modified Paths:
--------------
    apple-local/branches/llvm/gcc/llvm-backend.cpp
    apple-local/branches/llvm/gcc/toplev.c

Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-backend.cpp	2007-02-14 21:54:21 UTC (rev 123874)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp	2007-02-14 22:42:10 UTC (rev 123875)
@@ -195,6 +195,7 @@
     delete TheModule;
 
   fclose (asm_out_file);
+  
   std::string ErrMsg;
   TheModule = ParseBytecodeFile(asm_file_name,
                                 Compressor::decompressToNewBuffer,
@@ -205,6 +206,12 @@
     exit(1);
   }
 
+  // Reopen asm_out_file for the rest of the compiler's use.
+  // This also removes llvm byte code from the asm_out_file.
+  asm_out_file = fopen (asm_file_name, "w+b");
+  if (asm_out_file == 0)
+    fatal_error ("can%'t open %s for writing: %m", asm_file_name);
+
   // Read LLVM Types string table
   readLLVMTypesStringTable();
   flag_llvm_pch_read = 1;

Modified: apple-local/branches/llvm/gcc/toplev.c
===================================================================
--- apple-local/branches/llvm/gcc/toplev.c	2007-02-14 21:54:21 UTC (rev 123874)
+++ apple-local/branches/llvm/gcc/toplev.c	2007-02-14 22:42:10 UTC (rev 123875)
@@ -2279,13 +2279,6 @@
 	unlink (asm_file_name2);
       else if (fclose (asm_out_file) != 0)
 	/* APPLE LOCAL end ss2 */
-        /* APPLE LOCAL begin LLVM */
-#ifdef ENABLE_LLVM
-        /* While reading bytecodes from PCH file, asm_out_file was already 
-           closed by llvm-backend.  */
-        if (!flag_llvm_pch_read)
-#endif
-          /* APPLE LOCAL end LLVM */
 	fatal_error ("error closing %s: %m", asm_file_name);
     }
 





More information about the llvm-commits mailing list