This is an archive of the discontinued LLVM Phabricator instance.

Move functionality of UniversalDriver to the entry point file.
ClosedPublic

Authored by ruiu on Feb 27 2016, 6:03 PM.

Details

Reviewers
rafael
Summary

UniversalDriver was used as a dispatcher to each platform-specific driver.
It had its own Options.td file. It was not just too much to parse only a
few options (we only want to parse -core, -flavor or argv[0]),
but also interpreted arguments too early. For example, if you invoke lld as
"lld -flavor gnu ... -help", then you'd get the UniversalDriver's help
message instead of GnuDriver's. This patch eliminates the use of Options
from the dispatcher.

Diff Detail

Event Timeline

ruiu updated this revision to Diff 49303.Feb 27 2016, 6:03 PM
ruiu retitled this revision from to Move functionality of UniversalDriver to the entry point file..
ruiu updated this object.
ruiu added a reviewer: rafael.
ruiu added a subscriber: llvm-commits.
ruiu updated this revision to Diff 49304.Feb 27 2016, 6:06 PM
  • Changed a few variable names.
silvas added a subscriber: silvas.Feb 27 2016, 6:11 PM

I always found this extra layer of logic to be confusing for a simple dispatcher. Nice cleanup.

ruiu added a comment.Feb 27 2016, 8:22 PM

BTW, I was curious why this UniversalDriver was written like that because I rememberd that -core and -flavor options were significant only when they appear at beginning of command line parameters. It turned out that that was the behavior until it had been changed casually in r193301 without any reason. In hindsight, we shouldn't make such change in r193301. This patch should restore the original behavior.

rafael accepted this revision.Feb 28 2016, 8:45 AM
rafael edited edge metadata.

Nice!

This revision is now accepted and ready to land.Feb 28 2016, 8:45 AM
Eugene.Zelenko added a subscriber: Eugene.Zelenko.

Committed in r262190.

unittests/DriverTests/DarwinLdDriverTest.cpp