[llvm-commits] CVS: llvm/tools/llvm-dis/llvm-dis.cpp

Chris Lattner sabre at nondot.org
Wed Feb 7 13:41:53 PST 2007



Changes in directory llvm/tools/llvm-dis:

llvm-dis.cpp updated: 1.55 -> 1.56
---
Log message:

push bytecode decompressor out through APIs.  Now the bytecode reader
api's look like this:

ModuleProvider *getBytecodeModuleProvider(
  const std::string &Filename,  ///< Name of file to be read
  BCDecompressor_t *BCDC = Compressor::decompressToNewBuffer,
  std::string* ErrMsg = 0,      ///< Optional error message holder 
  BytecodeHandler* H = 0        ///< Optional handler for reader events
);

This is ugly, but allows a client to say:

  getBytecodeModuleProvider("foo", 0);

If they do this, there is no dependency on the compression libraries, saving
codesize.




---
Diffs of the changes:  (+4 -1)

 llvm-dis.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/tools/llvm-dis/llvm-dis.cpp
diff -u llvm/tools/llvm-dis/llvm-dis.cpp:1.55 llvm/tools/llvm-dis/llvm-dis.cpp:1.56
--- llvm/tools/llvm-dis/llvm-dis.cpp:1.55	Tue Feb  6 22:39:35 2007
+++ llvm/tools/llvm-dis/llvm-dis.cpp	Wed Feb  7 15:41:02 2007
@@ -20,6 +20,7 @@
 #include "llvm/PassManager.h"
 #include "llvm/Bytecode/Reader.h"
 #include "llvm/Assembly/PrintModulePass.h"
+#include "llvm/Support/Compressor.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Streams.h"
@@ -51,7 +52,9 @@
     std::ostream *Out = &std::cout;  // Default to printing to stdout.
     std::string ErrorMessage;
 
-    std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename, &ErrorMessage));
+    std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename, 
+                                              Compressor::decompressToNewBuffer,
+                                              &ErrorMessage));
     if (M.get() == 0) {
       cerr << argv[0] << ": ";
       if (ErrorMessage.size())






More information about the llvm-commits mailing list