summaryrefslogtreecommitdiff
path: root/tools/bugpoint/BugDriver.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-05-06 05:47:06 +0000
committerChris Lattner <sabre@nondot.org>2007-05-06 05:47:06 +0000
commit03b696376219945d67caffda1995d12e3410f05b (patch)
tree8ea1373739d0fa82791130f9e878819a0b1601e5 /tools/bugpoint/BugDriver.cpp
parente3c55a52f888701c9003fb4bacd866fda06ae113 (diff)
downloadllvm-03b696376219945d67caffda1995d12e3410f05b.tar.gz
llvm-03b696376219945d67caffda1995d12e3410f05b.tar.bz2
llvm-03b696376219945d67caffda1995d12e3410f05b.tar.xz
add bitcode support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36849 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/BugDriver.cpp')
-rw-r--r--tools/bugpoint/BugDriver.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp
index b2a8f030c5..fe290805e4 100644
--- a/tools/bugpoint/BugDriver.cpp
+++ b/tools/bugpoint/BugDriver.cpp
@@ -19,13 +19,14 @@
#include "llvm/Module.h"
#include "llvm/Pass.h"
#include "llvm/Assembly/Parser.h"
+#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Bytecode/Reader.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compressor.h"
#include "llvm/Support/FileUtilities.h"
+#include "llvm/Support/MemoryBuffer.h"
#include <iostream>
#include <memory>
-
using namespace llvm;
// Anonymous namespace to define command line options for debugging.
@@ -77,6 +78,13 @@ Module *llvm::ParseInputFile(const std::string &InputFilename) {
ParseError Err;
Module *Result = ParseBytecodeFile(InputFilename,
Compressor::decompressToNewBuffer);
+ if (!Result) {
+ std::auto_ptr<MemoryBuffer> Buffer(
+ MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size()));
+ if (Buffer.get())
+ Result = ParseBitcodeFile(Buffer.get());
+ }
+
if (!Result && !(Result = ParseAssemblyFile(InputFilename,&Err))) {
std::cerr << "bugpoint: " << Err.getMessage() << "\n";
Result = 0;