This patch updates AddGoldPlugin to pass stats-file to the Gold plugin,
if -save-stats is passed. It also moves the save-stats option handling
to a helper function tools::getStatsFileName.
Details
Diff Detail
- Repository
- rC Clang
Event Timeline
LGTM with comment nit
lib/Driver/ToolChains/CommonArgs.h | ||
---|---|---|
109 | doxygen comment (looks like there aren't many to start with in this file, but good to add) |
Some cleanup suggestions included, but I like the change overall.
lib/Driver/ToolChains/CommonArgs.cpp | ||
---|---|---|
1283 | Early return would be nicer. const Arg *A = Args.getLastArg(options::OPT_save_stats_EQ); if (!A) return {}; | |
1297 | Early return after the check would allow you to avoid the boolean and reduce indentation below too. if (SaveStats != "cwd" && SaveStats != "obj") { D.Diag(drag::err_drv_invalid_value) << A->getAsString(Args) << SaveStats; return {}; } | |
lib/Driver/ToolChains/CommonArgs.h | ||
63–64 | While you're here, perhaps you can improve this a slight bit more? D is unnecessary, ToolChain.getDriver() allows you to get the value anyways. I think it would be nicer to move the Input and Output parameters to before the IsThinLTO. |
Thank you very much for the review and the excellent suggestions. I simplified getStatsFileName, added a doxygen comment and changed the arguments of AddGoldPlugin as suggested
While you're here, perhaps you can improve this a slight bit more?
D is unnecessary, ToolChain.getDriver() allows you to get the value anyways. I think it would be nicer to move the Input and Output parameters to before the IsThinLTO.