#include "clang/Basic/Version.h"
#include "llvm/ADT/StringSet.h"
+#include "llvm/ADT/OwningPtr.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Path.h"
}
// Build the pipeline for this file.
- Action *Current = new InputAction(*InputArg, InputType);
+ llvm::OwningPtr<Action> Current(new InputAction(*InputArg, InputType));
for (unsigned i = 0; i != NumSteps; ++i) {
phases::ID Phase = types::getCompilationPhase(InputType, i);
// Queue linker inputs.
if (Phase == phases::Link) {
assert(i + 1 == NumSteps && "linking must be final compilation step.");
- LinkerInputs.push_back(Current);
- Current = 0;
+ LinkerInputs.push_back(Current.take());
break;
}
continue;
// Otherwise construct the appropriate action.
- Current = ConstructPhaseAction(Args, Phase, Current);
+ Current.reset(ConstructPhaseAction(Args, Phase, Current.take()));
if (Current->getType() == types::TY_Nothing)
break;
}
// If we ended with something, add to the output list.
if (Current)
- Actions.push_back(Current);
+ Actions.push_back(Current.take());
}
// Add a link action if necessary.