Daniel Dunbar | 63c4da9 | 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 | 9d625e1 | 2009-03-16 06:42:30 +0000 | [diff] [blame] | 11 | |
Daniel Dunbar | 73f7b8c | 2009-03-18 02:55:38 +0000 | [diff] [blame] | 12 | #include "clang/Driver/Action.h" |
Daniel Dunbar | 9d625e1 | 2009-03-16 06:42:30 +0000 | [diff] [blame] | 13 | #include "clang/Driver/ArgList.h" |
| 14 | #include "clang/Driver/ToolChain.h" |
| 15 | |
Daniel Dunbar | d6f0e37 | 2009-03-04 20:49:20 +0000 | [diff] [blame] | 16 | using namespace clang::driver; |
Daniel Dunbar | 63c4da9 | 2009-03-02 19:59:07 +0000 | [diff] [blame] | 17 | |
Daniel Dunbar | 9d625e1 | 2009-03-16 06:42:30 +0000 | [diff] [blame] | 18 | Compilation::Compilation(ToolChain &_DefaultToolChain, |
| 19 | ArgList *_Args) |
| 20 | : DefaultToolChain(_DefaultToolChain), Args(_Args) { |
Daniel Dunbar | 63c4da9 | 2009-03-02 19:59:07 +0000 | [diff] [blame] | 21 | } |
| 22 | |
Daniel Dunbar | 9d625e1 | 2009-03-16 06:42:30 +0000 | [diff] [blame] | 23 | Compilation::~Compilation() { |
| 24 | delete Args; |
| 25 | |
| 26 | // Free any derived arg lists. |
| 27 | for (llvm::DenseMap<const ToolChain*, ArgList*>::iterator |
| 28 | it = TCArgs.begin(), ie = TCArgs.end(); it != ie; ++it) { |
| 29 | ArgList *A = it->second; |
| 30 | if (A != Args) |
| 31 | delete Args; |
| 32 | } |
Daniel Dunbar | 73f7b8c | 2009-03-18 02:55:38 +0000 | [diff] [blame] | 33 | |
| 34 | // Free the actions, if built. |
| 35 | for (ActionList::iterator it = Actions.begin(), ie = Actions.end(); |
| 36 | it != ie; ++it) |
| 37 | delete *it; |
Daniel Dunbar | 9d625e1 | 2009-03-16 06:42:30 +0000 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | const ArgList &Compilation::getArgsForToolChain(const ToolChain *TC) { |
| 41 | if (!TC) |
| 42 | TC = &DefaultToolChain; |
| 43 | |
Daniel Dunbar | e564028 | 2009-03-18 05:58:45 +0000 | [diff] [blame] | 44 | ArgList *&Entry = TCArgs[TC]; |
| 45 | if (!Entry) |
| 46 | Entry = TC->TranslateArgs(*Args); |
Daniel Dunbar | 9d625e1 | 2009-03-16 06:42:30 +0000 | [diff] [blame] | 47 | |
Daniel Dunbar | e564028 | 2009-03-18 05:58:45 +0000 | [diff] [blame] | 48 | return *Entry; |
Daniel Dunbar | 63c4da9 | 2009-03-02 19:59:07 +0000 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | int Compilation::Execute() const { |
| 52 | return 0; |
| 53 | } |