From 7d0886e36696324b4e737dc74a058acda7bffd44 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Sun, 11 May 2014 17:27:13 +0000 Subject: [PATCH] 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.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208505 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/ToolChains.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 8e3d6d6d95..0b77ee0c7b 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -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 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 -- 2.40.0