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

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



Changes in directory llvm/tools/llvm-extract:

llvm-extract.cpp updated: 1.36 -> 1.37
---
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:  (+3 -1)

 llvm-extract.cpp |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)


Index: llvm/tools/llvm-extract/llvm-extract.cpp
diff -u llvm/tools/llvm-extract/llvm-extract.cpp:1.36 llvm/tools/llvm-extract/llvm-extract.cpp:1.37
--- llvm/tools/llvm-extract/llvm-extract.cpp:1.36	Mon Feb  5 15:17:53 2007
+++ llvm/tools/llvm-extract/llvm-extract.cpp	Wed Feb  7 15:41:02 2007
@@ -19,6 +19,7 @@
 #include "llvm/Transforms/IPO.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compressor.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Streams.h"
 #include "llvm/System/Signals.h"
@@ -57,7 +58,8 @@
     cl::ParseCommandLineOptions(argc, argv, " llvm extractor\n");
     sys::PrintStackTraceOnErrorSignal();
 
-    std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename));
+    std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename,
+                                            Compressor::decompressToNewBuffer));
     if (M.get() == 0) {
       cerr << argv[0] << ": bytecode didn't read correctly.\n";
       return 1;






More information about the llvm-commits mailing list