]> granicus.if.org Git - clang/commitdiff
Fix clang-cl Driver leak
authorHans Wennborg <hans@hanshq.net>
Fri, 2 May 2014 22:55:30 +0000 (22:55 +0000)
committerHans Wennborg <hans@hanshq.net>
Fri, 2 May 2014 22:55:30 +0000 (22:55 +0000)
We were synthesizing new arguments from e.g. '/Tcfile.c' arguments,
but didn't handle ownership correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207880 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/Driver.h
lib/Driver/Driver.cpp

index 044872591f534ed9cf2892539a39317307c02947..960e5c019af88ff997f672e33d99133f4e612cf1 100644 (file)
@@ -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
index a238e37c1db844d83e936c437a3362ca442f83d9..44c41b6b69453cedc84e3aa640d9ca3ae7d2a43e 100644 (file)
@@ -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 Driver &D, const DerivedArgList &Args,
 }
 
 // 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