aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lto-bugpoint/LTOBugPoint.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-07-18 23:46:41 +0000
committerDevang Patel <dpatel@apple.com>2008-07-18 23:46:41 +0000
commit5dd66a0bb00b30e492cc4dd332ae54c9c764501a (patch)
tree0e507d913c39aa8492e9080f3cced3d6711b29ff /tools/lto-bugpoint/LTOBugPoint.cpp
parente330f2df415af5b2f5ffd0db85fa0252fd86fded (diff)
downloadexternal_llvm-5dd66a0bb00b30e492cc4dd332ae54c9c764501a.zip
external_llvm-5dd66a0bb00b30e492cc4dd332ae54c9c764501a.tar.gz
external_llvm-5dd66a0bb00b30e492cc4dd332ae54c9c764501a.tar.bz2
If all linker input files are native object files then lto-bugpoint is not useful.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53777 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lto-bugpoint/LTOBugPoint.cpp')
-rw-r--r--tools/lto-bugpoint/LTOBugPoint.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/lto-bugpoint/LTOBugPoint.cpp b/tools/lto-bugpoint/LTOBugPoint.cpp
index 83ed134..925ab9e 100644
--- a/tools/lto-bugpoint/LTOBugPoint.cpp
+++ b/tools/lto-bugpoint/LTOBugPoint.cpp
@@ -13,7 +13,12 @@
//===----------------------------------------------------------------------===//
#include "LTOBugPoint.h"
+#include "llvm/Support/SystemUtils.h"
+#include "llvm/System/Path.h"
+#include <iostream>
+/// LTOBugPoint -- Constructor. Popuate list of linker options and
+/// list of linker input files.
LTOBugPoint::LTOBugPoint(std::istream &args, std::istream &ins) {
// Read linker options. Order is important here.
@@ -26,3 +31,27 @@ LTOBugPoint::LTOBugPoint(std::istream &args, std::istream &ins) {
while(getline(ins, inFile))
LinkerInputFiles.push_back(inFile);
}
+
+/// findTroubleMakers - Find minimum set of input files that causes error
+/// identified by the script.
+bool
+LTOBugPoint::findTroubleMakers(llvm::SmallVector<std::string, 4> &TroubleMakers,
+ std::string &Script) {
+
+ // First, build native object files set.
+ bool bitcodeFileSeen = false;
+ for(llvm::SmallVector<std::string, 16>::iterator I = LinkerInputFiles.begin(),
+ E = LinkerInputFiles.end(); I != E; ++I) {
+ std::string &path = *I;
+ if (llvm::sys::Path(path.c_str()).isBitcodeFile())
+ bitcodeFileSeen = true;
+ }
+
+ if (!bitcodeFileSeen) {
+ std::cerr << "lto-bugpoint: Error: Unable to help!";
+ std::cerr << " Need at least one input file that contains llvm bitcode\n";
+ return false;
+ }
+
+ return true;
+}