Write out single characters as chars, not strings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20179 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Misha Brukman
2005-02-14 18:52:35 +00:00
parent f54e9cb739
commit b70aaa62b6
2 changed files with 134 additions and 134 deletions

View File

@ -287,7 +287,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
// Check to see if the type is named. // Check to see if the type is named.
if (!IgnoreName || isa<OpaqueType>(Ty)) { if (!IgnoreName || isa<OpaqueType>(Ty)) {
std::map<const Type *, std::string>::iterator I = TypeNames.find(Ty); std::map<const Type *, std::string>::iterator I = TypeNames.find(Ty);
if (I != TypeNames.end()) return Out << I->second << " " << NameSoFar; if (I != TypeNames.end()) return Out << I->second << ' ' << NameSoFar;
} }
switch (Ty->getTypeID()) { switch (Ty->getTypeID()) {
@ -307,7 +307,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
} else if (!MTy->getNumParams()) { } else if (!MTy->getNumParams()) {
FunctionInnards << "void"; FunctionInnards << "void";
} }
FunctionInnards << ")"; FunctionInnards << ')';
std::string tstr = FunctionInnards.str(); std::string tstr = FunctionInnards.str();
printType(Out, MTy->getReturnType(), tstr); printType(Out, MTy->getReturnType(), tstr);
return Out; return Out;
@ -322,7 +322,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
printType(Out, *I, "field" + utostr(Idx++)); printType(Out, *I, "field" + utostr(Idx++));
Out << ";\n"; Out << ";\n";
} }
return Out << "}"; return Out << '}';
} }
case Type::PointerTyID: { case Type::PointerTyID: {
@ -348,7 +348,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
std::string TyName = "struct opaque_" + itostr(Count++); std::string TyName = "struct opaque_" + itostr(Count++);
assert(TypeNames.find(Ty) == TypeNames.end()); assert(TypeNames.find(Ty) == TypeNames.end());
TypeNames[Ty] = TyName; TypeNames[Ty] = TyName;
return Out << TyName << " " << NameSoFar; return Out << TyName << ' ' << NameSoFar;
} }
default: default:
assert(0 && "Unhandled case in getTypeProps!"); assert(0 && "Unhandled case in getTypeProps!");
@ -372,7 +372,7 @@ void CWriter::printConstantArray(ConstantArray *CPA) {
isString = false; isString = false;
if (isString) { if (isString) {
Out << "\""; Out << '\"';
// Keep track of whether the last number was a hexadecimal escape // Keep track of whether the last number was a hexadecimal escape
bool LastWasHex = false; bool LastWasHex = false;
@ -411,11 +411,11 @@ void CWriter::printConstantArray(ConstantArray *CPA) {
} }
} }
} }
Out << "\""; Out << '\"';
} else { } else {
Out << "{"; Out << '{';
if (CPA->getNumOperands()) { if (CPA->getNumOperands()) {
Out << " "; Out << ' ';
printConstant(cast<Constant>(CPA->getOperand(0))); printConstant(cast<Constant>(CPA->getOperand(0)));
for (unsigned i = 1, e = CPA->getNumOperands(); i != e; ++i) { for (unsigned i = 1, e = CPA->getNumOperands(); i != e; ++i) {
Out << ", "; Out << ", ";
@ -468,9 +468,9 @@ void CWriter::printConstant(Constant *CPV) {
case Instruction::Cast: case Instruction::Cast:
Out << "(("; Out << "((";
printType(Out, CPV->getType()); printType(Out, CPV->getType());
Out << ")"; Out << ')';
printConstant(CE->getOperand(0)); printConstant(CE->getOperand(0));
Out << ")"; Out << ')';
return; return;
case Instruction::GetElementPtr: case Instruction::GetElementPtr:
@ -480,13 +480,13 @@ void CWriter::printConstant(Constant *CPV) {
Out << "))"; Out << "))";
return; return;
case Instruction::Select: case Instruction::Select:
Out << "("; Out << '(';
printConstant(CE->getOperand(0)); printConstant(CE->getOperand(0));
Out << "?"; Out << '?';
printConstant(CE->getOperand(1)); printConstant(CE->getOperand(1));
Out << ":"; Out << ':';
printConstant(CE->getOperand(2)); printConstant(CE->getOperand(2));
Out << ")"; Out << ')';
return; return;
case Instruction::Add: case Instruction::Add:
case Instruction::Sub: case Instruction::Sub:
@ -504,7 +504,7 @@ void CWriter::printConstant(Constant *CPV) {
case Instruction::SetGE: case Instruction::SetGE:
case Instruction::Shl: case Instruction::Shl:
case Instruction::Shr: case Instruction::Shr:
Out << "("; Out << '(';
printConstant(CE->getOperand(0)); printConstant(CE->getOperand(0));
switch (CE->getOpcode()) { switch (CE->getOpcode()) {
case Instruction::Add: Out << " + "; break; case Instruction::Add: Out << " + "; break;
@ -526,7 +526,7 @@ void CWriter::printConstant(Constant *CPV) {
default: assert(0 && "Illegal opcode here!"); default: assert(0 && "Illegal opcode here!");
} }
printConstant(CE->getOperand(1)); printConstant(CE->getOperand(1));
Out << ")"; Out << ')';
return; return;
default: default:
@ -543,7 +543,7 @@ void CWriter::printConstant(Constant *CPV) {
switch (CPV->getType()->getTypeID()) { switch (CPV->getType()->getTypeID()) {
case Type::BoolTyID: case Type::BoolTyID:
Out << (CPV == ConstantBool::False ? "0" : "1"); break; Out << (CPV == ConstantBool::False ? '0' : '1'); break;
case Type::SByteTyID: case Type::SByteTyID:
case Type::ShortTyID: case Type::ShortTyID:
Out << cast<ConstantSInt>(CPV)->getValue(); break; Out << cast<ConstantSInt>(CPV)->getValue(); break;
@ -564,7 +564,7 @@ void CWriter::printConstant(Constant *CPV) {
case Type::UShortTyID: case Type::UShortTyID:
Out << cast<ConstantUInt>(CPV)->getValue(); break; Out << cast<ConstantUInt>(CPV)->getValue(); break;
case Type::UIntTyID: case Type::UIntTyID:
Out << cast<ConstantUInt>(CPV)->getValue() << "u"; break; Out << cast<ConstantUInt>(CPV)->getValue() << 'u'; break;
case Type::ULongTyID: case Type::ULongTyID:
Out << cast<ConstantUInt>(CPV)->getValue() << "ull"; break; Out << cast<ConstantUInt>(CPV)->getValue() << "ull"; break;
@ -576,7 +576,7 @@ void CWriter::printConstant(Constant *CPV) {
// Because of FP precision problems we must load from a stack allocated // Because of FP precision problems we must load from a stack allocated
// value that holds the value in hex. // value that holds the value in hex.
Out << "(*(" << (FPC->getType() == Type::FloatTy ? "float" : "double") Out << "(*(" << (FPC->getType() == Type::FloatTy ? "float" : "double")
<< "*)&FPConstant" << I->second << ")"; << "*)&FPConstant" << I->second << ')';
} else { } else {
if (IsNAN(FPC->getValue())) { if (IsNAN(FPC->getValue())) {
// The value is NaN // The value is NaN
@ -607,7 +607,7 @@ void CWriter::printConstant(Constant *CPV) {
<< Buffer << "\") /*nan*/ "; << Buffer << "\") /*nan*/ ";
} else if (IsInf(FPC->getValue())) { } else if (IsInf(FPC->getValue())) {
// The value is Inf // The value is Inf
if (FPC->getValue() < 0) Out << "-"; if (FPC->getValue() < 0) Out << '-';
Out << "LLVM_INF" << (FPC->getType() == Type::FloatTy ? "F" : "") Out << "LLVM_INF" << (FPC->getType() == Type::FloatTy ? "F" : "")
<< " /*inf*/ "; << " /*inf*/ ";
} else { } else {
@ -629,9 +629,9 @@ void CWriter::printConstant(Constant *CPV) {
case Type::ArrayTyID: case Type::ArrayTyID:
if (isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV)) { if (isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV)) {
const ArrayType *AT = cast<ArrayType>(CPV->getType()); const ArrayType *AT = cast<ArrayType>(CPV->getType());
Out << "{"; Out << '{';
if (AT->getNumElements()) { if (AT->getNumElements()) {
Out << " "; Out << ' ';
Constant *CZ = Constant::getNullValue(AT->getElementType()); Constant *CZ = Constant::getNullValue(AT->getElementType());
printConstant(CZ); printConstant(CZ);
for (unsigned i = 1, e = AT->getNumElements(); i != e; ++i) { for (unsigned i = 1, e = AT->getNumElements(); i != e; ++i) {
@ -648,9 +648,9 @@ void CWriter::printConstant(Constant *CPV) {
case Type::StructTyID: case Type::StructTyID:
if (isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV)) { if (isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV)) {
const StructType *ST = cast<StructType>(CPV->getType()); const StructType *ST = cast<StructType>(CPV->getType());
Out << "{"; Out << '{';
if (ST->getNumElements()) { if (ST->getNumElements()) {
Out << " "; Out << ' ';
printConstant(Constant::getNullValue(ST->getElementType(0))); printConstant(Constant::getNullValue(ST->getElementType(0)));
for (unsigned i = 1, e = ST->getNumElements(); i != e; ++i) { for (unsigned i = 1, e = ST->getNumElements(); i != e; ++i) {
Out << ", "; Out << ", ";
@ -659,9 +659,9 @@ void CWriter::printConstant(Constant *CPV) {
} }
Out << " }"; Out << " }";
} else { } else {
Out << "{"; Out << '{';
if (CPV->getNumOperands()) { if (CPV->getNumOperands()) {
Out << " "; Out << ' ';
printConstant(cast<Constant>(CPV->getOperand(0))); printConstant(cast<Constant>(CPV->getOperand(0)));
for (unsigned i = 1, e = CPV->getNumOperands(); i != e; ++i) { for (unsigned i = 1, e = CPV->getNumOperands(); i != e; ++i) {
Out << ", "; Out << ", ";
@ -693,9 +693,9 @@ void CWriter::writeOperandInternal(Value *Operand) {
if (Instruction *I = dyn_cast<Instruction>(Operand)) if (Instruction *I = dyn_cast<Instruction>(Operand))
if (isInlinableInst(*I) && !isDirectAlloca(I)) { if (isInlinableInst(*I) && !isDirectAlloca(I)) {
// Should we inline this instruction to build a tree? // Should we inline this instruction to build a tree?
Out << "("; Out << '(';
visit(*I); visit(*I);
Out << ")"; Out << ')';
return; return;
} }
@ -714,7 +714,7 @@ void CWriter::writeOperand(Value *Operand) {
writeOperandInternal(Operand); writeOperandInternal(Operand);
if (isa<GlobalVariable>(Operand) || isDirectAlloca(Operand)) if (isa<GlobalVariable>(Operand) || isDirectAlloca(Operand))
Out << ")"; Out << ')';
} }
// generateCompilerSpecificCode - This is where we add conditional compilation // generateCompilerSpecificCode - This is where we add conditional compilation
@ -980,7 +980,7 @@ void CWriter::printFloatingPointConstants(Function &F) {
assert(0 && "Unknown float type!"); assert(0 && "Unknown float type!");
} }
Out << "\n"; Out << '\n';
} }
@ -1005,7 +1005,7 @@ void CWriter::printModuleTypes(const SymbolTable &ST) {
TypeNames.insert(std::make_pair(STy, Name)); TypeNames.insert(std::make_pair(STy, Name));
} }
Out << "\n"; Out << '\n';
// Now we can print out typedefs... // Now we can print out typedefs...
Out << "/* Typedefs */\n"; Out << "/* Typedefs */\n";
@ -1017,7 +1017,7 @@ void CWriter::printModuleTypes(const SymbolTable &ST) {
Out << ";\n"; Out << ";\n";
} }
Out << "\n"; Out << '\n';
// Keep track of which structures have been printed so far... // Keep track of which structures have been printed so far...
std::set<const StructType *> StructPrinted; std::set<const StructType *> StructPrinted;
@ -1072,7 +1072,7 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
std::stringstream FunctionInnards; std::stringstream FunctionInnards;
// Print out the name... // Print out the name...
FunctionInnards << Mang->getValueName(F) << "("; FunctionInnards << Mang->getValueName(F) << '(';
if (!F->isExternal()) { if (!F->isExternal()) {
if (!F->aempty()) { if (!F->aempty()) {
@ -1108,7 +1108,7 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
} else if (!FT->isVarArg() && FT->getNumParams() == 0) { } else if (!FT->isVarArg() && FT->getNumParams() == 0) {
FunctionInnards << "void"; // ret() -> ret(void) in C. FunctionInnards << "void"; // ret() -> ret(void) in C.
} }
FunctionInnards << ")"; FunctionInnards << ')';
// Print out the return type and the entire signature for that matter // Print out the return type and the entire signature for that matter
printType(Out, F->getReturnType(), FunctionInnards.str()); printType(Out, F->getReturnType(), FunctionInnards.str());
} }
@ -1136,7 +1136,7 @@ void CWriter::printFunction(Function &F) {
} }
} }
Out << "\n"; Out << '\n';
if (F.hasExternalLinkage() && F.getName() == "main") if (F.hasExternalLinkage() && F.getName() == "main")
printCodeForMain(); printCodeForMain();
@ -1225,7 +1225,7 @@ void CWriter::visitReturnInst(ReturnInst &I) {
Out << " return"; Out << " return";
if (I.getNumOperands()) { if (I.getNumOperands()) {
Out << " "; Out << ' ';
writeOperand(I.getOperand(0)); writeOperand(I.getOperand(0));
} }
Out << ";\n"; Out << ";\n";
@ -1362,9 +1362,9 @@ void CWriter::visitBinaryOperator(Instruction &I) {
switch (I.getOpcode()) { switch (I.getOpcode()) {
case Instruction::Add: Out << " + "; break; case Instruction::Add: Out << " + "; break;
case Instruction::Sub: Out << " - "; break; case Instruction::Sub: Out << " - "; break;
case Instruction::Mul: Out << "*"; break; case Instruction::Mul: Out << '*'; break;
case Instruction::Div: Out << "/"; break; case Instruction::Div: Out << '/'; break;
case Instruction::Rem: Out << "%"; break; case Instruction::Rem: Out << '%'; break;
case Instruction::And: Out << " & "; break; case Instruction::And: Out << " & "; break;
case Instruction::Or: Out << " | "; break; case Instruction::Or: Out << " | "; break;
case Instruction::Xor: Out << " ^ "; break; case Instruction::Xor: Out << " ^ "; break;
@ -1388,14 +1388,14 @@ void CWriter::visitBinaryOperator(Instruction &I) {
void CWriter::visitCastInst(CastInst &I) { void CWriter::visitCastInst(CastInst &I) {
if (I.getType() == Type::BoolTy) { if (I.getType() == Type::BoolTy) {
Out << "("; Out << '(';
writeOperand(I.getOperand(0)); writeOperand(I.getOperand(0));
Out << " != 0)"; Out << " != 0)";
return; return;
} }
Out << "("; Out << '(';
printType(Out, I.getType()); printType(Out, I.getType());
Out << ")"; Out << ')';
if (isa<PointerType>(I.getType())&&I.getOperand(0)->getType()->isIntegral() || if (isa<PointerType>(I.getType())&&I.getOperand(0)->getType()->isIntegral() ||
isa<PointerType>(I.getOperand(0)->getType())&&I.getType()->isIntegral()) { isa<PointerType>(I.getOperand(0)->getType())&&I.getType()->isIntegral()) {
// Avoid "cast to pointer from integer of different size" warnings // Avoid "cast to pointer from integer of different size" warnings
@ -1464,13 +1464,13 @@ void CWriter::visitCallInst(CallInst &I) {
abort(); abort();
} }
writeOperand(&I.getParent()->getParent()->aback()); writeOperand(&I.getParent()->getParent()->aback());
Out << ")"; Out << ')';
return; return;
case Intrinsic::vaend: case Intrinsic::vaend:
if (!isa<ConstantPointerNull>(I.getOperand(1))) { if (!isa<ConstantPointerNull>(I.getOperand(1))) {
Out << "va_end(*(va_list*)&"; Out << "va_end(*(va_list*)&";
writeOperand(I.getOperand(1)); writeOperand(I.getOperand(1));
Out << ")"; Out << ')';
} else { } else {
Out << "va_end(*(va_list*)0)"; Out << "va_end(*(va_list*)0)";
} }
@ -1480,29 +1480,29 @@ void CWriter::visitCallInst(CallInst &I) {
Out << "va_copy(*(va_list*)&" << Mang->getValueName(&I) << ", "; Out << "va_copy(*(va_list*)&" << Mang->getValueName(&I) << ", ";
Out << "*(va_list*)&"; Out << "*(va_list*)&";
writeOperand(I.getOperand(1)); writeOperand(I.getOperand(1));
Out << ")"; Out << ')';
return; return;
case Intrinsic::returnaddress: case Intrinsic::returnaddress:
Out << "__builtin_return_address("; Out << "__builtin_return_address(";
writeOperand(I.getOperand(1)); writeOperand(I.getOperand(1));
Out << ")"; Out << ')';
return; return;
case Intrinsic::frameaddress: case Intrinsic::frameaddress:
Out << "__builtin_frame_address("; Out << "__builtin_frame_address(";
writeOperand(I.getOperand(1)); writeOperand(I.getOperand(1));
Out << ")"; Out << ')';
return; return;
case Intrinsic::setjmp: case Intrinsic::setjmp:
Out << "setjmp(*(jmp_buf*)"; Out << "setjmp(*(jmp_buf*)";
writeOperand(I.getOperand(1)); writeOperand(I.getOperand(1));
Out << ")"; Out << ')';
return; return;
case Intrinsic::longjmp: case Intrinsic::longjmp:
Out << "longjmp(*(jmp_buf*)"; Out << "longjmp(*(jmp_buf*)";
writeOperand(I.getOperand(1)); writeOperand(I.getOperand(1));
Out << ", "; Out << ", ";
writeOperand(I.getOperand(2)); writeOperand(I.getOperand(2));
Out << ")"; Out << ')';
return; return;
} }
} }
@ -1538,7 +1538,7 @@ void CWriter::visitCallInst(CallInst &I) {
printType(Out, CE->getType()); printType(Out, CE->getType());
Out << ")(void*)"; Out << ")(void*)";
printConstant(RF); printConstant(RF);
Out << ")"; Out << ')';
WroteCallee = true; WroteCallee = true;
} }
} }
@ -1548,16 +1548,16 @@ void CWriter::visitCallInst(CallInst &I) {
const Type *RetTy = FTy->getReturnType(); const Type *RetTy = FTy->getReturnType();
if (!WroteCallee) writeOperand(Callee); if (!WroteCallee) writeOperand(Callee);
Out << "("; Out << '(';
unsigned NumDeclaredParams = FTy->getNumParams(); unsigned NumDeclaredParams = FTy->getNumParams();
if (I.getNumOperands() != 1) { if (I.getNumOperands() != 1) {
CallSite::arg_iterator AI = I.op_begin()+1, AE = I.op_end(); CallSite::arg_iterator AI = I.op_begin()+1, AE = I.op_end();
if (NumDeclaredParams && (*AI)->getType() != FTy->getParamType(0)) { if (NumDeclaredParams && (*AI)->getType() != FTy->getParamType(0)) {
Out << "("; Out << '(';
printType(Out, FTy->getParamType(0)); printType(Out, FTy->getParamType(0));
Out << ")"; Out << ')';
} }
writeOperand(*AI); writeOperand(*AI);
@ -1567,14 +1567,14 @@ void CWriter::visitCallInst(CallInst &I) {
Out << ", "; Out << ", ";
if (ArgNo < NumDeclaredParams && if (ArgNo < NumDeclaredParams &&
(*AI)->getType() != FTy->getParamType(ArgNo)) { (*AI)->getType() != FTy->getParamType(ArgNo)) {
Out << "("; Out << '(';
printType(Out, FTy->getParamType(ArgNo)); printType(Out, FTy->getParamType(ArgNo));
Out << ")"; Out << ')';
} }
writeOperand(*AI); writeOperand(*AI);
} }
} }
Out << ")"; Out << ')';
} }
void CWriter::visitMallocInst(MallocInst &I) { void CWriter::visitMallocInst(MallocInst &I) {
@ -1582,16 +1582,16 @@ void CWriter::visitMallocInst(MallocInst &I) {
} }
void CWriter::visitAllocaInst(AllocaInst &I) { void CWriter::visitAllocaInst(AllocaInst &I) {
Out << "("; Out << '(';
printType(Out, I.getType()); printType(Out, I.getType());
Out << ") alloca(sizeof("; Out << ") alloca(sizeof(";
printType(Out, I.getType()->getElementType()); printType(Out, I.getType()->getElementType());
Out << ")"; Out << ')';
if (I.isArrayAllocation()) { if (I.isArrayAllocation()) {
Out << " * " ; Out << " * " ;
writeOperand(I.getOperand(0)); writeOperand(I.getOperand(0));
} }
Out << ")"; Out << ')';
} }
void CWriter::visitFreeInst(FreeInst &I) { void CWriter::visitFreeInst(FreeInst &I) {
@ -1610,7 +1610,7 @@ void CWriter::printIndexingExpression(Value *Ptr, gep_type_iterator I,
if (I == E) { if (I == E) {
if (!HasImplicitAddress) if (!HasImplicitAddress)
Out << "*"; // Implicit zero first argument: '*x' is equivalent to 'x[0]' Out << '*'; // Implicit zero first argument: '*x' is equivalent to 'x[0]'
writeOperandInternal(Ptr); writeOperandInternal(Ptr);
return; return;
@ -1623,7 +1623,7 @@ void CWriter::printIndexingExpression(Value *Ptr, gep_type_iterator I,
writeOperandInternal(Ptr); writeOperandInternal(Ptr);
if (HasImplicitAddress && (!CI || !CI->isNullValue())) { if (HasImplicitAddress && (!CI || !CI->isNullValue())) {
Out << ")"; Out << ')';
HasImplicitAddress = false; // HIA is only true if we haven't addressed yet HasImplicitAddress = false; // HIA is only true if we haven't addressed yet
} }
@ -1647,14 +1647,14 @@ void CWriter::printIndexingExpression(Value *Ptr, gep_type_iterator I,
if (isa<StructType>(*I)) { if (isa<StructType>(*I)) {
Out << ".field" << cast<ConstantUInt>(I.getOperand())->getValue(); Out << ".field" << cast<ConstantUInt>(I.getOperand())->getValue();
} else { } else {
Out << "["; Out << '[';
writeOperand(I.getOperand()); writeOperand(I.getOperand());
Out << "]"; Out << ']';
} }
} }
void CWriter::visitLoadInst(LoadInst &I) { void CWriter::visitLoadInst(LoadInst &I) {
Out << "*"; Out << '*';
if (I.isVolatile()) { if (I.isVolatile()) {
Out << "((volatile "; Out << "((volatile ";
printType(Out, I.getOperand(0)->getType()); printType(Out, I.getOperand(0)->getType());
@ -1668,7 +1668,7 @@ void CWriter::visitLoadInst(LoadInst &I) {
} }
void CWriter::visitStoreInst(StoreInst &I) { void CWriter::visitStoreInst(StoreInst &I) {
Out << "*"; Out << '*';
if (I.isVolatile()) { if (I.isVolatile()) {
Out << "((volatile "; Out << "((volatile ";
printType(Out, I.getPointerOperand()->getType()); printType(Out, I.getPointerOperand()->getType());
@ -1681,7 +1681,7 @@ void CWriter::visitStoreInst(StoreInst &I) {
} }
void CWriter::visitGetElementPtrInst(GetElementPtrInst &I) { void CWriter::visitGetElementPtrInst(GetElementPtrInst &I) {
Out << "&"; Out << '&';
printIndexingExpression(I.getPointerOperand(), gep_type_begin(I), printIndexingExpression(I.getPointerOperand(), gep_type_begin(I),
gep_type_end(I)); gep_type_end(I));
} }
@ -1690,7 +1690,7 @@ void CWriter::visitVANextInst(VANextInst &I) {
Out << Mang->getValueName(I.getOperand(0)); Out << Mang->getValueName(I.getOperand(0));
Out << "; va_arg(*(va_list*)&" << Mang->getValueName(&I) << ", "; Out << "; va_arg(*(va_list*)&" << Mang->getValueName(&I) << ", ";
printType(Out, I.getArgType()); printType(Out, I.getArgType());
Out << ")"; Out << ')';
} }
void CWriter::visitVAArgInst(VAArgInst &I) { void CWriter::visitVAArgInst(VAArgInst &I) {

View File

@ -287,7 +287,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
// Check to see if the type is named. // Check to see if the type is named.
if (!IgnoreName || isa<OpaqueType>(Ty)) { if (!IgnoreName || isa<OpaqueType>(Ty)) {
std::map<const Type *, std::string>::iterator I = TypeNames.find(Ty); std::map<const Type *, std::string>::iterator I = TypeNames.find(Ty);
if (I != TypeNames.end()) return Out << I->second << " " << NameSoFar; if (I != TypeNames.end()) return Out << I->second << ' ' << NameSoFar;
} }
switch (Ty->getTypeID()) { switch (Ty->getTypeID()) {
@ -307,7 +307,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
} else if (!MTy->getNumParams()) { } else if (!MTy->getNumParams()) {
FunctionInnards << "void"; FunctionInnards << "void";
} }
FunctionInnards << ")"; FunctionInnards << ')';
std::string tstr = FunctionInnards.str(); std::string tstr = FunctionInnards.str();
printType(Out, MTy->getReturnType(), tstr); printType(Out, MTy->getReturnType(), tstr);
return Out; return Out;
@ -322,7 +322,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
printType(Out, *I, "field" + utostr(Idx++)); printType(Out, *I, "field" + utostr(Idx++));
Out << ";\n"; Out << ";\n";
} }
return Out << "}"; return Out << '}';
} }
case Type::PointerTyID: { case Type::PointerTyID: {
@ -348,7 +348,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
std::string TyName = "struct opaque_" + itostr(Count++); std::string TyName = "struct opaque_" + itostr(Count++);
assert(TypeNames.find(Ty) == TypeNames.end()); assert(TypeNames.find(Ty) == TypeNames.end());
TypeNames[Ty] = TyName; TypeNames[Ty] = TyName;
return Out << TyName << " " << NameSoFar; return Out << TyName << ' ' << NameSoFar;
} }
default: default:
assert(0 && "Unhandled case in getTypeProps!"); assert(0 && "Unhandled case in getTypeProps!");
@ -372,7 +372,7 @@ void CWriter::printConstantArray(ConstantArray *CPA) {
isString = false; isString = false;
if (isString) { if (isString) {
Out << "\""; Out << '\"';
// Keep track of whether the last number was a hexadecimal escape // Keep track of whether the last number was a hexadecimal escape
bool LastWasHex = false; bool LastWasHex = false;
@ -411,11 +411,11 @@ void CWriter::printConstantArray(ConstantArray *CPA) {
} }
} }
} }
Out << "\""; Out << '\"';
} else { } else {
Out << "{"; Out << '{';
if (CPA->getNumOperands()) { if (CPA->getNumOperands()) {
Out << " "; Out << ' ';
printConstant(cast<Constant>(CPA->getOperand(0))); printConstant(cast<Constant>(CPA->getOperand(0)));
for (unsigned i = 1, e = CPA->getNumOperands(); i != e; ++i) { for (unsigned i = 1, e = CPA->getNumOperands(); i != e; ++i) {
Out << ", "; Out << ", ";
@ -468,9 +468,9 @@ void CWriter::printConstant(Constant *CPV) {
case Instruction::Cast: case Instruction::Cast:
Out << "(("; Out << "((";
printType(Out, CPV->getType()); printType(Out, CPV->getType());
Out << ")"; Out << ')';
printConstant(CE->getOperand(0)); printConstant(CE->getOperand(0));
Out << ")"; Out << ')';
return; return;
case Instruction::GetElementPtr: case Instruction::GetElementPtr:
@ -480,13 +480,13 @@ void CWriter::printConstant(Constant *CPV) {
Out << "))"; Out << "))";
return; return;
case Instruction::Select: case Instruction::Select:
Out << "("; Out << '(';
printConstant(CE->getOperand(0)); printConstant(CE->getOperand(0));
Out << "?"; Out << '?';
printConstant(CE->getOperand(1)); printConstant(CE->getOperand(1));
Out << ":"; Out << ':';
printConstant(CE->getOperand(2)); printConstant(CE->getOperand(2));
Out << ")"; Out << ')';
return; return;
case Instruction::Add: case Instruction::Add:
case Instruction::Sub: case Instruction::Sub:
@ -504,7 +504,7 @@ void CWriter::printConstant(Constant *CPV) {
case Instruction::SetGE: case Instruction::SetGE:
case Instruction::Shl: case Instruction::Shl:
case Instruction::Shr: case Instruction::Shr:
Out << "("; Out << '(';
printConstant(CE->getOperand(0)); printConstant(CE->getOperand(0));
switch (CE->getOpcode()) { switch (CE->getOpcode()) {
case Instruction::Add: Out << " + "; break; case Instruction::Add: Out << " + "; break;
@ -526,7 +526,7 @@ void CWriter::printConstant(Constant *CPV) {
default: assert(0 && "Illegal opcode here!"); default: assert(0 && "Illegal opcode here!");
} }
printConstant(CE->getOperand(1)); printConstant(CE->getOperand(1));
Out << ")"; Out << ')';
return; return;
default: default:
@ -543,7 +543,7 @@ void CWriter::printConstant(Constant *CPV) {
switch (CPV->getType()->getTypeID()) { switch (CPV->getType()->getTypeID()) {
case Type::BoolTyID: case Type::BoolTyID:
Out << (CPV == ConstantBool::False ? "0" : "1"); break; Out << (CPV == ConstantBool::False ? '0' : '1'); break;
case Type::SByteTyID: case Type::SByteTyID:
case Type::ShortTyID: case Type::ShortTyID:
Out << cast<ConstantSInt>(CPV)->getValue(); break; Out << cast<ConstantSInt>(CPV)->getValue(); break;
@ -564,7 +564,7 @@ void CWriter::printConstant(Constant *CPV) {
case Type::UShortTyID: case Type::UShortTyID:
Out << cast<ConstantUInt>(CPV)->getValue(); break; Out << cast<ConstantUInt>(CPV)->getValue(); break;
case Type::UIntTyID: case Type::UIntTyID:
Out << cast<ConstantUInt>(CPV)->getValue() << "u"; break; Out << cast<ConstantUInt>(CPV)->getValue() << 'u'; break;
case Type::ULongTyID: case Type::ULongTyID:
Out << cast<ConstantUInt>(CPV)->getValue() << "ull"; break; Out << cast<ConstantUInt>(CPV)->getValue() << "ull"; break;
@ -576,7 +576,7 @@ void CWriter::printConstant(Constant *CPV) {
// Because of FP precision problems we must load from a stack allocated // Because of FP precision problems we must load from a stack allocated
// value that holds the value in hex. // value that holds the value in hex.
Out << "(*(" << (FPC->getType() == Type::FloatTy ? "float" : "double") Out << "(*(" << (FPC->getType() == Type::FloatTy ? "float" : "double")
<< "*)&FPConstant" << I->second << ")"; << "*)&FPConstant" << I->second << ')';
} else { } else {
if (IsNAN(FPC->getValue())) { if (IsNAN(FPC->getValue())) {
// The value is NaN // The value is NaN
@ -607,7 +607,7 @@ void CWriter::printConstant(Constant *CPV) {
<< Buffer << "\") /*nan*/ "; << Buffer << "\") /*nan*/ ";
} else if (IsInf(FPC->getValue())) { } else if (IsInf(FPC->getValue())) {
// The value is Inf // The value is Inf
if (FPC->getValue() < 0) Out << "-"; if (FPC->getValue() < 0) Out << '-';
Out << "LLVM_INF" << (FPC->getType() == Type::FloatTy ? "F" : "") Out << "LLVM_INF" << (FPC->getType() == Type::FloatTy ? "F" : "")
<< " /*inf*/ "; << " /*inf*/ ";
} else { } else {
@ -629,9 +629,9 @@ void CWriter::printConstant(Constant *CPV) {
case Type::ArrayTyID: case Type::ArrayTyID:
if (isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV)) { if (isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV)) {
const ArrayType *AT = cast<ArrayType>(CPV->getType()); const ArrayType *AT = cast<ArrayType>(CPV->getType());
Out << "{"; Out << '{';
if (AT->getNumElements()) { if (AT->getNumElements()) {
Out << " "; Out << ' ';
Constant *CZ = Constant::getNullValue(AT->getElementType()); Constant *CZ = Constant::getNullValue(AT->getElementType());
printConstant(CZ); printConstant(CZ);
for (unsigned i = 1, e = AT->getNumElements(); i != e; ++i) { for (unsigned i = 1, e = AT->getNumElements(); i != e; ++i) {
@ -648,9 +648,9 @@ void CWriter::printConstant(Constant *CPV) {
case Type::StructTyID: case Type::StructTyID:
if (isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV)) { if (isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV)) {
const StructType *ST = cast<StructType>(CPV->getType()); const StructType *ST = cast<StructType>(CPV->getType());
Out << "{"; Out << '{';
if (ST->getNumElements()) { if (ST->getNumElements()) {
Out << " "; Out << ' ';
printConstant(Constant::getNullValue(ST->getElementType(0))); printConstant(Constant::getNullValue(ST->getElementType(0)));
for (unsigned i = 1, e = ST->getNumElements(); i != e; ++i) { for (unsigned i = 1, e = ST->getNumElements(); i != e; ++i) {
Out << ", "; Out << ", ";
@ -659,9 +659,9 @@ void CWriter::printConstant(Constant *CPV) {
} }
Out << " }"; Out << " }";
} else { } else {
Out << "{"; Out << '{';
if (CPV->getNumOperands()) { if (CPV->getNumOperands()) {
Out << " "; Out << ' ';
printConstant(cast<Constant>(CPV->getOperand(0))); printConstant(cast<Constant>(CPV->getOperand(0)));
for (unsigned i = 1, e = CPV->getNumOperands(); i != e; ++i) { for (unsigned i = 1, e = CPV->getNumOperands(); i != e; ++i) {
Out << ", "; Out << ", ";
@ -693,9 +693,9 @@ void CWriter::writeOperandInternal(Value *Operand) {
if (Instruction *I = dyn_cast<Instruction>(Operand)) if (Instruction *I = dyn_cast<Instruction>(Operand))
if (isInlinableInst(*I) && !isDirectAlloca(I)) { if (isInlinableInst(*I) && !isDirectAlloca(I)) {
// Should we inline this instruction to build a tree? // Should we inline this instruction to build a tree?
Out << "("; Out << '(';
visit(*I); visit(*I);
Out << ")"; Out << ')';
return; return;
} }
@ -714,7 +714,7 @@ void CWriter::writeOperand(Value *Operand) {
writeOperandInternal(Operand); writeOperandInternal(Operand);
if (isa<GlobalVariable>(Operand) || isDirectAlloca(Operand)) if (isa<GlobalVariable>(Operand) || isDirectAlloca(Operand))
Out << ")"; Out << ')';
} }
// generateCompilerSpecificCode - This is where we add conditional compilation // generateCompilerSpecificCode - This is where we add conditional compilation
@ -980,7 +980,7 @@ void CWriter::printFloatingPointConstants(Function &F) {
assert(0 && "Unknown float type!"); assert(0 && "Unknown float type!");
} }
Out << "\n"; Out << '\n';
} }
@ -1005,7 +1005,7 @@ void CWriter::printModuleTypes(const SymbolTable &ST) {
TypeNames.insert(std::make_pair(STy, Name)); TypeNames.insert(std::make_pair(STy, Name));
} }
Out << "\n"; Out << '\n';
// Now we can print out typedefs... // Now we can print out typedefs...
Out << "/* Typedefs */\n"; Out << "/* Typedefs */\n";
@ -1017,7 +1017,7 @@ void CWriter::printModuleTypes(const SymbolTable &ST) {
Out << ";\n"; Out << ";\n";
} }
Out << "\n"; Out << '\n';
// Keep track of which structures have been printed so far... // Keep track of which structures have been printed so far...
std::set<const StructType *> StructPrinted; std::set<const StructType *> StructPrinted;
@ -1072,7 +1072,7 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
std::stringstream FunctionInnards; std::stringstream FunctionInnards;
// Print out the name... // Print out the name...
FunctionInnards << Mang->getValueName(F) << "("; FunctionInnards << Mang->getValueName(F) << '(';
if (!F->isExternal()) { if (!F->isExternal()) {
if (!F->aempty()) { if (!F->aempty()) {
@ -1108,7 +1108,7 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
} else if (!FT->isVarArg() && FT->getNumParams() == 0) { } else if (!FT->isVarArg() && FT->getNumParams() == 0) {
FunctionInnards << "void"; // ret() -> ret(void) in C. FunctionInnards << "void"; // ret() -> ret(void) in C.
} }
FunctionInnards << ")"; FunctionInnards << ')';
// Print out the return type and the entire signature for that matter // Print out the return type and the entire signature for that matter
printType(Out, F->getReturnType(), FunctionInnards.str()); printType(Out, F->getReturnType(), FunctionInnards.str());
} }
@ -1136,7 +1136,7 @@ void CWriter::printFunction(Function &F) {
} }
} }
Out << "\n"; Out << '\n';
if (F.hasExternalLinkage() && F.getName() == "main") if (F.hasExternalLinkage() && F.getName() == "main")
printCodeForMain(); printCodeForMain();
@ -1225,7 +1225,7 @@ void CWriter::visitReturnInst(ReturnInst &I) {
Out << " return"; Out << " return";
if (I.getNumOperands()) { if (I.getNumOperands()) {
Out << " "; Out << ' ';
writeOperand(I.getOperand(0)); writeOperand(I.getOperand(0));
} }
Out << ";\n"; Out << ";\n";
@ -1362,9 +1362,9 @@ void CWriter::visitBinaryOperator(Instruction &I) {
switch (I.getOpcode()) { switch (I.getOpcode()) {
case Instruction::Add: Out << " + "; break; case Instruction::Add: Out << " + "; break;
case Instruction::Sub: Out << " - "; break; case Instruction::Sub: Out << " - "; break;
case Instruction::Mul: Out << "*"; break; case Instruction::Mul: Out << '*'; break;
case Instruction::Div: Out << "/"; break; case Instruction::Div: Out << '/'; break;
case Instruction::Rem: Out << "%"; break; case Instruction::Rem: Out << '%'; break;
case Instruction::And: Out << " & "; break; case Instruction::And: Out << " & "; break;
case Instruction::Or: Out << " | "; break; case Instruction::Or: Out << " | "; break;
case Instruction::Xor: Out << " ^ "; break; case Instruction::Xor: Out << " ^ "; break;
@ -1388,14 +1388,14 @@ void CWriter::visitBinaryOperator(Instruction &I) {
void CWriter::visitCastInst(CastInst &I) { void CWriter::visitCastInst(CastInst &I) {
if (I.getType() == Type::BoolTy) { if (I.getType() == Type::BoolTy) {
Out << "("; Out << '(';
writeOperand(I.getOperand(0)); writeOperand(I.getOperand(0));
Out << " != 0)"; Out << " != 0)";
return; return;
} }
Out << "("; Out << '(';
printType(Out, I.getType()); printType(Out, I.getType());
Out << ")"; Out << ')';
if (isa<PointerType>(I.getType())&&I.getOperand(0)->getType()->isIntegral() || if (isa<PointerType>(I.getType())&&I.getOperand(0)->getType()->isIntegral() ||
isa<PointerType>(I.getOperand(0)->getType())&&I.getType()->isIntegral()) { isa<PointerType>(I.getOperand(0)->getType())&&I.getType()->isIntegral()) {
// Avoid "cast to pointer from integer of different size" warnings // Avoid "cast to pointer from integer of different size" warnings
@ -1464,13 +1464,13 @@ void CWriter::visitCallInst(CallInst &I) {
abort(); abort();
} }
writeOperand(&I.getParent()->getParent()->aback()); writeOperand(&I.getParent()->getParent()->aback());
Out << ")"; Out << ')';
return; return;
case Intrinsic::vaend: case Intrinsic::vaend:
if (!isa<ConstantPointerNull>(I.getOperand(1))) { if (!isa<ConstantPointerNull>(I.getOperand(1))) {
Out << "va_end(*(va_list*)&"; Out << "va_end(*(va_list*)&";
writeOperand(I.getOperand(1)); writeOperand(I.getOperand(1));
Out << ")"; Out << ')';
} else { } else {
Out << "va_end(*(va_list*)0)"; Out << "va_end(*(va_list*)0)";
} }
@ -1480,29 +1480,29 @@ void CWriter::visitCallInst(CallInst &I) {
Out << "va_copy(*(va_list*)&" << Mang->getValueName(&I) << ", "; Out << "va_copy(*(va_list*)&" << Mang->getValueName(&I) << ", ";
Out << "*(va_list*)&"; Out << "*(va_list*)&";
writeOperand(I.getOperand(1)); writeOperand(I.getOperand(1));
Out << ")"; Out << ')';
return; return;
case Intrinsic::returnaddress: case Intrinsic::returnaddress:
Out << "__builtin_return_address("; Out << "__builtin_return_address(";
writeOperand(I.getOperand(1)); writeOperand(I.getOperand(1));
Out << ")"; Out << ')';
return; return;
case Intrinsic::frameaddress: case Intrinsic::frameaddress:
Out << "__builtin_frame_address("; Out << "__builtin_frame_address(";
writeOperand(I.getOperand(1)); writeOperand(I.getOperand(1));
Out << ")"; Out << ')';
return; return;
case Intrinsic::setjmp: case Intrinsic::setjmp:
Out << "setjmp(*(jmp_buf*)"; Out << "setjmp(*(jmp_buf*)";
writeOperand(I.getOperand(1)); writeOperand(I.getOperand(1));
Out << ")"; Out << ')';
return; return;
case Intrinsic::longjmp: case Intrinsic::longjmp:
Out << "longjmp(*(jmp_buf*)"; Out << "longjmp(*(jmp_buf*)";
writeOperand(I.getOperand(1)); writeOperand(I.getOperand(1));
Out << ", "; Out << ", ";
writeOperand(I.getOperand(2)); writeOperand(I.getOperand(2));
Out << ")"; Out << ')';
return; return;
} }
} }
@ -1538,7 +1538,7 @@ void CWriter::visitCallInst(CallInst &I) {
printType(Out, CE->getType()); printType(Out, CE->getType());
Out << ")(void*)"; Out << ")(void*)";
printConstant(RF); printConstant(RF);
Out << ")"; Out << ')';
WroteCallee = true; WroteCallee = true;
} }
} }
@ -1548,16 +1548,16 @@ void CWriter::visitCallInst(CallInst &I) {
const Type *RetTy = FTy->getReturnType(); const Type *RetTy = FTy->getReturnType();
if (!WroteCallee) writeOperand(Callee); if (!WroteCallee) writeOperand(Callee);
Out << "("; Out << '(';
unsigned NumDeclaredParams = FTy->getNumParams(); unsigned NumDeclaredParams = FTy->getNumParams();
if (I.getNumOperands() != 1) { if (I.getNumOperands() != 1) {
CallSite::arg_iterator AI = I.op_begin()+1, AE = I.op_end(); CallSite::arg_iterator AI = I.op_begin()+1, AE = I.op_end();
if (NumDeclaredParams && (*AI)->getType() != FTy->getParamType(0)) { if (NumDeclaredParams && (*AI)->getType() != FTy->getParamType(0)) {
Out << "("; Out << '(';
printType(Out, FTy->getParamType(0)); printType(Out, FTy->getParamType(0));
Out << ")"; Out << ')';
} }
writeOperand(*AI); writeOperand(*AI);
@ -1567,14 +1567,14 @@ void CWriter::visitCallInst(CallInst &I) {
Out << ", "; Out << ", ";
if (ArgNo < NumDeclaredParams && if (ArgNo < NumDeclaredParams &&
(*AI)->getType() != FTy->getParamType(ArgNo)) { (*AI)->getType() != FTy->getParamType(ArgNo)) {
Out << "("; Out << '(';
printType(Out, FTy->getParamType(ArgNo)); printType(Out, FTy->getParamType(ArgNo));
Out << ")"; Out << ')';
} }
writeOperand(*AI); writeOperand(*AI);
} }
} }
Out << ")"; Out << ')';
} }
void CWriter::visitMallocInst(MallocInst &I) { void CWriter::visitMallocInst(MallocInst &I) {
@ -1582,16 +1582,16 @@ void CWriter::visitMallocInst(MallocInst &I) {
} }
void CWriter::visitAllocaInst(AllocaInst &I) { void CWriter::visitAllocaInst(AllocaInst &I) {
Out << "("; Out << '(';
printType(Out, I.getType()); printType(Out, I.getType());
Out << ") alloca(sizeof("; Out << ") alloca(sizeof(";
printType(Out, I.getType()->getElementType()); printType(Out, I.getType()->getElementType());
Out << ")"; Out << ')';
if (I.isArrayAllocation()) { if (I.isArrayAllocation()) {
Out << " * " ; Out << " * " ;
writeOperand(I.getOperand(0)); writeOperand(I.getOperand(0));
} }
Out << ")"; Out << ')';
} }
void CWriter::visitFreeInst(FreeInst &I) { void CWriter::visitFreeInst(FreeInst &I) {
@ -1610,7 +1610,7 @@ void CWriter::printIndexingExpression(Value *Ptr, gep_type_iterator I,
if (I == E) { if (I == E) {
if (!HasImplicitAddress) if (!HasImplicitAddress)
Out << "*"; // Implicit zero first argument: '*x' is equivalent to 'x[0]' Out << '*'; // Implicit zero first argument: '*x' is equivalent to 'x[0]'
writeOperandInternal(Ptr); writeOperandInternal(Ptr);
return; return;
@ -1623,7 +1623,7 @@ void CWriter::printIndexingExpression(Value *Ptr, gep_type_iterator I,
writeOperandInternal(Ptr); writeOperandInternal(Ptr);
if (HasImplicitAddress && (!CI || !CI->isNullValue())) { if (HasImplicitAddress && (!CI || !CI->isNullValue())) {
Out << ")"; Out << ')';
HasImplicitAddress = false; // HIA is only true if we haven't addressed yet HasImplicitAddress = false; // HIA is only true if we haven't addressed yet
} }
@ -1647,14 +1647,14 @@ void CWriter::printIndexingExpression(Value *Ptr, gep_type_iterator I,
if (isa<StructType>(*I)) { if (isa<StructType>(*I)) {
Out << ".field" << cast<ConstantUInt>(I.getOperand())->getValue(); Out << ".field" << cast<ConstantUInt>(I.getOperand())->getValue();
} else { } else {
Out << "["; Out << '[';
writeOperand(I.getOperand()); writeOperand(I.getOperand());
Out << "]"; Out << ']';
} }
} }
void CWriter::visitLoadInst(LoadInst &I) { void CWriter::visitLoadInst(LoadInst &I) {
Out << "*"; Out << '*';
if (I.isVolatile()) { if (I.isVolatile()) {
Out << "((volatile "; Out << "((volatile ";
printType(Out, I.getOperand(0)->getType()); printType(Out, I.getOperand(0)->getType());
@ -1668,7 +1668,7 @@ void CWriter::visitLoadInst(LoadInst &I) {
} }
void CWriter::visitStoreInst(StoreInst &I) { void CWriter::visitStoreInst(StoreInst &I) {
Out << "*"; Out << '*';
if (I.isVolatile()) { if (I.isVolatile()) {
Out << "((volatile "; Out << "((volatile ";
printType(Out, I.getPointerOperand()->getType()); printType(Out, I.getPointerOperand()->getType());
@ -1681,7 +1681,7 @@ void CWriter::visitStoreInst(StoreInst &I) {
} }
void CWriter::visitGetElementPtrInst(GetElementPtrInst &I) { void CWriter::visitGetElementPtrInst(GetElementPtrInst &I) {
Out << "&"; Out << '&';
printIndexingExpression(I.getPointerOperand(), gep_type_begin(I), printIndexingExpression(I.getPointerOperand(), gep_type_begin(I),
gep_type_end(I)); gep_type_end(I));
} }
@ -1690,7 +1690,7 @@ void CWriter::visitVANextInst(VANextInst &I) {
Out << Mang->getValueName(I.getOperand(0)); Out << Mang->getValueName(I.getOperand(0));
Out << "; va_arg(*(va_list*)&" << Mang->getValueName(&I) << ", "; Out << "; va_arg(*(va_list*)&" << Mang->getValueName(&I) << ", ";
printType(Out, I.getArgType()); printType(Out, I.getArgType());
Out << ")"; Out << ')';
} }
void CWriter::visitVAArgInst(VAArgInst &I) { void CWriter::visitVAArgInst(VAArgInst &I) {