2009-03-03 03:59:07 +08:00
|
|
|
//===--- Compilation.cpp - Compilation Task Implementation --------------*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "clang/Driver/Compilation.h"
|
2009-03-16 14:42:30 +08:00
|
|
|
|
2009-03-18 10:55:38 +08:00
|
|
|
#include "clang/Driver/Action.h"
|
2009-03-16 14:42:30 +08:00
|
|
|
#include "clang/Driver/ArgList.h"
|
|
|
|
#include "clang/Driver/ToolChain.h"
|
|
|
|
|
2009-03-05 04:49:20 +08:00
|
|
|
using namespace clang::driver;
|
2009-03-03 03:59:07 +08:00
|
|
|
|
2009-03-16 14:42:30 +08:00
|
|
|
Compilation::Compilation(ToolChain &_DefaultToolChain,
|
|
|
|
ArgList *_Args)
|
|
|
|
: DefaultToolChain(_DefaultToolChain), Args(_Args) {
|
|
|
|
}
|
|
|
|
|
|
|
|
Compilation::~Compilation() {
|
|
|
|
delete Args;
|
|
|
|
|
|
|
|
// Free any derived arg lists.
|
|
|
|
for (llvm::DenseMap<const ToolChain*, ArgList*>::iterator
|
|
|
|
it = TCArgs.begin(), ie = TCArgs.end(); it != ie; ++it) {
|
|
|
|
ArgList *A = it->second;
|
|
|
|
if (A != Args)
|
|
|
|
delete Args;
|
|
|
|
}
|
2009-03-18 10:55:38 +08:00
|
|
|
|
|
|
|
// Free the actions, if built.
|
|
|
|
for (ActionList::iterator it = Actions.begin(), ie = Actions.end();
|
|
|
|
it != ie; ++it)
|
|
|
|
delete *it;
|
2009-03-03 03:59:07 +08:00
|
|
|
}
|
|
|
|
|
2009-03-16 14:42:30 +08:00
|
|
|
const ArgList &Compilation::getArgsForToolChain(const ToolChain *TC) {
|
|
|
|
if (!TC)
|
|
|
|
TC = &DefaultToolChain;
|
|
|
|
|
|
|
|
ArgList *&Args = TCArgs[TC];
|
|
|
|
if (!Args)
|
|
|
|
Args = TC->TranslateArgs(*Args);
|
|
|
|
|
|
|
|
return *Args;
|
2009-03-03 03:59:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int Compilation::Execute() const {
|
|
|
|
return 0;
|
|
|
|
}
|