r207880 - Fix clang-cl Driver leak
Hans Wennborg
hans at hanshq.net
Fri May 2 15:55:30 PDT 2014
Author: hans
Date: Fri May 2 17:55:30 2014
New Revision: 207880
URL: http://llvm.org/viewvc/llvm-project?rev=207880&view=rev
Log:
Fix clang-cl Driver leak
We were synthesizing new arguments from e.g. '/Tcfile.c' arguments,
but didn't handle ownership correctly.
Modified:
cfe/trunk/include/clang/Driver/Driver.h
cfe/trunk/lib/Driver/Driver.cpp
Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=207880&r1=207879&r2=207880&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Fri May 2 17:55:30 2014
@@ -259,7 +259,7 @@ public:
/// \param Args - The input arguments.
/// \param Inputs - The list to store the resulting compilation
/// inputs onto.
- void BuildInputs(const ToolChain &TC, const llvm::opt::DerivedArgList &Args,
+ void BuildInputs(const ToolChain &TC, llvm::opt::DerivedArgList &Args,
InputList &Inputs) const;
/// BuildActions - Construct the list of actions to perform for the
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=207880&r1=207879&r2=207880&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri May 2 17:55:30 2014
@@ -190,10 +190,11 @@ const {
return FinalPhase;
}
-static Arg* MakeInputArg(const DerivedArgList &Args, OptTable *Opts,
+static Arg* MakeInputArg(DerivedArgList &Args, OptTable *Opts,
StringRef Value) {
Arg *A = new Arg(Opts->getOption(options::OPT_INPUT), Value,
Args.getBaseArgs().MakeIndex(Value), Value.data());
+ Args.AddSynthesizedArg(A);
A->claim();
return A;
}
@@ -956,7 +957,7 @@ static bool DiagnoseInputExistence(const
}
// Construct a the list of inputs and their types.
-void Driver::BuildInputs(const ToolChain &TC, const DerivedArgList &Args,
+void Driver::BuildInputs(const ToolChain &TC, DerivedArgList &Args,
InputList &Inputs) const {
// Track the current user specified (-x) input. We also explicitly track the
// argument used to set the type; we only want to claim the type when we
More information about the cfe-commits
mailing list