Skip to content

Commit f388d17

Browse files
committed
Fix error handling in Options::Parse
Moved `if (error.Fail())` to correct place to catch all faulty cases such as "unknown or ambiguous option" which was ignored before. llvm-svn: 354883
1 parent 8cb4970 commit f388d17

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lldb/source/Interpreter/Options.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,10 +1436,11 @@ llvm::Expected<Args> Options::Parse(const Args &args,
14361436
} else {
14371437
error.SetErrorStringWithFormat("invalid option with value '%i'", val);
14381438
}
1439-
if (error.Fail())
1440-
return error.ToError();
14411439
}
14421440

1441+
if (error.Fail())
1442+
return error.ToError();
1443+
14431444
argv.erase(argv.begin(), argv.begin() + OptionParser::GetOptionIndex());
14441445
return ReconstituteArgsAfterParsing(argv, args);
14451446
}

0 commit comments

Comments
 (0)