[Orc] Reapply r234815, outputting via stdout instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234908 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Lang Hames 2015-04-14 16:58:05 +00:00
parent daa55a66a0
commit a35d818b9a
2 changed files with 15 additions and 13 deletions

View File

@ -1,7 +1,8 @@
; RUN: lli -jit-kind=orc-lazy %s | FileCheck %s
; RUN: lli -jit-kind=orc-lazy -orc-lazy-debug=funcs-to-stdout %s | FileCheck %s
;
; CHECK: Hello
; CHECK-NEXT: Goodbye
; CHECK: [ {{.*}}main$orc_body ]
; CHECK: Goodbye
%class.Foo = type { i8 }

View File

@ -17,7 +17,7 @@ using namespace llvm;
namespace {
enum class DumpKind { NoDump, DumpFuncsToStdErr, DumpModsToStdErr,
enum class DumpKind { NoDump, DumpFuncsToStdOut, DumpModsToStdErr,
DumpModsToDisk };
cl::opt<DumpKind> OrcDumpKind("orc-lazy-debug",
@ -26,9 +26,9 @@ namespace {
cl::values(
clEnumValN(DumpKind::NoDump, "no-dump",
"Don't dump anything."),
clEnumValN(DumpKind::DumpFuncsToStdErr,
"funcs-to-stderr",
"Dump function names to stderr."),
clEnumValN(DumpKind::DumpFuncsToStdOut,
"funcs-to-stdout",
"Dump function names to stdout."),
clEnumValN(DumpKind::DumpModsToStdErr,
"mods-to-stderr",
"Dump modules to stderr."),
@ -63,21 +63,22 @@ OrcLazyJIT::TransformFtor OrcLazyJIT::createDebugDumper() {
case DumpKind::NoDump:
return [](std::unique_ptr<Module> M) { return std::move(M); };
case DumpKind::DumpFuncsToStdErr:
case DumpKind::DumpFuncsToStdOut:
return [](std::unique_ptr<Module> M) {
dbgs() << "[ ";
printf("[ ");
for (const auto &F : *M) {
if (F.isDeclaration())
continue;
if (F.hasName())
dbgs() << F.getName() << " ";
else
dbgs() << "<anon> ";
if (F.hasName()) {
std::string Name(F.getName());
printf("%s ", Name.c_str());
} else
printf("<anon> ");
}
dbgs() << "]\n";
printf("]\n");
return std::move(M);
};