Move ownership of Action objects into Compilation.
Summary:
This makes constructing Action graphs which are DAGs much simpler. It
also just simplifies in general the ownership semantics of Actions.
Depends on D15910.
Reviewers: echristo
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D15911
llvm-svn: 257407
diff --git a/clang/lib/Driver/Compilation.cpp b/clang/lib/Driver/Compilation.cpp
index e4af2a6..1c2eecd 100644
--- a/clang/lib/Driver/Compilation.cpp
+++ b/clang/lib/Driver/Compilation.cpp
@@ -40,11 +40,6 @@
if (it->second != TranslatedArgs)
delete it->second;
- // Free the actions, if built.
- for (ActionList::iterator it = Actions.begin(), ie = Actions.end();
- it != ie; ++it)
- delete *it;
-
// Free redirections of stdout/stderr.
if (Redirects) {
delete Redirects[1];
@@ -208,7 +203,8 @@
ForDiagnostics = true;
// Free actions and jobs.
- DeleteContainerPointers(Actions);
+ Actions.clear();
+ AllActions.clear();
Jobs.clear();
// Clear temporary/results file lists.