diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-10-25 00:08:19 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-10-25 00:08:19 +0000 |
commit | 3264dcd97024250729183ed6398c5d8a9aa7472d (patch) | |
tree | 46a8db8e8a76f88ecfaac68981d33797134a8b97 /lib/Module/KModule.cpp | |
parent | fa2455723d00587c4478ac876cf5a824d5394cc5 (diff) | |
download | klee-3264dcd97024250729183ed6398c5d8a9aa7472d.tar.gz |
Update source to build against LLVM 2.6
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@85024 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Module/KModule.cpp')
-rw-r--r-- | lib/Module/KModule.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp index c880cba3..108adabd 100644 --- a/lib/Module/KModule.cpp +++ b/lib/Module/KModule.cpp @@ -27,7 +27,9 @@ #include "llvm/ValueSymbolTable.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/raw_ostream.h" +#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR == 6) #include "llvm/Support/raw_os_ostream.h" +#endif #include "llvm/System/Path.h" #include "llvm/Target/TargetData.h" #include "llvm/Transforms/Scalar.h" @@ -327,6 +329,38 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts, std::ostream *os = ih->openOutputFile("assembly.ll"); assert(os && os->good() && "unable to open source output"); +#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR == 6) + // We have an option for this in case the user wants a .ll they + // can compile. + if (NoTruncateSourceLines) { + os << *module; + } else { + bool truncated = false; + std::string string; + llvm::raw_string_ostream rss(string); + rss << *module; + rss.flush(); + const char *position = string.c_str(); + + for (;;) { + const char *end = index(position, '\n'); + if (!end) { + os << position; + break; + } else { + unsigned count = (end - position) + 1; + if (count<255) { + os->write(position, count); + } else { + os->write(position, 254); + os << "\n"; + truncated = true; + } + position = end+1; + } + } + } +#else llvm::raw_os_ostream *ros = new llvm::raw_os_ostream(*os); // We have an option for this in case the user wants a .ll they @@ -360,6 +394,8 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts, } } delete ros; +#endif + delete os; } |