//===- CompilerDriver.cpp - The LLVM Compiler Driver ------------*- C++ -*-===//
//
-//
+//
// The LLVM Compiler Infrastructure
//
-// This file was developed by Reid Spencer and is distributed under the
-// University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
//===----------------------------------------------------------------------===//
//
// This file implements the bulk of the LLVM Compiler Driver (llvmc).
//
-//===------------------------------------------------------------------------===
+//===----------------------------------------------------------------------===//
#include "CompilerDriver.h"
#include "ConfigLexer.h"
#include "llvm/Module.h"
-#include "llvm/Bytecode/Reader.h"
+#include "llvm/ModuleProvider.h"
+#include "llvm/Bitcode/ReaderWriter.h"
+#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Timer.h"
#include "llvm/System/Signals.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/Config/alloca.h"
#include <iostream>
-
using namespace llvm;
+
namespace {
void WriteAction(CompilerDriver::Action* action ) {
std::cerr << action->program.c_str();
- std::vector<std::string>::iterator I = action->args.begin();
+ std::vector<std::string>::const_iterator I = action->args.begin();
while (I != action->args.end()) {
- std::cerr << " " + *I;
+ std::cerr << ' ' << *I;
++I;
}
- std::cerr << "\n";
+ std::cerr << '\n';
}
void DumpAction(CompilerDriver::Action* action) {
std::cerr << "command = " << action->program.c_str();
- std::vector<std::string>::iterator I = action->args.begin();
+ std::vector<std::string>::const_iterator I = action->args.begin();
while (I != action->args.end()) {
- std::cerr << " " + *I;
+ std::cerr << ' ' << *I;
++I;
}
- std::cerr << "\n";
- std::cerr << "flags = " << action->flags << "\n";
+ std::cerr << '\n';
+ std::cerr << "flags = " << action->flags << '\n';
}
void DumpConfigData(CompilerDriver::ConfigData* cd, const std::string& type ){
- std::cerr << "Configuration Data For '" << cd->langName << "' (" << type
+ std::cerr << "Configuration Data For '" << cd->langName << "' (" << type
<< ")\n";
std::cerr << "PreProcessor: ";
DumpAction(&cd->PreProcessor);
DumpAction(&cd->Linker);
}
-/// This specifies the passes to run for OPT_FAST_COMPILE (-O1)
-/// which should reduce the volume of code and make compilation
-/// faster. This is also safe on any llvm module.
-static const char* DefaultFastCompileOptimizations[] = {
- "-simplifycfg", "-mem2reg", "-instcombine"
-};
+static bool GetBitcodeDependentLibraries(const std::string &fname,
+ Module::LibraryListType& deplibs,
+ std::string* ErrMsg) {
+ ModuleProvider *MP = 0;
+ if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(fname)) {
+ MP = getBitcodeModuleProvider(Buffer);
+ if (MP == 0) delete Buffer;
+ }
+ if (!MP) {
+ deplibs.clear();
+ return true;
+ }
+ deplibs = MP->getModule()->getLibraries();
+ delete MP;
+ return false;
+}
+
class CompilerDriverImpl : public CompilerDriver {
/// @name Constructors
CompilerDriverImpl(ConfigDataProvider& confDatProv )
: cdp(&confDatProv)
, finalPhase(LINKING)
- , optLevel(OPT_FAST_COMPILE)
+ , optLevel(OPT_FAST_COMPILE)
, Flags(0)
, machine()
, LibraryPaths()
, TempDir()
, AdditionalArgs()
{
- TempDir = sys::Path::GetTemporaryDirectory();
- sys::RemoveDirectoryOnSignal(TempDir);
AdditionalArgs.reserve(NUM_PHASES);
StringVector emptyVec;
for (unsigned i = 0; i < NUM_PHASES; ++i)
/// @name Methods
/// @{
public:
- virtual void setFinalPhase( Phases phase ) {
- finalPhase = phase;
+ virtual void setFinalPhase(Phases phase) {
+ finalPhase = phase;
}
- virtual void setOptimization( OptimizationLevels level ) {
- optLevel = level;
+ virtual void setOptimization(OptimizationLevels level) {
+ optLevel = level;
}
- virtual void setDriverFlags( unsigned flags ) {
- Flags = flags & DRIVER_FLAGS_MASK;
+ virtual void setDriverFlags(unsigned flags) {
+ Flags = flags & DRIVER_FLAGS_MASK;
}
- virtual void setOutputMachine( const std::string& machineName ) {
+ virtual void setOutputMachine(const std::string& machineName) {
machine = machineName;
}
StringVector::const_iterator E = paths.end();
while (I != E) {
sys::Path tmp;
- tmp.setDirectory(*I);
+ tmp.set(*I);
IncludePaths.push_back(tmp);
++I;
}
StringVector::const_iterator E = paths.end();
while (I != E) {
sys::Path tmp;
- tmp.setDirectory(*I);
+ tmp.set(*I);
LibraryPaths.push_back(tmp);
++I;
}
}
- virtual void addLibraryPath( const sys::Path& libPath ) {
+ virtual void addLibraryPath(const sys::Path& libPath) {
LibraryPaths.push_back(libPath);
}
- virtual void addToolPath( const sys::Path& toolPath ) {
+ virtual void addToolPath(const sys::Path& toolPath) {
ToolPaths.push_back(toolPath);
}
void cleanup() {
if (!isSet(KEEP_TEMPS_FLAG)) {
- if (TempDir.isDirectory() && TempDir.writable())
- TempDir.destroyDirectory(/*remove_contents=*/true);
+ const sys::FileStatus *Status = TempDir.getFileStatus();
+ if (Status && Status->isDir)
+ TempDir.eraseFromDisk(/*remove_contents=*/true);
} else {
std::cout << "Temporary files are in " << TempDir << "\n";
}
}
- sys::Path MakeTempFile(const std::string& basename,
- const std::string& suffix ) {
+ sys::Path MakeTempFile(const std::string& basename,
+ const std::string& suffix,
+ std::string* ErrMsg) {
+ if (TempDir.isEmpty()) {
+ TempDir = sys::Path::GetTemporaryDirectory(ErrMsg);
+ if (TempDir.isEmpty())
+ return sys::Path();
+ sys::RemoveDirectoryOnSignal(TempDir);
+ }
sys::Path result(TempDir);
- if (!result.appendFile(basename))
- throw basename + ": can't use this file name";
- if (!result.appendSuffix(suffix))
- throw suffix + ": can't use this file suffix";
+ if (!result.appendComponent(basename)) {
+ if (ErrMsg)
+ *ErrMsg = basename + ": can't use this file name";
+ return sys::Path();
+ }
+ if (!result.appendSuffix(suffix)) {
+ if (ErrMsg)
+ *ErrMsg = suffix + ": can't use this file suffix";
+ return sys::Path();
+ }
return result;
}
- Action* GetAction(ConfigData* cd,
- const sys::Path& input,
+ Action* GetAction(ConfigData* cd,
+ const sys::Path& input,
const sys::Path& output,
Phases phase)
{
assert(pat != 0 && "Invalid command pattern");
// Copy over some pattern things that don't need to change
- action->program = pat->program;
action->flags = pat->flags;
+ // See if program starts with wildcard...
+ std::string programName=pat->program.toString();
+ if (programName[0] == '%' && programName.length() >2) {
+ switch(programName[1]){
+ case 'b':
+ if (programName.substr(0,8) == "%bindir%") {
+ std::string tmp(LLVM_BINDIR);
+ tmp.append(programName.substr(8));
+ pat->program.set(tmp);
+ }
+ break;
+ case 'l':
+ if (programName.substr(0,12) == "%llvmgccdir%"){
+ std::string tmp(LLVMGCCDIR);
+ tmp.append(programName.substr(12));
+ pat->program.set(tmp);
+ }else if (programName.substr(0,13) == "%llvmgccarch%"){
+ std::string tmp(LLVMGCCARCH);
+ tmp.append(programName.substr(13));
+ pat->program.set(tmp);
+ }else if (programName.substr(0,9) == "%llvmgcc%"){
+ std::string tmp(LLVMGCC);
+ tmp.append(programName.substr(9));
+ pat->program.set(tmp);
+ }else if (programName.substr(0,9) == "%llvmgxx%"){
+ std::string tmp(LLVMGXX);
+ tmp.append(programName.substr(9));
+ pat->program.set(tmp);
+ }else if (programName.substr(0,9) == "%llvmcc1%"){
+ std::string tmp(LLVMCC1);
+ tmp.append(programName.substr(9));
+ pat->program.set(tmp);
+ }else if (programName.substr(0,13) == "%llvmcc1plus%"){
+ std::string tmp(LLVMCC1PLUS);
+ tmp.append(programName.substr(13));
+ pat->program.set(tmp);
+ }else if (programName.substr(0,8) == "%libdir%") {
+ std::string tmp(LLVM_LIBDIR);
+ tmp.append(programName.substr(8));
+ pat->program.set(tmp);
+ }
+ break;
+ }
+ }
+ action->program = pat->program;
+
// Do the substitutions from the pattern to the actual
StringVector::iterator PI = pat->args.begin();
StringVector::iterator PE = pat->args.end();
// Get specific options for each kind of action type
StringVector& addargs = AdditionalArgs[phase];
// Add specific options for each kind of action type
- action->args.insert(action->args.end(), addargs.begin(),
+ action->args.insert(action->args.end(), addargs.begin(),
addargs.end());
}
} else
found = false;
break;
+ case 'b':
+ if (*PI == "%bindir%") {
+ std::string tmp(*PI);
+ tmp.replace(0,8,LLVM_BINDIR);
+ action->args.push_back(tmp);
+ } else
+ found = false;
+ break;
case 'd':
if (*PI == "%defs%") {
StringVector::iterator I = Defines.begin();
case 'f':
if (*PI == "%fOpts%") {
if (!fOptions.empty())
- action->args.insert(action->args.end(), fOptions.begin(),
+ action->args.insert(action->args.end(), fOptions.begin(),
fOptions.end());
} else
found = false;
found = false;
break;
case 'l':
- if (*PI == "%libs%") {
+ if ((*PI)[1] == 'l') {
+ std::string tmp(*PI);
+ if (*PI == "%llvmgccdir%")
+ tmp.replace(0,12,LLVMGCCDIR);
+ else if (*PI == "%llvmgccarch%")
+ tmp.replace(0,13,LLVMGCCARCH);
+ else if (*PI == "%llvmgcc%")
+ tmp.replace(0,9,LLVMGCC);
+ else if (*PI == "%llvmgxx%")
+ tmp.replace(0,9,LLVMGXX);
+ else if (*PI == "%llvmcc1%")
+ tmp.replace(0,9,LLVMCC1);
+ else if (*PI == "%llvmcc1plus%")
+ tmp.replace(0,9,LLVMCC1);
+ else
+ found = false;
+ if (found)
+ action->args.push_back(tmp);
+ } else if (*PI == "%libs%") {
PathVector::iterator I = LibraryPaths.begin();
PathVector::iterator E = LibraryPaths.end();
while (I != E) {
action->args.push_back( std::string("-L") + I->toString() );
++I;
}
+ } else if (*PI == "%libdir%") {
+ std::string tmp(*PI);
+ tmp.replace(0,8,LLVM_LIBDIR);
+ action->args.push_back(tmp);
} else
found = false;
break;
action->args.push_back(output.toString());
} else if (*PI == "%opt%") {
if (!isSet(EMIT_RAW_FLAG)) {
- if (cd->opts.size() > static_cast<unsigned>(optLevel) &&
+ if (cd->opts.size() > static_cast<unsigned>(optLevel) &&
!cd->opts[optLevel].empty())
- action->args.insert(action->args.end(),
+ action->args.insert(action->args.end(),
cd->opts[optLevel].begin(),
cd->opts[optLevel].end());
else
- throw std::string("Optimization options for level ") +
+ throw std::string("Optimization options for level ") +
utostr(unsigned(optLevel)) + " were not specified";
}
} else
case 'M':
if (*PI == "%Mopts%") {
if (!MOptions.empty())
- action->args.insert(action->args.end(), MOptions.begin(),
+ action->args.insert(action->args.end(), MOptions.begin(),
MOptions.end());
} else
found = false;
if (*PI == "%Wopts%") {
for (StringVector::iterator I = WOptions.begin(),
E = WOptions.end(); I != E ; ++I ) {
- action->args.push_back( std::string("-W") + *I );
+ action->args.push_back(std::string("-W") + *I);
}
} else
found = false;
}
if (!found) {
// Did it even look like a substitution?
- if (PI->length()>1 && (*PI)[0] == '%' &&
+ if (PI->length()>1 && (*PI)[0] == '%' &&
(*PI)[PI->length()-1] == '%') {
throw std::string("Invalid substitution token: '") + *PI +
"' for command '" + pat->program.toString() + "'";
return action;
}
- bool DoAction(Action*action) {
+ int DoAction(Action*action, std::string& ErrMsg) {
assert(action != 0 && "Invalid Action!");
if (isSet(VERBOSE_FLAG))
WriteAction(action);
if (progpath.isEmpty())
throw std::string("Can't find program '" +
action->program.toString()+"'");
- else if (progpath.executable())
+ else if (progpath.canExecute())
action->program = progpath;
else
throw std::string("Program '"+action->program.toString()+
"' is not executable.");
// Invoke the program
+ const char** Args = (const char**)
+ alloca(sizeof(const char*)*(action->args.size()+2));
+ Args[0] = action->program.toString().c_str();
+ for (unsigned i = 1; i <= action->args.size(); ++i)
+ Args[i] = action->args[i-1].c_str();
+ Args[action->args.size()+1] = 0; // null terminate list.
if (isSet(TIME_ACTIONS_FLAG)) {
Timer timer(action->program.toString());
timer.startTimer();
int resultCode =
- sys::Program::ExecuteAndWait(action->program,action->args);
+ sys::Program::ExecuteAndWait(action->program, Args,0,0,0,0, &ErrMsg);
timer.stopTimer();
timer.print(timer,std::cerr);
- return resultCode == 0;
+ return resultCode;
}
else
- return 0 ==
- sys::Program::ExecuteAndWait(action->program, action->args);
+ return
+ sys::Program::ExecuteAndWait(action->program, Args, 0,0,0,0, &ErrMsg);
}
- return true;
+ return 0;
}
/// This method tries various variants of a linkage item's file
llvm::sys::Path GetPathForLinkageItem(const std::string& link_item,
bool native = false) {
sys::Path fullpath;
- fullpath.setFile(link_item);
- if (fullpath.readable())
+ fullpath.set(link_item);
+ if (fullpath.canRead())
return fullpath;
- for (PathVector::iterator PI = LibraryPaths.begin(),
+ for (PathVector::iterator PI = LibraryPaths.begin(),
PE = LibraryPaths.end(); PI != PE; ++PI) {
- fullpath.setDirectory(PI->toString());
- fullpath.appendFile(link_item);
- if (fullpath.readable())
+ fullpath.set(PI->toString());
+ fullpath.appendComponent(link_item);
+ if (fullpath.canRead())
return fullpath;
if (native) {
fullpath.appendSuffix("a");
} else {
fullpath.appendSuffix("bc");
- if (fullpath.readable())
+ if (fullpath.canRead())
return fullpath;
- fullpath.elideSuffix();
+ fullpath.eraseSuffix();
fullpath.appendSuffix("o");
- if (fullpath.readable())
+ if (fullpath.canRead())
return fullpath;
fullpath = *PI;
- fullpath.appendFile(std::string("lib") + link_item);
+ fullpath.appendComponent(std::string("lib") + link_item);
fullpath.appendSuffix("a");
- if (fullpath.readable())
+ if (fullpath.canRead())
return fullpath;
- fullpath.elideSuffix();
+ fullpath.eraseSuffix();
fullpath.appendSuffix("so");
- if (fullpath.readable())
+ if (fullpath.canRead())
return fullpath;
}
}
}
/// This method processes a linkage item. The item could be a
- /// Bytecode file needing translation to native code and that is
- /// dependent on other bytecode libraries, or a native code
+ /// Bitcode file needing translation to native code and that is
+ /// dependent on other bitcode libraries, or a native code
/// library that should just be linked into the program.
bool ProcessLinkageItem(const llvm::sys::Path& link_item,
SetVector<sys::Path>& set,
// First, see if the unadorned file name is not readable. If so,
// we must track down the file in the lib search path.
sys::Path fullpath;
- if (!link_item.readable()) {
+ if (!link_item.canRead()) {
// look for the library using the -L arguments specified
// on the command line.
fullpath = GetPathForLinkageItem(link_item.toString());
// If we didn't find the file in any of the library search paths
// we have to bail. No where else to look.
if (fullpath.isEmpty()) {
- err =
+ err =
std::string("Can't find linkage item '") + link_item.toString() + "'";
return false;
}
// If we got here fullpath is the path to the file, and its readable.
set.insert(fullpath);
- // If its an LLVM bytecode file ...
- if (fullpath.isBytecodeFile()) {
+ // If its an LLVM bitcode file ...
+ if (fullpath.isBitcodeFile()) {
// Process the dependent libraries recursively
Module::LibraryListType modlibs;
- if (GetBytecodeDependentLibraries(fullpath.toString(),modlibs)) {
+ if (GetBitcodeDependentLibraries(fullpath.toString(),modlibs, &err)) {
// Traverse the dependent libraries list
Module::lib_iterator LI = modlibs.begin();
Module::lib_iterator LE = modlibs.end();
while ( LI != LE ) {
if (!ProcessLinkageItem(sys::Path(*LI),set,err)) {
if (err.empty()) {
- err = std::string("Library '") + *LI +
+ err = std::string("Library '") + *LI +
"' is not valid for linking but is required by file '" +
fullpath.toString() + "'";
} else {
}
} else if (err.empty()) {
err = std::string(
- "The dependent libraries could not be extracted from '") +
+ "The dependent libraries could not be extracted from '") +
fullpath.toString();
return false;
- }
+ } else
+ return false;
}
return true;
}
/// @name Methods
/// @{
public:
- virtual int execute(const InputList& InpList, const sys::Path& Output ) {
+ virtual int execute(const InputList& InpList, const sys::Path& Output, std::string& ErrMsg ) {
try {
// Echo the configuration of options if we're running verbose
if (isSet(DEBUG_FLAG)) {
std::cerr << "OutputMachine = " << machine << "\n";
InputList::const_iterator I = InpList.begin();
while ( I != InpList.end() ) {
- std::cerr << "Input: " << I->first << "(" << I->second
+ std::cerr << "Input: " << I->first << "(" << I->second
<< ")\n";
++I;
}
/// PRE-PROCESSING / TRANSLATION / OPTIMIZATION / ASSEMBLY phases
// for each input item
SetVector<sys::Path> LinkageItems;
- std::vector<std::string> LibFiles;
+ StringVector LibFiles;
InputList::const_iterator I = InpList.begin();
for (InputList::const_iterator I = InpList.begin(), E = InpList.end();
I != E; ++I ) {
// Get the suffix of the file name
const std::string& ftype = I->second;
- // If its a library, bytecode file, or object file, save
- // it for linking below and short circuit the
+ // If its a library, bitcode file, or object file, save
+ // it for linking below and short circuit the
// pre-processing/translation/assembly phases
if (ftype.empty() || ftype == "o" || ftype == "bc" || ftype=="a") {
- // We shouldn't get any of these types of files unless we're
+ // We shouldn't get any of these types of files unless we're
// later going to link. Enforce this limit now.
if (finalPhase != LINKING) {
throw std::string(
// for this kind of file.
ConfigData* cd = cdp->ProvideConfigData(I->second);
if (cd == 0)
- throw std::string("Files of type '") + I->second +
- "' are not recognized.";
+ throw std::string("Files of type '") + I->second +
+ "' are not recognized.";
if (isSet(DEBUG_FLAG))
DumpConfigData(cd,I->second);
actions.push_back(GetAction(cd,InFile,Output,PREPROCESSING));
}
} else {
- sys::Path TempFile(MakeTempFile(I->first.getBasename(),"E"));
+ sys::Path TempFile(
+ MakeTempFile(I->first.getBasename(),"E",&ErrMsg));
+ if (TempFile.isEmpty())
+ return 1;
actions.push_back(GetAction(cd,InFile,TempFile,
PREPROCESSING));
InFile = TempFile;
} else if (finalPhase == PREPROCESSING) {
throw cd->langName + " does not support pre-processing";
} else if (action.isSet(REQUIRED_FLAG)) {
- throw std::string("Don't know how to pre-process ") +
+ throw std::string("Don't know how to pre-process ") +
cd->langName + " files";
}
- // Short-circuit remaining actions if all they want is
+ // Short-circuit remaining actions if all they want is
// pre-processing
if (finalPhase == PREPROCESSING) { continue; };
actions.push_back(GetAction(cd,InFile,Output,TRANSLATION));
}
} else {
- sys::Path TempFile(MakeTempFile(I->first.getBasename(),"trans"));
+ sys::Path TempFile(
+ MakeTempFile(I->first.getBasename(),"trans", &ErrMsg));
+ if (TempFile.isEmpty())
+ return 1;
actions.push_back(GetAction(cd,InFile,TempFile,TRANSLATION));
InFile = TempFile;
}
// ll -> bc Helper
if (action.isSet(OUTPUT_IS_ASM_FLAG)) {
/// The output of the translator is an LLVM Assembly program
- /// We need to translate it to bytecode
+ /// We need to translate it to bitcode
Action* action = new Action();
- action->program.setFile("llvm-as");
+ action->program.set("llvm-as");
action->args.push_back(InFile.toString());
action->args.push_back("-o");
InFile.appendSuffix("bc");
} else if (finalPhase == TRANSLATION) {
throw cd->langName + " does not support translation";
} else if (action.isSet(REQUIRED_FLAG)) {
- throw std::string("Don't know how to translate ") +
+ throw std::string("Don't know how to translate ") +
cd->langName + " files";
}
actions.push_back(GetAction(cd,InFile,Output,OPTIMIZATION));
}
} else {
- sys::Path TempFile(MakeTempFile(I->first.getBasename(),"opt"));
+ sys::Path TempFile(
+ MakeTempFile(I->first.getBasename(),"opt", &ErrMsg));
+ if (TempFile.isEmpty())
+ return 1;
actions.push_back(GetAction(cd,InFile,TempFile,OPTIMIZATION));
InFile = TempFile;
}
// ll -> bc Helper
if (action.isSet(OUTPUT_IS_ASM_FLAG)) {
/// The output of the optimizer is an LLVM Assembly program
- /// We need to translate it to bytecode with llvm-as
+ /// We need to translate it to bitcode with llvm-as
Action* action = new Action();
- action->program.setFile("llvm-as");
+ action->program.set("llvm-as");
action->args.push_back(InFile.toString());
action->args.push_back("-f");
action->args.push_back("-o");
} else if (finalPhase == OPTIMIZATION) {
throw cd->langName + " does not support optimization";
} else if (action.isSet(REQUIRED_FLAG)) {
- throw std::string("Don't know how to optimize ") +
+ throw std::string("Don't know how to optimize ") +
cd->langName + " files";
}
}
Action* action = new Action();
if (isSet(EMIT_NATIVE_FLAG)) {
// Use llc to get the native assembly file
- action->program.setFile("llc");
+ action->program.set("llc");
action->args.push_back(InFile.toString());
action->args.push_back("-f");
action->args.push_back("-o");
actions.push_back(action);
} else {
// Just convert back to llvm assembly with llvm-dis
- action->program.setFile("llvm-dis");
+ action->program.set("llvm-dis");
action->args.push_back(InFile.toString());
action->args.push_back("-f");
action->args.push_back("-o");
// Put the action on the list
actions.push_back(action);
- // Short circuit the rest of the loop, we don't want to link
+ // Short circuit the rest of the loop, we don't want to link
continue;
}
std::vector<Action*>::iterator AI = actions.begin();
std::vector<Action*>::iterator AE = actions.end();
while (AI != AE) {
- if (!DoAction(*AI))
- throw std::string("Action failed");
+ int ActionResult = DoAction(*AI, ErrMsg);
+ if (ActionResult != 0)
+ return ActionResult;
AI++;
}
// Set up the linking action with llvm-ld
Action* link = new Action();
- link->program.setFile("llvm-ld");
+ link->program.set("llvm-ld");
// Add in the optimization level requested
switch (optLevel) {
// Add in all the linkage items we generated. This includes the
// output from the translation/optimization phases as well as any
// -l arguments specified.
- for (PathVector::const_iterator I=LinkageItems.begin(),
+ for (PathVector::const_iterator I=LinkageItems.begin(),
E=LinkageItems.end(); I != E; ++I )
link->args.push_back(I->toString());
// Add in all the libraries we found.
- for (std::vector<std::string>::const_iterator I=LibFiles.begin(),
+ for (StringVector::const_iterator I=LibFiles.begin(),
E=LibFiles.end(); I != E; ++I )
link->args.push_back(std::string("-l")+*I);
link->args.push_back(Output.toString());
// Execute the link
- if (!DoAction(link))
- throw std::string("Action failed");
+ int ActionResult = DoAction(link, ErrMsg);
+ if (ActionResult != 0)
+ return ActionResult;
}
} catch (std::string& msg) {
cleanup();
PathVector IncludePaths; ///< -I options
PathVector ToolPaths; ///< -B options
StringVector Defines; ///< -D options
- sys::Path TempDir; ///< Name of the temporary directory.
+ sys::PathWithStatus TempDir; ///< Name of the temporary directory.
StringTable AdditionalArgs; ///< The -Txyz options
StringVector fOptions; ///< -f options
StringVector MOptions; ///< -M options
CompilerDriver::~CompilerDriver() {
}
+CompilerDriver::ConfigDataProvider::~ConfigDataProvider() {}
+
CompilerDriver*
CompilerDriver::Get(ConfigDataProvider& CDP) {
return new CompilerDriverImpl(CDP);
for (unsigned i = 0; i < NUM_PHASES; ++i)
opts.push_back(emptyVec);
}
-
-// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab