llvm.org GIT mirror llvm / b958ba3
bitcodify, remove eh cruft git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36844 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 13 years ago
2 changed file(s) with 19 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
77 ##===----------------------------------------------------------------------===##
88 LEVEL = ../..
99 TOOLNAME = llvm2cpp
10 LINK_COMPONENTS = bcreader
11 REQUIRES_EH := 1
10 LINK_COMPONENTS = bcreader bitreader
1211
1312 include $(LEVEL)/Makefile.common
1413
1616 //===------------------------------------------------------------------------===
1717
1818 #include "llvm/Module.h"
19 #include "llvm/Bitcode/ReaderWriter.h"
1920 #include "llvm/Bytecode/Reader.h"
2021 #include "llvm/Analysis/Verifier.h"
2122 #include "llvm/Support/CommandLine.h"
2223 #include "llvm/Support/ManagedStatic.h"
24 #include "llvm/Support/MemoryBuffer.h"
2325 #include "llvm/Support/SystemUtils.h"
2426 #include "llvm/System/Signals.h"
2527 #include "CppWriter.h"
2628 #include
2729 #include
2830 #include
31 using namespace llvm;
2932
30 using namespace llvm;
33 cl::opt Bitcode("bitcode");
3134
3235 static cl::opt
3336 InputFilename(cl::Positional, cl::desc(""),
4851 int exitCode = 0;
4952 std::ostream *Out = 0;
5053 std::string ErrorMessage;
51 std::auto_ptr M(ParseBytecodeFile(InputFilename,
52 Compressor::decompressToNewBuffer,
53 &ErrorMessage));
54
55 std::auto_ptr M;
56 if (Bitcode) {
57 std::auto_ptr Buffer(
58 MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size()));
59 if (Buffer.get())
60 M.reset(ParseBitcodeFile(Buffer.get(), &ErrorMessage));
61 else
62 ErrorMessage = "Error reading file '" + InputFilename + "'";
63 } else {
64 M.reset(ParseBytecodeFile(InputFilename,
65 Compressor::decompressToNewBuffer,
66 &ErrorMessage));
67 }
5468 if (M.get() == 0) {
5569 std::cerr << argv[0] << ": ";
5670 if (ErrorMessage.size())