This is an archive of the discontinued LLVM Phabricator instance.

Report an error if a CLI option lacks an argument
ClosedPublic

Authored by llunak on Jul 30 2020, 10:50 AM.

Details

Summary

Without this, e.g. "lldb -p $(pidof process)" simply starts if there's no process.
Code pretty much copied from Clang's CompilerInvocation::CreateFromArgs().

Diff Detail

Event Timeline

llunak requested review of this revision.Jul 30 2020, 10:50 AM
llunak created this revision.
llunak added a reviewer: Restricted Project.
llunak added a subscriber: lldb-commits.
JDevlieghere requested changes to this revision.Jul 30 2020, 11:41 AM
JDevlieghere added a subscriber: JDevlieghere.

Thanks for fixing this. I do have a few comments but the logic looks good.

lldb/test/Shell/Driver/TestError.test
2

Since there's only one prefix to check you can omit --check-prefix ARGMISSING and just use CHECK as the prefix on the next line.

lldb/tools/driver/Driver.cpp
873

Let's move this and the next line out of check here and below the check for unknown options, so that the user gets to see both errors at once. That way we also don't have to duplicate the error message.

This revision now requires changes to proceed.Jul 30 2020, 11:41 AM
llunak updated this revision to Diff 282208.Jul 31 2020, 6:15 AM

Adjusted according to the comments.

JDevlieghere accepted this revision.Jul 31 2020, 9:36 AM

Thanks! LGTM

This revision is now accepted and ready to land.Jul 31 2020, 9:36 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 31 2020, 1:03 PM