Print the module ID as a comment.
authorChris Lattner <sabre@nondot.org>
Wed, 2 Mar 2005 23:12:40 +0000 (23:12 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 2 Mar 2005 23:12:40 +0000 (23:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20411 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/AsmWriter.cpp

index b42ccc1847154fbd05f4bc8a13c065509225f294..692f8aa38d6c2a8ec5e1689f7eb6d7bf4560f493 100644 (file)
@@ -765,6 +765,12 @@ void AssemblyWriter::writeOperand(const Value *Operand, bool PrintType,
 
 
 void AssemblyWriter::printModule(const Module *M) {
+  if (!M->getModuleIdentifier().empty() &&
+      // Don't print hte ID if it will start a new line (which would 
+      // require a comment char before it).
+      M->getModuleIdentifier().find('\n') == std::string::npos)
+    Out << "; ModuleID = '" << M->getModuleIdentifier() << "'\n";
+
   switch (M->getEndianness()) {
   case Module::LittleEndian: Out << "target endian = little\n"; break;
   case Module::BigEndian:    Out << "target endian = big\n";    break;