This is an archive of the discontinued LLVM Phabricator instance.

Fix an assertion when -print-prog-name=
ClosedPublic

Authored by chrib on Apr 19 2018, 6:18 AM.

Details

Summary

Fix an assertion when -print-prog-name= is invoked without parameter. Returns an empty string.

no test provided, as "obvious"

Diff Detail

Event Timeline

chrib created this revision.Apr 19 2018, 6:18 AM
chrib retitled this revision from Fix an assertion when -print-prog-name= is invoked without parameter. Returns an empty string. to Fix an assertion when -print-prog-name=.Apr 19 2018, 6:31 AM
chrib edited the summary of this revision. (Show Details)
chrib added a reviewer: compnerd.
chrib edited the summary of this revision. (Show Details)Apr 19 2018, 6:44 AM

I'm torn on this. The other -print options will perform the validation implicitly at the higher level before calling the inner functions. It is certainly reasonable to support that, but, for the common path, this check seems unnecessary (and this function is used elsewhere in clang). There is a similar problem that exists with -print-file-name=. We should probably fix both at the same time. Can you also please add a test case for this?

chrib updated this revision to Diff 144322.Apr 27 2018, 5:54 AM

Move the non-null name check out of GetProgramPath and add a test case.

Assume that we trust the callers to check for non null ProgramName.

chrib added a comment.Apr 27 2018, 6:00 AM

Hi Saleem,

Thanks for your review. I have amended the patch to avoid checking the name on the common path.
About your second comment, I'm not sure we have to fix -print-file-name= for an equivalent problem since in case of empty parameter, we do a concatenation with the driver's path, which seems to be fine.
Best Regards
Christian

compnerd accepted this revision.Apr 27 2018, 9:09 AM

Do you have commit access or do you need someone to commit this on your behalf?

This revision is now accepted and ready to land.Apr 27 2018, 9:09 AM

Do you have commit access or do you need someone to commit this on your behalf?

can you commit it for me please ? thanks.

compnerd closed this revision.May 1 2018, 11:44 AM

SVN r331296