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
This commit is contained in:
parent
8cb497027d
commit
f388d17d7c
|
@ -1436,10 +1436,11 @@ llvm::Expected<Args> Options::Parse(const Args &args,
|
|||
} else {
|
||||
error.SetErrorStringWithFormat("invalid option with value '%i'", val);
|
||||
}
|
||||
if (error.Fail())
|
||||
return error.ToError();
|
||||
}
|
||||
|
||||
if (error.Fail())
|
||||
return error.ToError();
|
||||
|
||||
argv.erase(argv.begin(), argv.begin() + OptionParser::GetOptionIndex());
|
||||
return ReconstituteArgsAfterParsing(argv, args);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue