From 40c732cc52a5c71cead461646667ef5b13801923 Mon Sep 17 00:00:00 2001 From: Misha Brukman Date: Fri, 4 Jun 2004 21:11:51 +0000 Subject: [PATCH] * No more CachedWriter::setStream() * ostream is back to being a reference instead of a pointer * Output single characters as chars, not as length-1 strings git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14030 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/AsmWriter.cpp | 99 +++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 52 deletions(-) diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 4e4dde7d6fc..aec653e4149 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -346,7 +346,7 @@ static std::ostream &printTypeInt(std::ostream &Out, const Type *Ty, /// std::ostream &llvm::WriteTypeSymbolic(std::ostream &Out, const Type *Ty, const Module *M) { - Out << " "; + Out << ' '; // If they want us to print out a type, attempt to make it symbolic if there // is a symbol table in the module... @@ -434,9 +434,9 @@ static void WriteConstantInt(std::ostream &Out, const Constant *CV, Out << "\""; } else { // Cannot output in string format... - Out << "["; + Out << '['; if (CA->getNumOperands()) { - Out << " "; + Out << ' '; printTypeInt(Out, ETy, TypeTable); WriteAsOperandInternal(Out, CA->getOperand(0), PrintName, TypeTable, Machine); @@ -450,9 +450,9 @@ static void WriteConstantInt(std::ostream &Out, const Constant *CV, Out << " ]"; } } else if (const ConstantStruct *CS = dyn_cast(CV)) { - Out << "{"; + Out << '{'; if (CS->getNumOperands()) { - Out << " "; + Out << ' '; printTypeInt(Out, CS->getOperand(0)->getType(), TypeTable); WriteAsOperandInternal(Out, CS->getOperand(0), @@ -488,7 +488,7 @@ static void WriteConstantInt(std::ostream &Out, const Constant *CV, Out << " to "; printTypeInt(Out, CE->getType(), TypeTable); } - Out << ")"; + Out << ')'; } else { Out << ""; @@ -504,7 +504,7 @@ static void WriteAsOperandInternal(std::ostream &Out, const Value *V, bool PrintName, std::map &TypeTable, SlotMachine *Machine) { - Out << " "; + Out << ' '; if (PrintName && V->hasName()) { Out << getLLVMName(V->getName()); } else { @@ -526,7 +526,7 @@ static void WriteAsOperandInternal(std::ostream &Out, const Value *V, Slot = Machine->getSlot(V); delete Machine; } - Out << "%" << Slot; + Out << '%' << Slot; } } } @@ -631,7 +631,7 @@ std::ostream &AssemblyWriter::printTypeAtLeastOneLevel(const Type *Ty) { if (FTy->getNumParams()) *Out << ", "; *Out << "..."; } - *Out << ")"; + *Out << ')'; } else if (const StructType *STy = dyn_cast(Ty)) { *Out << "{ "; for (StructType::element_iterator I = STy->element_begin(), @@ -642,10 +642,10 @@ std::ostream &AssemblyWriter::printTypeAtLeastOneLevel(const Type *Ty) { } *Out << " }"; } else if (const PointerType *PTy = dyn_cast(Ty)) { - printType(PTy->getElementType()) << "*"; + printType(PTy->getElementType()) << '*'; } else if (const ArrayType *ATy = dyn_cast(Ty)) { - *Out << "[" << ATy->getNumElements() << " x "; - printType(ATy->getElementType()) << "]"; + *Out << '[' << ATy->getNumElements() << " x "; + printType(ATy->getElementType()) << ']'; } else if (const OpaqueType *OTy = dyn_cast(Ty)) { *Out << "opaque"; } else { @@ -659,7 +659,7 @@ std::ostream &AssemblyWriter::printTypeAtLeastOneLevel(const Type *Ty) { void AssemblyWriter::writeOperand(const Value *Operand, bool PrintType, bool PrintName) { - if (PrintType) { *Out << " "; printType(Operand->getType()); } + if (PrintType) { *Out << ' '; printType(Operand->getType()); } WriteAsOperandInternal(*Out, Operand, PrintName, TypeNames, &Machine); } @@ -780,12 +780,12 @@ void AssemblyWriter::printFunction(const Function *F) { case GlobalValue::ExternalLinkage: break; } - printType(F->getReturnType()) << " "; + printType(F->getReturnType()) << ' '; if (!F->getName().empty()) *Out << getLLVMName(F->getName()); else *Out << "\"\""; - *Out << "("; + *Out << '('; Machine.incorporateFunction(F); // Loop over the arguments, printing them... @@ -799,7 +799,7 @@ void AssemblyWriter::printFunction(const Function *F) { if (FT->getNumParams()) *Out << ", "; *Out << "..."; // Output varargs portion of signature! } - *Out << ")"; + *Out << ')'; if (F->isExternal()) { *Out << "\n"; @@ -828,14 +828,14 @@ void AssemblyWriter::printArgument(const Argument *Arg) { // Output name, if available... if (Arg->hasName()) - *Out << " " << getLLVMName(Arg->getName()); + *Out << ' ' << getLLVMName(Arg->getName()); } /// printBasicBlock - This member is called for each basic block in a method. /// void AssemblyWriter::printBasicBlock(const BasicBlock *BB) { if (BB->hasName()) { // Print out the label if it exists... - *Out << "\n" << BB->getName() << ":"; + *Out << "\n" << BB->getName() << ':'; } else if (!BB->use_empty()) { // Don't print block # of no uses... *Out << "\n;