diff options
Diffstat (limited to 'llvm/lib/Option/OptTable.cpp')
-rw-r--r-- | llvm/lib/Option/OptTable.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/Option/OptTable.cpp b/llvm/lib/Option/OptTable.cpp index 1bf63a7..b319800 100644 --- a/llvm/lib/Option/OptTable.cpp +++ b/llvm/lib/Option/OptTable.cpp @@ -359,9 +359,9 @@ Arg *OptTable::parseOneArgGrouped(InputArgList &Args, unsigned &Index) const { continue; Option Opt(Start, this); - if (Arg *A = Opt.accept(Args, StringRef(Args.getArgString(Index), ArgSize), - false, Index)) - return A; + if (std::unique_ptr<Arg> A = Opt.accept( + Args, StringRef(Args.getArgString(Index), ArgSize), false, Index)) + return A.release(); // If Opt is a Flag of length 2 (e.g. "-a"), we know it is a prefix of // the current argument (e.g. "-abc"). Match it as a fallback if no longer @@ -379,9 +379,10 @@ Arg *OptTable::parseOneArgGrouped(InputArgList &Args, unsigned &Index) const { if (Str[2] == '=') return new Arg(getOption(TheUnknownOptionID), Str, Index++, CStr); - if (Arg *A = Opt.accept(Args, Str.substr(0, 2), true, Index)) { + if (std::unique_ptr<Arg> A = + Opt.accept(Args, Str.substr(0, 2), true, Index)) { Args.replaceArgString(Index, Twine('-') + Str.substr(2)); - return A; + return A.release(); } } @@ -439,9 +440,9 @@ Arg *OptTable::ParseOneArg(const ArgList &Args, unsigned &Index, continue; // See if this option matches. - if (Arg *A = Opt.accept(Args, StringRef(Args.getArgString(Index), ArgSize), - false, Index)) - return A; + if (std::unique_ptr<Arg> A = Opt.accept( + Args, StringRef(Args.getArgString(Index), ArgSize), false, Index)) + return A.release(); // Otherwise, see if this argument was missing values. if (Prev != Index) |