aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-dis/llvm-dis.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-22 06:31:02 +0000
committerChris Lattner <sabre@nondot.org>2007-04-22 06:31:02 +0000
commitb3ca3622bbb75f939173236f4e82e3e9b345630a (patch)
tree163e969fd3bc269d5944fb1cdebc6f1788f69d5d /tools/llvm-dis/llvm-dis.cpp
parent27bb3af61c44f92bb3939e7020ee61fb0779e46a (diff)
teach llvm-dis to read bitcode files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36334 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-dis/llvm-dis.cpp')
-rw-r--r--tools/llvm-dis/llvm-dis.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp
index 38b863c20c..7a8bf5afc8 100644
--- a/tools/llvm-dis/llvm-dis.cpp
+++ b/tools/llvm-dis/llvm-dis.cpp
@@ -18,6 +18,7 @@
#include "llvm/Module.h"
#include "llvm/PassManager.h"
+#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Bytecode/Reader.h"
#include "llvm/Assembly/PrintModulePass.h"
#include "llvm/Support/Compressor.h"
@@ -52,9 +53,13 @@ int main(int argc, char **argv) {
std::ostream *Out = &std::cout; // Default to printing to stdout.
std::string ErrorMessage;
- std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename,
- Compressor::decompressToNewBuffer,
- &ErrorMessage));
+ std::auto_ptr<Module> M;
+
+ M.reset(ParseBitcodeFile(InputFilename, &ErrorMessage));
+
+ if (M.get() == 0)
+ M.reset(ParseBytecodeFile(InputFilename,Compressor::decompressToNewBuffer,
+ &ErrorMessage));
if (M.get() == 0) {
cerr << argv[0] << ": ";
if (ErrorMessage.size())