]> granicus.if.org Git - clang/commitdiff
Driver: Don't leak the -Xarch argument when its use is incorrect.
authorNico Weber <nicolasweber@gmx.de>
Sun, 11 May 2014 17:27:13 +0000 (17:27 +0000)
committerNico Weber <nicolasweber@gmx.de>
Sun, 11 May 2014 17:27:13 +0000 (17:27 +0000)
(LLVM's lib/Option looks like it might appreciate being hit with the
std::unique_ptr stick.)

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

lib/Driver/ToolChains.cpp

index 8e3d6d6d95cba056f645eb8264e846fbc30b7246..0b77ee0c7be59f16374d8a42208fab727e2db8b0 100644 (file)
@@ -694,7 +694,7 @@ DerivedArgList *MachO::TranslateArgs(const DerivedArgList &Args,
       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(const DerivedArgList &Args,
       }
 
       XarchArg->setBaseArg(A);
-      A = XarchArg;
 
+      A = XarchArg.release();
       DAL->AddSynthesizedArg(A);
 
       // Linker input arguments require custom handling. The problem is that we