aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Compilation.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-06-11 22:00:26 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-06-11 22:00:26 +0000
commit279c1dbebf37cd128f3c73c70741a6b8c35ad025 (patch)
treed63cc4d0a2d13ad79bb6d2beb6534be7122d53aa /lib/Driver/Compilation.cpp
parent3612bc80fabcdd337f6d1df06e69b38c2c5f5a32 (diff)
Driver: Add an explicit argument translation phase to the driver itself. We are going to need this to handle things like -Xassembler, -Xpreprocessor, and -Xlinker which we might have to introspect.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105842 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Compilation.cpp')
-rw-r--r--lib/Driver/Compilation.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/Driver/Compilation.cpp b/lib/Driver/Compilation.cpp
index 227f79a75b..282e9fe82e 100644
--- a/lib/Driver/Compilation.cpp
+++ b/lib/Driver/Compilation.cpp
@@ -22,20 +22,22 @@
#include <errno.h>
using namespace clang::driver;
-Compilation::Compilation(const Driver &D,
- const ToolChain &_DefaultToolChain,
- InputArgList *_Args)
- : TheDriver(D), DefaultToolChain(_DefaultToolChain), Args(_Args) {
+Compilation::Compilation(const Driver &D, const ToolChain &_DefaultToolChain,
+ InputArgList *_Args, DerivedArgList *_TranslatedArgs)
+ : TheDriver(D), DefaultToolChain(_DefaultToolChain), Args(_Args),
+ TranslatedArgs(_TranslatedArgs) {
}
Compilation::~Compilation() {
+ delete TranslatedArgs;
delete Args;
// Free any derived arg lists.
for (llvm::DenseMap<std::pair<const ToolChain*, const char*>,
DerivedArgList*>::iterator it = TCArgs.begin(),
ie = TCArgs.end(); it != ie; ++it)
- delete it->second;
+ if (it->second != TranslatedArgs)
+ delete it->second;
// Free the actions, if built.
for (ActionList::iterator it = Actions.begin(), ie = Actions.end();
@@ -49,8 +51,11 @@ const DerivedArgList &Compilation::getArgsForToolChain(const ToolChain *TC,
TC = &DefaultToolChain;
DerivedArgList *&Entry = TCArgs[std::make_pair(TC, BoundArch)];
- if (!Entry)
- Entry = TC->TranslateArgs(*Args, BoundArch);
+ if (!Entry) {
+ Entry = TC->TranslateArgs(*TranslatedArgs, BoundArch);
+ if (!Entry)
+ Entry = TranslatedArgs;
+ }
return *Entry;
}