Page MenuHomePhabricator

enable -save-temps with -finclude-defult-header

Authored by guansong on Mar 8 2017, 9:05 AM.



Currently the two flags can not work together.

To illustrate the issue, we can have an one line file contains only an empty function


void test(){}

Then use

clang -v -save-temps -x cl -Xclang -cl-std=CL2.0 -Xclang -finclude-default-header -target amdgcn -S -c

we will get redefinition errors for various things.

The reason is that the -finclude-default-header flag is not meant to be on cc1 command other than the preprocessor.

The fix is modeled after the code just below the change to filter the -finclude-default-header flag out when we are not in the preprocess phase.

Diff Detail


Event Timeline

guansong created this revision.Mar 8 2017, 9:05 AM
guansong added a reviewer: yaxunl.
guansong updated this revision to Diff 91045.Mar 8 2017, 10:11 AM

add a test

guansong added a subscriber: cfe-commits.
Anastasia added inline comments.Mar 13 2017, 10:50 AM
5288 ↗(On Diff #91045)

It would be nice to add a comment around here explaining this case.

5290 ↗(On Diff #91045)

Remove the commented code, please!

guansong updated this revision to Diff 91600.Mar 13 2017, 11:54 AM
Anastasia accepted this revision.Mar 14 2017, 7:08 AM

LGTM! Thanks!

5290 ↗(On Diff #91045)

I think the comment could be lifted up before the if statement. :)

This revision is now accepted and ready to land.Mar 14 2017, 7:08 AM
guansong updated this revision to Diff 91718.Mar 14 2017, 7:21 AM

Thanks, update as suggested.

This revision was automatically updated to reflect the committed changes.