]> granicus.if.org Git - clang/commit
enable -save-temps with -finclude-defult-header
authorGuansong Zhang <zhang.guansong@gmail.com>
Wed, 15 Mar 2017 20:57:11 +0000 (20:57 +0000)
committerGuansong Zhang <zhang.guansong@gmail.com>
Wed, 15 Mar 2017 20:57:11 +0000 (20:57 +0000)
commita64830ea2b59ce26f062458bd5212075ced43d84
tree8ef6781cc6370f8b241585bc0bd7c0d1758c3e55
parentb0df0a85940c5e8434ed977b03b44518b79b2d47
enable -save-temps with -finclude-defult-header

Currently the two flags can not work together.

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

cat a.cl

void test(){}

Then use

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

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.

Differential Revision: https://reviews.llvm.org/D30743

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297890 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Driver/ToolChains/Clang.cpp
test/Driver/include-default-header.cl [new file with mode: 0644]