Daniel Dunbar | 3ede8d0 | 2009-03-02 19:59:07 +0000 | [diff] [blame] | 1 | //===--- 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 Dunbar | 586dc23 | 2009-03-16 06:42:30 +0000 | [diff] [blame^] | 11 | |
| 12 | #include "clang/Driver/ArgList.h" |
| 13 | #include "clang/Driver/ToolChain.h" |
| 14 | |
Daniel Dunbar | 1b3bb6e | 2009-03-04 20:49:20 +0000 | [diff] [blame] | 15 | using namespace clang::driver; |
Daniel Dunbar | 3ede8d0 | 2009-03-02 19:59:07 +0000 | [diff] [blame] | 16 | |
Daniel Dunbar | 586dc23 | 2009-03-16 06:42:30 +0000 | [diff] [blame^] | 17 | Compilation::Compilation(ToolChain &_DefaultToolChain, |
| 18 | ArgList *_Args) |
| 19 | : DefaultToolChain(_DefaultToolChain), Args(_Args) { |
Daniel Dunbar | 3ede8d0 | 2009-03-02 19:59:07 +0000 | [diff] [blame] | 20 | } |
| 21 | |
Daniel Dunbar | 586dc23 | 2009-03-16 06:42:30 +0000 | [diff] [blame^] | 22 | Compilation::~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 | |
| 34 | const 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 Dunbar | 3ede8d0 | 2009-03-02 19:59:07 +0000 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | int Compilation::Execute() const { |
| 46 | return 0; |
| 47 | } |