summaryrefslogtreecommitdiff
path: root/klee/tools
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-09-01 06:53:41 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-09-01 06:53:41 +0000
commitce28421d2f92ee3023de4e130a2f71331216e3b1 (patch)
tree443e78a903328a45829265052edafe849fe928f4 /klee/tools
parentd31141dda0c9a66874cb936a6746d34adb201e0f (diff)
Update for LLVM ostream changes.
- Includes patch by Michael Stone!
Diffstat (limited to 'klee/tools')
-rw-r--r--klee/tools/kleaver/main.cpp44
-rw-r--r--klee/tools/klee/Debug.cpp8
-rw-r--r--klee/tools/klee/main.cpp38
3 files changed, 46 insertions, 44 deletions
diff --git a/klee/tools/kleaver/main.cpp b/klee/tools/kleaver/main.cpp
index 07de27844e6..c489612f5ee 100644
--- a/klee/tools/kleaver/main.cpp
+++ b/klee/tools/kleaver/main.cpp
@@ -1,3 +1,5 @@
+#include <iostream>
+
#include "expr/Lexer.h"
#include "expr/Parser.h"
@@ -99,7 +101,7 @@ static void PrintInputTokens(const MemoryBuffer *MB) {
Token T;
do {
L.Lex(T);
- llvm::cout << "(Token \"" << T.getKindName() << "\" "
+ std::cout << "(Token \"" << T.getKindName() << "\" "
<< "\"" << escapedString(T.start, T.length) << "\" "
<< T.length << " "
<< T.line << " " << T.column << ")\n";
@@ -117,7 +119,7 @@ static bool PrintInputAST(const char *Filename,
while (Decl *D = P->ParseTopLevelDecl()) {
if (!P->GetNumErrors()) {
if (isa<QueryCommand>(D))
- llvm::cout << "# Query " << ++NumQueries << "\n";
+ std::cout << "# Query " << ++NumQueries << "\n";
D->dump();
}
@@ -126,7 +128,7 @@ static bool PrintInputAST(const char *Filename,
bool success = true;
if (unsigned N = P->GetNumErrors()) {
- llvm::cerr << Filename << ": parse failure: "
+ std::cerr << Filename << ": parse failure: "
<< N << " errors.\n";
success = false;
}
@@ -152,7 +154,7 @@ static bool EvaluateInputAST(const char *Filename,
bool success = true;
if (unsigned N = P->GetNumErrors()) {
- llvm::cerr << Filename << ": parse failure: "
+ std::cerr << Filename << ": parse failure: "
<< N << " errors.\n";
success = false;
}
@@ -178,16 +180,16 @@ static bool EvaluateInputAST(const char *Filename,
ie = Decls.end(); it != ie; ++it) {
Decl *D = *it;
if (QueryCommand *QC = dyn_cast<QueryCommand>(D)) {
- llvm::cout << "Query " << Index << ":\t";
+ std::cout << "Query " << Index << ":\t";
assert("FIXME: Support counterexample query commands!");
if (QC->Values.empty() && QC->Objects.empty()) {
bool result;
if (S->mustBeTrue(Query(ConstraintManager(QC->Constraints), QC->Query),
result)) {
- llvm::cout << (result ? "VALID" : "INVALID");
+ std::cout << (result ? "VALID" : "INVALID");
} else {
- llvm::cout << "FAIL";
+ std::cout << "FAIL";
}
} else if (!QC->Values.empty()) {
assert(QC->Objects.empty() &&
@@ -200,10 +202,10 @@ static bool EvaluateInputAST(const char *Filename,
if (S->getValue(Query(ConstraintManager(QC->Constraints),
QC->Values[0]),
result)) {
- llvm::cout << "INVALID\n";
- llvm::cout << "\tExpr 0:\t" << result;
+ std::cout << "INVALID\n";
+ std::cout << "\tExpr 0:\t" << result;
} else {
- llvm::cout << "FAIL";
+ std::cout << "FAIL";
}
} else {
std::vector< std::vector<unsigned char> > result;
@@ -211,27 +213,27 @@ static bool EvaluateInputAST(const char *Filename,
if (S->getInitialValues(Query(ConstraintManager(QC->Constraints),
QC->Query),
QC->Objects, result)) {
- llvm::cout << "INVALID\n";
+ std::cout << "INVALID\n";
for (unsigned i = 0, e = result.size(); i != e; ++i) {
- llvm::cout << "\tArray " << i << ":\t"
+ std::cout << "\tArray " << i << ":\t"
<< QC->Objects[i]->name
<< "[";
for (unsigned j = 0; j != QC->Objects[i]->size; ++j) {
- llvm::cout << (unsigned) result[i][j];
+ std::cout << (unsigned) result[i][j];
if (j + 1 != QC->Objects[i]->size)
- llvm::cout << ", ";
+ std::cout << ", ";
}
- llvm::cout << "]";
+ std::cout << "]";
if (i + 1 != e)
- llvm::cout << "\n";
+ std::cout << "\n";
}
} else {
- llvm::cout << "FAIL";
+ std::cout << "FAIL";
}
}
- llvm::cout << "\n";
+ std::cout << "\n";
++Index;
}
}
@@ -244,7 +246,7 @@ static bool EvaluateInputAST(const char *Filename,
delete S;
if (uint64_t queries = *theStatisticManager->getStatisticByName("Queries")) {
- llvm::cout
+ std::cout
<< "--\n"
<< "total queries = " << queries << "\n"
<< "total queries constructs = "
@@ -269,7 +271,7 @@ int main(int argc, char **argv) {
std::string ErrorStr;
MemoryBuffer *MB = MemoryBuffer::getFileOrSTDIN(InputFile.c_str(), &ErrorStr);
if (!MB) {
- llvm::cerr << argv[0] << ": error: " << ErrorStr << "\n";
+ std::cerr << argv[0] << ": error: " << ErrorStr << "\n";
return 1;
}
@@ -302,7 +304,7 @@ int main(int argc, char **argv) {
MB, Builder);
break;
default:
- llvm::cerr << argv[0] << ": error: Unknown program action!\n";
+ std::cerr << argv[0] << ": error: Unknown program action!\n";
}
delete Builder;
diff --git a/klee/tools/klee/Debug.cpp b/klee/tools/klee/Debug.cpp
index d11a79a7d4c..3d46de032c2 100644
--- a/klee/tools/klee/Debug.cpp
+++ b/klee/tools/klee/Debug.cpp
@@ -2,11 +2,11 @@
#include <iostream>
void kdb_printExpr(klee::Expr *e) {
- llvm::cerr << "expr: " << e << " -- ";
+ std::cerr << "expr: " << e << " -- ";
if (e) {
- llvm::cerr << *e;
+ std::cerr << *e;
} else {
- llvm::cerr << "(null)";
+ std::cerr << "(null)";
}
- llvm::cerr << "\n";
+ std::cerr << "\n";
}
diff --git a/klee/tools/klee/main.cpp b/klee/tools/klee/main.cpp
index f7a8f0bfac6..2c418fc83be 100644
--- a/klee/tools/klee/main.cpp
+++ b/klee/tools/klee/main.cpp
@@ -269,7 +269,7 @@ KleeHandler::KleeHandler(int argc, char **argv)
}
}
- llvm::cerr << "KLEE: output directory = \"" << dirname << "\"\n";
+ std::cerr << "KLEE: output directory = \"" << dirname << "\"\n";
llvm::sys::Path klee_last(directory);
klee_last.appendComponent("klee-last");
@@ -296,7 +296,7 @@ KleeHandler::KleeHandler(int argc, char **argv)
strcpy(m_outputDirectory, p.c_str());
if (mkdir(m_outputDirectory, 0775) < 0) {
- llvm::cerr << "KLEE: ERROR: Unable to make output directory: \""
+ std::cerr << "KLEE: ERROR: Unable to make output directory: \""
<< m_outputDirectory
<< "\", refusing to overwrite.\n";
exit(1);
@@ -377,7 +377,7 @@ void KleeHandler::processTestCase(const ExecutionState &state,
const char *errorMessage,
const char *errorSuffix) {
if (errorMessage && ExitOnError) {
- llvm::cerr << "EXITING ON ERROR:\n" << errorMessage << "\n";
+ std::cerr << "EXITING ON ERROR:\n" << errorMessage << "\n";
exit(1);
}
@@ -517,13 +517,13 @@ void KleeHandler::getOutFiles(std::string path,
std::set<llvm::sys::Path> contents;
std::string error;
if (p.getDirectoryContents(contents, &error)) {
- llvm::cerr << "ERROR: unable to read output directory: " << path
+ std::cerr << "ERROR: unable to read output directory: " << path
<< ": " << error << "\n";
exit(1);
}
for (std::set<llvm::sys::Path>::iterator it = contents.begin(),
ie = contents.end(); it != ie; ++it) {
- std::string f = it->toString();
+ std::string f = it->str();
if (f.substr(f.size()-6,f.size()) == ".ktest") {
results.push_back(f);
}
@@ -602,7 +602,7 @@ static int initEnv(Module *mainModule) {
Function *mainFn = mainModule->getFunction("main");
if (mainFn->arg_size() < 2) {
- llvm::cerr << "Cannot handle ""-init-env"" when main() has less than two arguments.\n";
+ std::cerr << "Cannot handle ""-init-env"" when main() has less than two arguments.\n";
return -1;
}
@@ -876,11 +876,11 @@ void stop_forking() {
static void interrupt_handle() {
if (!interrupted && theInterpreter) {
- llvm::cerr << "KLEE: ctrl-c detected, requesting interpreter to halt.\n";
+ std::cerr << "KLEE: ctrl-c detected, requesting interpreter to halt.\n";
halt_execution();
sys::SetInterruptFunction(interrupt_handle);
} else {
- llvm::cerr << "KLEE: ctrl-c detected, exiting.\n";
+ std::cerr << "KLEE: ctrl-c detected, exiting.\n";
exit(1);
}
interrupted = true;
@@ -1200,7 +1200,7 @@ int main(int argc, char **argv, char **envp) {
// locale and other data and then calls main.
Function *mainFn = mainModule->getFunction("main");
if (!mainFn) {
- llvm::cerr << "'main' function not found in module.\n";
+ std::cerr << "'main' function not found in module.\n";
return -1;
}
@@ -1294,7 +1294,7 @@ int main(int argc, char **argv, char **envp) {
if (out) {
kTests.push_back(out);
} else {
- llvm::cerr << "KLEE: unable to open: " << *it << "\n";
+ std::cerr << "KLEE: unable to open: " << *it << "\n";
}
}
@@ -1311,7 +1311,7 @@ int main(int argc, char **argv, char **envp) {
it != ie; ++it) {
KTest *out = *it;
interpreter->setReplayOut(out);
- llvm::cerr << "KLEE: replaying: " << *it << " (" << kTest_numBytes(out) << " bytes)"
+ std::cerr << "KLEE: replaying: " << *it << " (" << kTest_numBytes(out) << " bytes)"
<< " (" << ++i << "/" << outFiles.size() << ")\n";
// XXX should put envp in .ktest ?
interpreter->runFunctionAsMain(mainFn, out->numArgs, out->args, pEnvp);
@@ -1329,7 +1329,7 @@ int main(int argc, char **argv, char **envp) {
it != ie; ++it) {
KTest *out = kTest_fromFile(it->c_str());
if (!out) {
- llvm::cerr << "KLEE: unable to open: " << *it << "\n";
+ std::cerr << "KLEE: unable to open: " << *it << "\n";
exit(1);
}
seeds.push_back(out);
@@ -1344,19 +1344,19 @@ int main(int argc, char **argv, char **envp) {
it2 != ie; ++it2) {
KTest *out = kTest_fromFile(it2->c_str());
if (!out) {
- llvm::cerr << "KLEE: unable to open: " << *it2 << "\n";
+ std::cerr << "KLEE: unable to open: " << *it2 << "\n";
exit(1);
}
seeds.push_back(out);
}
if (outFiles.empty()) {
- llvm::cerr << "KLEE: seeds directory is empty: " << *it << "\n";
+ std::cerr << "KLEE: seeds directory is empty: " << *it << "\n";
exit(1);
}
}
if (!seeds.empty()) {
- llvm::cerr << "KLEE: using " << seeds.size() << " seeds\n";
+ std::cerr << "KLEE: using " << seeds.size() << " seeds\n";
interpreter->useSeeds(&seeds);
}
if (RunInDir != "") {
@@ -1421,12 +1421,12 @@ int main(int argc, char **argv, char **envp) {
std::stringstream stats;
stats << "\n";
stats << "KLEE: done: total instructions = "
- << instructions << "\n";
+ << instructions << "\n";
stats << "KLEE: done: completed paths = "
- << handler->getNumPathsExplored() << "\n";
+ << handler->getNumPathsExplored() << "\n";
stats << "KLEE: done: generated tests = "
- << handler->getNumTestCases() << "\n";
- llvm::cerr << stats.str();
+ << handler->getNumTestCases() << "\n";
+ std::cerr << stats.str();
handler->getInfoStream() << stats.str();
delete handler;