blob: 949bbe7d6b9c856c8302d22308c442b623323e6f [file] [log] [blame]
Daniel Dunbar3ede8d02009-03-02 19:59:07 +00001//===--- Compilation.cpp - Compilation Task Implementation --------------*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "clang/Driver/Compilation.h"
Daniel Dunbar586dc232009-03-16 06:42:30 +000011
12#include "clang/Driver/ArgList.h"
13#include "clang/Driver/ToolChain.h"
14
Daniel Dunbar1b3bb6e2009-03-04 20:49:20 +000015using namespace clang::driver;
Daniel Dunbar3ede8d02009-03-02 19:59:07 +000016
Daniel Dunbar586dc232009-03-16 06:42:30 +000017Compilation::Compilation(ToolChain &_DefaultToolChain,
18 ArgList *_Args)
19 : DefaultToolChain(_DefaultToolChain), Args(_Args) {
Daniel Dunbar3ede8d02009-03-02 19:59:07 +000020}
21
Daniel Dunbar586dc232009-03-16 06:42:30 +000022Compilation::~Compilation() {
23 delete Args;
24
25 // Free any derived arg lists.
26 for (llvm::DenseMap<const ToolChain*, ArgList*>::iterator
27 it = TCArgs.begin(), ie = TCArgs.end(); it != ie; ++it) {
28 ArgList *A = it->second;
29 if (A != Args)
30 delete Args;
31 }
32}
33
34const ArgList &Compilation::getArgsForToolChain(const ToolChain *TC) {
35 if (!TC)
36 TC = &DefaultToolChain;
37
38 ArgList *&Args = TCArgs[TC];
39 if (!Args)
40 Args = TC->TranslateArgs(*Args);
41
42 return *Args;
Daniel Dunbar3ede8d02009-03-02 19:59:07 +000043}
44
45int Compilation::Execute() const {
46 return 0;
47}