Make newlines be newlines! This should now work in both lli and native code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1016 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vikram S. Adve 2001-10-28 22:44:02 +00:00
parent 2301a070f6
commit c426c63b39

View File

@ -31,7 +31,6 @@
#include <hash_set> #include <hash_set>
#include <sstream> #include <sstream>
const string PRINT_FUNC_NAME = "printVal";
static const char* static const char*
PrintMethodNameForType(const Type* type) PrintMethodNameForType(const Type* type)
@ -211,15 +210,15 @@ CreatePrintfInstr(Value* val,
case Type::UIntTyID: case Type::ULongTyID: case Type::UIntTyID: case Type::ULongTyID:
case Type::SByteTyID: case Type::ShortTyID: case Type::SByteTyID: case Type::ShortTyID:
case Type::IntTyID: case Type::LongTyID: case Type::IntTyID: case Type::LongTyID:
fmtString << " %d\\n"; fmtString << " %d\n";
break; break;
case Type::FloatTyID: case Type::DoubleTyID: case Type::FloatTyID: case Type::DoubleTyID:
fmtString << " %g\\n"; fmtString << " %g\n";
break; break;
case Type::PointerTyID: case Type::PointerTyID:
fmtString << " %p\\n"; fmtString << " %p\n";
break; break;
default: default:
@ -302,7 +301,7 @@ InsertPrintInsts(Value *Val,
BBI = BB->getInstList().insert(BBI, I)+1; BBI = BB->getInstList().insert(BBI, I)+1;
// Print out a newline // Print out a newline
fmtVal = GetStringRef(Mod, "\\n"); fmtVal = GetStringRef(Mod, "\n");
I = new CallInst(GetPrintMethodForType(Mod, fmtVal->getType()), I = new CallInst(GetPrintMethodForType(Mod, fmtVal->getType()),
vector<Value*>(1, fmtVal)); vector<Value*>(1, fmtVal));
BBI = BB->getInstList().insert(BBI, I)+1; BBI = BB->getInstList().insert(BBI, I)+1;
@ -396,7 +395,7 @@ CreateMethodTraceInst(Method* method,
string fmtString(indent, ' '); string fmtString(indent, ' ');
ostringstream methodNameString; ostringstream methodNameString;
WriteAsOperand(methodNameString, method); WriteAsOperand(methodNameString, method);
fmtString += msg + methodNameString.str() + "\\n"; fmtString += msg + methodNameString.str() + '\n';
GlobalVariable *fmtVal = GetStringRef(method->getParent(), fmtString); GlobalVariable *fmtVal = GetStringRef(method->getParent(), fmtString);
Instruction *printInst = Instruction *printInst =
@ -453,7 +452,6 @@ InsertTraceCode::doInsertTraceCode(Method *M,
vector<BasicBlock*> exitBlocks; vector<BasicBlock*> exitBlocks;
if (M->isExternal() || if (M->isExternal() ||
(M->hasName() && M->getName() == PRINT_FUNC_NAME) ||
(! traceBasicBlockExits && ! traceMethodExits)) (! traceBasicBlockExits && ! traceMethodExits))
return false; return false;