This is an archive of the discontinued LLVM Phabricator instance.

[CommandLine] Fix cl::ConsumeAfter support with more than one positional argument
ClosedPublic

Authored by Yi-Hong.Lyu on Apr 1 2020, 1:52 PM.

Details

Summary

Currently, cl::ConsumeAfter only works for the case that has exactly one
positional argument. Without the fix, it skip fulfilling first positional
argument and put that additional positional argument in interpreter arguments.

Diff Detail

Event Timeline

Yi-Hong.Lyu created this revision.Apr 1 2020, 1:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 1 2020, 1:52 PM

Address clang-tidy's warning and rename local variable for readability.

Add a test ConsumeAfterOnePositional

rnk accepted this revision.Apr 15 2020, 1:23 PM

ConsumeAfter is used in three places: lli, KillTheDoctor, and modularize, so I wouldn't be surprised if there was an off-by-one error here.

Starting the index here at 1 dates back to the original CommandLine 2.0 check in (rG5df56c47fc5c), so I'm hesitant to say this is correct, but your unit tests and the lit suite for lli give me confidence that it does. Looks good to me, I guess.

This revision is now accepted and ready to land.Apr 15 2020, 1:23 PM
This revision was automatically updated to reflect the committed changes.