Index: llvm/trunk/tools/bugpoint/ExecutionDriver.cpp =================================================================== --- llvm/trunk/tools/bugpoint/ExecutionDriver.cpp +++ llvm/trunk/tools/bugpoint/ExecutionDriver.cpp @@ -17,6 +17,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/FileUtilities.h" +#include "llvm/Support/Program.h" #include "llvm/Support/SystemUtils.h" #include "llvm/Support/raw_ostream.h" #include @@ -124,8 +125,7 @@ cl::ZeroOrMore, cl::PositionalEatsArgs); cl::opt - GCCBinary("gcc", cl::init("gcc"), - cl::desc("The gcc binary to use. (default 'gcc')")); + GCCBinary("gcc", cl::init(""), cl::desc("The gcc binary to use.")); cl::list GCCToolArgv("gcc-tool-args", cl::Positional, @@ -148,6 +148,13 @@ SafeInterpreter = nullptr; std::string Message; + if (GCCBinary.empty()) { + if (sys::findProgramByName("clang")) + GCCBinary = "clang"; + else + GCCBinary = "gcc"; + } + switch (InterpreterSel) { case AutoPick: if (!Interpreter) {