[llvm-commits] [llvm] r120346 - /llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp

Chris Lattner sabre at nondot.org
Mon Nov 29 15:29:54 PST 2010


Author: lattner
Date: Mon Nov 29 17:29:54 2010
New Revision: 120346

URL: http://llvm.org/viewvc/llvm-project?rev=120346&view=rev
Log:
Generalize the darwin wrapper hack to work with generic macho triples as well as darwin ones.

Modified:
    llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp

Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=120346&r1=120345&r2=120346&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Mon Nov 29 17:29:54 2010
@@ -1642,9 +1642,12 @@
 /// WriteBitcodeToStream - Write the specified module to the specified output
 /// stream.
 void llvm::WriteBitcodeToStream(const Module *M, BitstreamWriter &Stream) {
-  // If this is darwin, emit a file header and trailer if needed.
-  bool isDarwin = M->getTargetTriple().find("-darwin") != std::string::npos;
-  if (isDarwin)
+  // If this is darwin or another generic macho target, emit a file header and
+  // trailer if needed.
+  bool isMacho =
+    M->getTargetTriple().find("-darwin") != std::string::npos ||
+    M->getTargetTriple().find("-macho") != std::string::npos;
+  if (isMacho)
     EmitDarwinBCHeader(Stream, M->getTargetTriple());
 
   // Emit the file header.
@@ -1658,6 +1661,6 @@
   // Emit the module.
   WriteModule(M, Stream);
 
-  if (isDarwin)
+  if (isMacho)
     EmitDarwinBCTrailer(Stream, Stream.getBuffer().size());
 }





More information about the llvm-commits mailing list