summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2017-01-28 02:47:46 +0000
committerMatthias Braun <matze@braunis.de>2017-01-28 02:47:46 +0000
commitd6da5dbf7bc0029ddfe3e528b619e904b0f05029 (patch)
tree206c0815a305ef8d4006d10adbb24e1350920fa4 /examples
parent09e759d8e95dd24fdb2cf81edbc29e57dcaf0602 (diff)
Use print() instead of dump() in code
The dump() functions are meant to be used in a debugger, code should typically use something like print(errs()); git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293365 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples')
-rw-r--r--examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp6
-rw-r--r--examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp6
-rw-r--r--examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp6
-rw-r--r--examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp3
-rw-r--r--examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp3
-rw-r--r--examples/Kaleidoscope/Chapter3/toy.cpp11
-rw-r--r--examples/Kaleidoscope/Chapter4/toy.cpp6
-rw-r--r--examples/Kaleidoscope/Chapter5/toy.cpp6
-rw-r--r--examples/Kaleidoscope/Chapter6/toy.cpp6
-rw-r--r--examples/Kaleidoscope/Chapter7/toy.cpp6
-rw-r--r--examples/Kaleidoscope/Chapter8/toy.cpp6
-rw-r--r--examples/Kaleidoscope/Chapter9/toy.cpp2
-rw-r--r--examples/Kaleidoscope/MCJIT/cached/toy.cpp8
-rw-r--r--examples/Kaleidoscope/MCJIT/complete/toy.cpp6
-rw-r--r--examples/Kaleidoscope/MCJIT/initial/toy.cpp8
-rw-r--r--examples/Kaleidoscope/MCJIT/lazy/toy-jit.cpp8
-rw-r--r--examples/Kaleidoscope/MCJIT/lazy/toy.cpp6
17 files changed, 67 insertions, 36 deletions
diff --git a/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp b/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp
index 50912109e81..945b9706d4d 100644
--- a/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp
+++ b/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp
@@ -1110,7 +1110,8 @@ static void HandleDefinition() {
if (auto FnAST = ParseDefinition()) {
if (auto *FnIR = FnAST->codegen()) {
fprintf(stderr, "Read function definition:");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
TheJIT->addModule(std::move(TheModule));
InitializeModule();
}
@@ -1124,7 +1125,8 @@ static void HandleExtern() {
if (auto ProtoAST = ParseExtern()) {
if (auto *FnIR = ProtoAST->codegen()) {
fprintf(stderr, "Read extern: ");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
}
} else {
diff --git a/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp b/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp
index 50912109e81..945b9706d4d 100644
--- a/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp
+++ b/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp
@@ -1110,7 +1110,8 @@ static void HandleDefinition() {
if (auto FnAST = ParseDefinition()) {
if (auto *FnIR = FnAST->codegen()) {
fprintf(stderr, "Read function definition:");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
TheJIT->addModule(std::move(TheModule));
InitializeModule();
}
@@ -1124,7 +1125,8 @@ static void HandleExtern() {
if (auto ProtoAST = ParseExtern()) {
if (auto *FnIR = ProtoAST->codegen()) {
fprintf(stderr, "Read extern: ");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
}
} else {
diff --git a/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp b/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp
index 50912109e81..945b9706d4d 100644
--- a/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp
+++ b/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp
@@ -1110,7 +1110,8 @@ static void HandleDefinition() {
if (auto FnAST = ParseDefinition()) {
if (auto *FnIR = FnAST->codegen()) {
fprintf(stderr, "Read function definition:");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
TheJIT->addModule(std::move(TheModule));
InitializeModule();
}
@@ -1124,7 +1125,8 @@ static void HandleExtern() {
if (auto ProtoAST = ParseExtern()) {
if (auto *FnIR = ProtoAST->codegen()) {
fprintf(stderr, "Read extern: ");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
}
} else {
diff --git a/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp b/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp
index 07981a8f79b..ff4b5220105 100644
--- a/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp
+++ b/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp
@@ -1126,7 +1126,8 @@ static void HandleExtern() {
if (auto ProtoAST = ParseExtern()) {
if (auto *FnIR = ProtoAST->codegen()) {
fprintf(stderr, "Read extern: ");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
}
} else {
diff --git a/examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp b/examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp
index aa08df9ceb5..edd050959d6 100644
--- a/examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp
+++ b/examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp
@@ -1150,7 +1150,8 @@ static void HandleExtern() {
if (auto ProtoAST = ParseExtern()) {
if (auto *FnIR = ProtoAST->codegen()) {
fprintf(stderr, "Read extern: ");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
}
} else {
diff --git a/examples/Kaleidoscope/Chapter3/toy.cpp b/examples/Kaleidoscope/Chapter3/toy.cpp
index fdefb50cc20..8aad3f4d7be 100644
--- a/examples/Kaleidoscope/Chapter3/toy.cpp
+++ b/examples/Kaleidoscope/Chapter3/toy.cpp
@@ -522,7 +522,8 @@ static void HandleDefinition() {
if (auto FnAST = ParseDefinition()) {
if (auto *FnIR = FnAST->codegen()) {
fprintf(stderr, "Read function definition:");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
}
} else {
// Skip token for error recovery.
@@ -534,7 +535,8 @@ static void HandleExtern() {
if (auto ProtoAST = ParseExtern()) {
if (auto *FnIR = ProtoAST->codegen()) {
fprintf(stderr, "Read extern: ");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
}
} else {
// Skip token for error recovery.
@@ -547,7 +549,8 @@ static void HandleTopLevelExpression() {
if (auto FnAST = ParseTopLevelExpr()) {
if (auto *FnIR = FnAST->codegen()) {
fprintf(stderr, "Read top-level expression:");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
}
} else {
// Skip token for error recovery.
@@ -601,7 +604,7 @@ int main() {
MainLoop();
// Print out all of the generated code.
- TheModule->dump();
+ TheModule->print(errs(), nullptr);
return 0;
}
diff --git a/examples/Kaleidoscope/Chapter4/toy.cpp b/examples/Kaleidoscope/Chapter4/toy.cpp
index 39b9563bc28..3bd077b6e38 100644
--- a/examples/Kaleidoscope/Chapter4/toy.cpp
+++ b/examples/Kaleidoscope/Chapter4/toy.cpp
@@ -571,7 +571,8 @@ static void HandleDefinition() {
if (auto FnAST = ParseDefinition()) {
if (auto *FnIR = FnAST->codegen()) {
fprintf(stderr, "Read function definition:");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
TheJIT->addModule(std::move(TheModule));
InitializeModuleAndPassManager();
}
@@ -585,7 +586,8 @@ static void HandleExtern() {
if (auto ProtoAST = ParseExtern()) {
if (auto *FnIR = ProtoAST->codegen()) {
fprintf(stderr, "Read extern: ");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
}
} else {
diff --git a/examples/Kaleidoscope/Chapter5/toy.cpp b/examples/Kaleidoscope/Chapter5/toy.cpp
index 568ec8de5c3..795f49c847e 100644
--- a/examples/Kaleidoscope/Chapter5/toy.cpp
+++ b/examples/Kaleidoscope/Chapter5/toy.cpp
@@ -845,7 +845,8 @@ static void HandleDefinition() {
if (auto FnAST = ParseDefinition()) {
if (auto *FnIR = FnAST->codegen()) {
fprintf(stderr, "Read function definition:");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
TheJIT->addModule(std::move(TheModule));
InitializeModuleAndPassManager();
}
@@ -859,7 +860,8 @@ static void HandleExtern() {
if (auto ProtoAST = ParseExtern()) {
if (auto *FnIR = ProtoAST->codegen()) {
fprintf(stderr, "Read extern: ");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
}
} else {
diff --git a/examples/Kaleidoscope/Chapter6/toy.cpp b/examples/Kaleidoscope/Chapter6/toy.cpp
index 0fa128d2e55..19e25d37dcd 100644
--- a/examples/Kaleidoscope/Chapter6/toy.cpp
+++ b/examples/Kaleidoscope/Chapter6/toy.cpp
@@ -964,7 +964,8 @@ static void HandleDefinition() {
if (auto FnAST = ParseDefinition()) {
if (auto *FnIR = FnAST->codegen()) {
fprintf(stderr, "Read function definition:");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
TheJIT->addModule(std::move(TheModule));
InitializeModuleAndPassManager();
}
@@ -978,7 +979,8 @@ static void HandleExtern() {
if (auto ProtoAST = ParseExtern()) {
if (auto *FnIR = ProtoAST->codegen()) {
fprintf(stderr, "Read extern: ");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
}
} else {
diff --git a/examples/Kaleidoscope/Chapter7/toy.cpp b/examples/Kaleidoscope/Chapter7/toy.cpp
index 58b7ce1ceda..7e723ba0397 100644
--- a/examples/Kaleidoscope/Chapter7/toy.cpp
+++ b/examples/Kaleidoscope/Chapter7/toy.cpp
@@ -1131,7 +1131,8 @@ static void HandleDefinition() {
if (auto FnAST = ParseDefinition()) {
if (auto *FnIR = FnAST->codegen()) {
fprintf(stderr, "Read function definition:");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
TheJIT->addModule(std::move(TheModule));
InitializeModuleAndPassManager();
}
@@ -1145,7 +1146,8 @@ static void HandleExtern() {
if (auto ProtoAST = ParseExtern()) {
if (auto *FnIR = ProtoAST->codegen()) {
fprintf(stderr, "Read extern: ");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
}
} else {
diff --git a/examples/Kaleidoscope/Chapter8/toy.cpp b/examples/Kaleidoscope/Chapter8/toy.cpp
index f7bb814da77..354380adfc4 100644
--- a/examples/Kaleidoscope/Chapter8/toy.cpp
+++ b/examples/Kaleidoscope/Chapter8/toy.cpp
@@ -1114,7 +1114,8 @@ static void HandleDefinition() {
if (auto FnAST = ParseDefinition()) {
if (auto *FnIR = FnAST->codegen()) {
fprintf(stderr, "Read function definition:");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
}
} else {
// Skip token for error recovery.
@@ -1126,7 +1127,8 @@ static void HandleExtern() {
if (auto ProtoAST = ParseExtern()) {
if (auto *FnIR = ProtoAST->codegen()) {
fprintf(stderr, "Read extern: ");
- FnIR->dump();
+ FnIR->print(errs());
+ fprintf(stderr, "\n");
FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
}
} else {
diff --git a/examples/Kaleidoscope/Chapter9/toy.cpp b/examples/Kaleidoscope/Chapter9/toy.cpp
index a482ccd7352..aa609933fc9 100644
--- a/examples/Kaleidoscope/Chapter9/toy.cpp
+++ b/examples/Kaleidoscope/Chapter9/toy.cpp
@@ -1439,7 +1439,7 @@ int main() {
DBuilder->finalize();
// Print out all of the generated code.
- TheModule->dump();
+ TheModule->print(errs(), nullptr);
return 0;
}
diff --git a/examples/Kaleidoscope/MCJIT/cached/toy.cpp b/examples/Kaleidoscope/MCJIT/cached/toy.cpp
index 2b9c3da9218..90e056d2132 100644
--- a/examples/Kaleidoscope/MCJIT/cached/toy.cpp
+++ b/examples/Kaleidoscope/MCJIT/cached/toy.cpp
@@ -1395,7 +1395,8 @@ static void HandleDefinition() {
if (Function *LF = F->Codegen()) {
#ifndef MINIMAL_STDERR_OUTPUT
fprintf(stderr, "Read function definition:");
- LF->dump();
+ LF->print(errs());
+ fprintf(stderr, "\n");
#endif
}
} else {
@@ -1409,7 +1410,8 @@ static void HandleExtern() {
if (Function *F = P->Codegen()) {
#ifndef MINIMAL_STDERR_OUTPUT
fprintf(stderr, "Read extern: ");
- F->dump();
+ F->print(errs());
+ fprintf(stderr, "\n");
#endif
}
} else {
@@ -1540,7 +1542,7 @@ int main(int argc, char **argv) {
#ifndef MINIMAL_STDERR_OUTPUT
// Print out all of the generated code.
- TheHelper->dump();
+ TheHelper->print(errs());
#endif
return 0;
diff --git a/examples/Kaleidoscope/MCJIT/complete/toy.cpp b/examples/Kaleidoscope/MCJIT/complete/toy.cpp
index 40a00693e8c..98bdad1e990 100644
--- a/examples/Kaleidoscope/MCJIT/complete/toy.cpp
+++ b/examples/Kaleidoscope/MCJIT/complete/toy.cpp
@@ -1474,7 +1474,8 @@ static void HandleDefinition() {
Function *LF = F->Codegen();
if (LF && VerboseOutput) {
fprintf(stderr, "Read function definition:");
- LF->dump();
+ LF->print(errs());
+ fprintf(stderr, "\n");
}
} else {
// Skip token for error recovery.
@@ -1487,7 +1488,8 @@ static void HandleExtern() {
Function *F = P->Codegen();
if (F && VerboseOutput) {
fprintf(stderr, "Read extern: ");
- F->dump();
+ F->print(errs());
+ fprintf(stderr, "\n");
}
} else {
// Skip token for error recovery.
diff --git a/examples/Kaleidoscope/MCJIT/initial/toy.cpp b/examples/Kaleidoscope/MCJIT/initial/toy.cpp
index 1e476aef786..9b84fd443d6 100644
--- a/examples/Kaleidoscope/MCJIT/initial/toy.cpp
+++ b/examples/Kaleidoscope/MCJIT/initial/toy.cpp
@@ -1252,7 +1252,8 @@ static void HandleDefinition() {
if (Function *LF = F->Codegen()) {
#ifndef MINIMAL_STDERR_OUTPUT
fprintf(stderr, "Read function definition:");
- LF->dump();
+ LF->print(errs());
+ fprintf(stderr, "\n");
#endif
}
} else {
@@ -1266,7 +1267,8 @@ static void HandleExtern() {
if (Function *F = P->Codegen()) {
#ifndef MINIMAL_STDERR_OUTPUT
fprintf(stderr, "Read extern: ");
- F->dump();
+ F->print(errs());
+ fprintf(stderr, "\n");
#endif
}
} else {
@@ -1370,7 +1372,7 @@ int main() {
#ifndef MINIMAL_STDERR_OUTPUT
// Print out all of the generated code.
- TheHelper->dump();
+ TheHelper->print(errs());
#endif
return 0;
diff --git a/examples/Kaleidoscope/MCJIT/lazy/toy-jit.cpp b/examples/Kaleidoscope/MCJIT/lazy/toy-jit.cpp
index f0c5ad5a46d..3caeab4c745 100644
--- a/examples/Kaleidoscope/MCJIT/lazy/toy-jit.cpp
+++ b/examples/Kaleidoscope/MCJIT/lazy/toy-jit.cpp
@@ -1010,7 +1010,8 @@ static void HandleDefinition() {
if (Function *LF = F->Codegen()) {
#ifndef MINIMAL_STDERR_OUTPUT
fprintf(stderr, "Read function definition:");
- LF->dump();
+ LF->print(errs());
+ fprintf(stderr, "\n");
#endif
}
} else {
@@ -1024,7 +1025,8 @@ static void HandleExtern() {
if (Function *F = P->Codegen()) {
#ifndef MINIMAL_STDERR_OUTPUT
fprintf(stderr, "Read extern: ");
- F->dump();
+ F->print(errs());
+ fprintf(stderr, "\n");
#endif
}
} else {
@@ -1157,7 +1159,7 @@ int main(int argc, char **argv) {
// Print out all of the generated code.
TheFPM = 0;
#ifndef MINIMAL_STDERR_OUTPUT
- TheModule->dump();
+ TheModule->print(errs(), nullptr);
#endif
return 0;
}
diff --git a/examples/Kaleidoscope/MCJIT/lazy/toy.cpp b/examples/Kaleidoscope/MCJIT/lazy/toy.cpp
index 37339b60b44..3511f3ac93b 100644
--- a/examples/Kaleidoscope/MCJIT/lazy/toy.cpp
+++ b/examples/Kaleidoscope/MCJIT/lazy/toy.cpp
@@ -1293,7 +1293,8 @@ static void HandleDefinition() {
if (Function *LF = F->Codegen()) {
#ifndef MINIMAL_STDERR_OUTPUT
fprintf(stderr, "Read function definition:");
- LF->dump();
+ LF->print(errs());
+ fprintf(stderr, "\n");
#endif
}
} else {
@@ -1307,7 +1308,8 @@ static void HandleExtern() {
if (Function *F = P->Codegen()) {
#ifndef MINIMAL_STDERR_OUTPUT
fprintf(stderr, "Read extern: ");
- F->dump();
+ F->print(errs());
+ fprintf(stderr, "\n");
#endif
}
} else {