r208505 - Driver: Don't leak the -Xarch argument when its use is incorrect.

Nico Weber nicolasweber at gmx.de
Sun May 11 10:27:13 PDT 2014


Author: nico
Date: Sun May 11 12:27:13 2014
New Revision: 208505

URL: http://llvm.org/viewvc/llvm-project?rev=208505&view=rev
Log:
Driver: Don't leak the -Xarch argument when its use is incorrect.

(LLVM's lib/Option looks like it might appreciate being hit with the
std::unique_ptr stick.)

Modified:
    cfe/trunk/lib/Driver/ToolChains.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=208505&r1=208504&r2=208505&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Sun May 11 12:27:13 2014
@@ -694,7 +694,7 @@ DerivedArgList *MachO::TranslateArgs(con
       Arg *OriginalArg = A;
       unsigned Index = Args.getBaseArgs().MakeIndex(A->getValue(1));
       unsigned Prev = Index;
-      Arg *XarchArg = Opts.ParseOneArg(Args, Index);
+      std::unique_ptr<Arg> XarchArg(Opts.ParseOneArg(Args, Index));
 
       // If the argument parsing failed or more than one argument was
       // consumed, the -Xarch_ argument's parameter tried to consume
@@ -715,8 +715,8 @@ DerivedArgList *MachO::TranslateArgs(con
       }
 
       XarchArg->setBaseArg(A);
-      A = XarchArg;
 
+      A = XarchArg.release();
       DAL->AddSynthesizedArg(A);
 
       // Linker input arguments require custom handling. The problem is that we





More information about the cfe-commits mailing list