Driver: Prep for tool chain specific argument translation.
- Lift ArgList to a base class for InputArgList and DerivedArgList.
- This is not a great decomposition, but it does embed the
translation into the type system, and keep things efficient for
tool chains that don't want to do any translation.
- No intended functionality change.
Eventually I hope to get rid of tool chain specific translation and
have each tool do the right thing, but for now this is the easiest way
to match gcc precisely (which is good for testing).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67676 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Compilation.cpp b/lib/Driver/Compilation.cpp
index 2165bb7..1e044c6 100644
--- a/lib/Driver/Compilation.cpp
+++ b/lib/Driver/Compilation.cpp
@@ -23,7 +23,7 @@
Compilation::Compilation(Driver &D,
ToolChain &_DefaultToolChain,
- ArgList *_Args)
+ InputArgList *_Args)
: TheDriver(D), DefaultToolChain(_DefaultToolChain), Args(_Args) {
}
@@ -31,12 +31,9 @@
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;
- }
+ for (llvm::DenseMap<const ToolChain*, DerivedArgList*>::iterator
+ it = TCArgs.begin(), ie = TCArgs.end(); it != ie; ++it)
+ delete it->second;
// Free the actions, if built.
for (ActionList::iterator it = Actions.begin(), ie = Actions.end();
@@ -44,11 +41,11 @@
delete *it;
}
-const ArgList &Compilation::getArgsForToolChain(const ToolChain *TC) {
+const DerivedArgList &Compilation::getArgsForToolChain(const ToolChain *TC) {
if (!TC)
TC = &DefaultToolChain;
- ArgList *&Entry = TCArgs[TC];
+ DerivedArgList *&Entry = TCArgs[TC];
if (!Entry)
Entry = TC->TranslateArgs(*Args);