These methods are inlined
[oota-llvm.git] / lib / VMCore / AsmWriter.cpp
index 0c4a1f78267c36b6b2c4e804cae4d6447dcb0404..0b10218ca40e2bfda5dd3e5a597b801d04032dfd 100644 (file)
@@ -518,6 +518,9 @@ static void WriteConstantInt(std::ostream &Out, const Constant *CV,
   } else if (isa<ConstantPointerNull>(CV)) {
     Out << "null";
 
+  } else if (isa<UndefValue>(CV)) {
+    Out << "undef";
+
   } else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
     Out << CE->getOpcodeName() << " (";
     
@@ -668,7 +671,7 @@ public:
 
   const Module* getModule() { return TheModule; }
 
-private :
+private:
   void printModule(const Module *M);
   void printSymbolTable(const SymbolTable &ST);
   void printConstant(const Constant *CPV);
@@ -764,21 +767,21 @@ void AssemblyWriter::printModule(const Module *M) {
   if (!M->getTargetTriple().empty())
     Out << "target triple = \"" << M->getTargetTriple() << "\"\n";
   
-  // Loop over the dependent libraries and emit them
-  Module::lib_iterator LI= M->lib_begin();
-  Module::lib_iterator LE= M->lib_end();
+  // Loop over the dependent libraries and emit them.
+  Module::lib_iterator LI = M->lib_begin();
+  Module::lib_iterator LE = M->lib_end();
   if (LI != LE) {
-    Out << "deplibs = [\n";
-    while ( LI != LE ) {
-      Out << "\"" << *LI << "\"";
+    Out << "deplibs = [ ";
+    while (LI != LE) {
+      Out << '"' << *LI << '"';
       ++LI;
-      if ( LI != LE )
-        Out << ",\n";
+      if (LI != LE)
+        Out << ", ";
     }
     Out << " ]\n";
   }
-  
-  // Loop over the symbol table, emitting all named constants...
+
+  // Loop over the symbol table, emitting all named constants.
   printSymbolTable(M->getSymbolTable());
   
   for (Module::const_giterator I = M->gbegin(), E = M->gend(); I != E; ++I)
@@ -786,7 +789,7 @@ void AssemblyWriter::printModule(const Module *M) {
 
   Out << "\nimplementation   ; Functions:\n";
   
-  // Output all of the functions...
+  // Output all of the functions.
   for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
     printFunction(I);
 }
@@ -803,6 +806,9 @@ void AssemblyWriter::printGlobal(const GlobalVariable *GV) {
     case GlobalValue::WeakLinkage:      Out << "weak "; break;
     case GlobalValue::AppendingLinkage: Out << "appending "; break;
     case GlobalValue::ExternalLinkage: break;
+    case GlobalValue::GhostLinkage:
+      std::cerr << "GhostLinkage not allowed in AsmWriter!\n";
+      abort();
     }
 
   Out << (GV->isConstant() ? "constant " : "global ");
@@ -884,6 +890,9 @@ void AssemblyWriter::printFunction(const Function *F) {
     case GlobalValue::WeakLinkage:      Out << "weak "; break;
     case GlobalValue::AppendingLinkage: Out << "appending "; break;
     case GlobalValue::ExternalLinkage: break;
+    case GlobalValue::GhostLinkage:
+      std::cerr << "GhostLinkage not allowed in AsmWriter!\n";
+      abort();
     }
 
   printType(F->getReturnType()) << ' ';