From 03b696376219945d67caffda1995d12e3410f05b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 6 May 2007 05:47:06 +0000 Subject: add bitcode support git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36849 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/bugpoint/BugDriver.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tools/bugpoint/BugDriver.cpp') 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 #include - 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 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; -- cgit v1.2.3