Driver: Move actions into Compilation, and construct the compilation
earlier.
- This gives us a simple ownership model, and allows clients access
to more information should they ever want it.
- We now free Actions correctly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67158 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Compilation.cpp b/lib/Driver/Compilation.cpp
index 949bbe7..b35bf24 100644
--- a/lib/Driver/Compilation.cpp
+++ b/lib/Driver/Compilation.cpp
@@ -9,6 +9,7 @@
#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Action.h"
#include "clang/Driver/ArgList.h"
#include "clang/Driver/ToolChain.h"
@@ -29,6 +30,11 @@
if (A != Args)
delete Args;
}
+
+ // Free the actions, if built.
+ for (ActionList::iterator it = Actions.begin(), ie = Actions.end();
+ it != ie; ++it)
+ delete *it;
}
const ArgList &Compilation::getArgsForToolChain(const ToolChain *TC) {