RE: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

2016-11-04 Thread Anastasia Stulova via cfe-commits
Great! Thanks!

From: Liu, Yaxun (Sam) [mailto:yaxun@amd.com]
Sent: 04 November 2016 13:52
To: Anastasia Stulova; Richard Smith
Cc: nd; cfe-commits@lists.llvm.org
Subject: RE: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

Hi Richard/Anastasia,

I agree some tests are redundant. I will try to remove them.

Thanks.

Sam

From: Anastasia Stulova [mailto:anastasia.stul...@arm.com]
Sent: Friday, November 04, 2016 7:43 AM
To: Richard Smith <rich...@metafoo.co.uk<mailto:rich...@metafoo.co.uk>>; Liu, 
Yaxun (Sam) <yaxun@amd.com<mailto:yaxun@amd.com>>
Cc: nd <n...@arm.com<mailto:n...@arm.com>>; 
cfe-commits@lists.llvm.org<mailto:cfe-commits@lists.llvm.org>
Subject: RE: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

Hi Richard,

I guess the problem is that the header file itself is really large and we have 
all these configurations that depending on versions/extensions expose different 
builtin libraries. They are all based on the core part though which is already 
large.

Ideally it would be nice to test the full functionality but I agree the price 
is probably quite high at the moment. Something we could immediately cut down 
though is all configurations with –fblocks. I think we are implicitly setting 
it now with –std=CL2.0.

Also I am not sure why we are testing different targets. I don’t think we have 
many target specific bits in the header? Apart from the common code I can I 
only see AMD specific part. Perhaps testing for SPIR and AMD targets only 
should be enough? Also the tests doesn’t really check for anything AMD 
specific. Perhaps that could be improved as well…

Cheers,
Anastasia

From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of 
Richard Smith via cfe-commits
Sent: 03 November 2016 22:10
To: Yaxun Liu
Cc: cfe-commits
Subject: Re: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

Hi,

This test (test/Headers/opencl-c-header.cl<http://opencl-c-header.cl>) is 
*extremely* slow -- it parses the 17KLoC opencl-c.h header 40 times, and on my 
Debug builds it's the slowest test by far, taking nearly 2 minutes to run 
*alone*. (For reference, the *entire clang test suite* finishes in 90s on my 
machine with this test removed.)

Please can you do something about this? Do we really need to parse this header 
in 40 configurations here?

On Mon, Jun 20, 2016 at 12:26 PM, Yaxun Liu via cfe-commits 
<cfe-commits@lists.llvm.org<mailto:cfe-commits@lists.llvm.org>> wrote:
Author: yaxunl
Date: Mon Jun 20 14:26:00 2016
New Revision: 273191

URL: http://llvm.org/viewvc/llvm-project?rev=273191=rev
Log:
[OpenCL] Include opencl-c.h by default as a clang module

Include opencl-c.h by default as a module to utilize the automatic AST caching 
mechanism of clang modules.

Add an option -finclude-default-header to enable default header for OpenCL, 
which is off by default.

Differential Revision: http://reviews.llvm.org/D20444

Modified:
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Frontend/CompilerInvocation.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Headers/module.modulemap
cfe/trunk/test/Headers/opencl-c-header.cl<http://opencl-c-header.cl>

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=273191=273190=273191=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Mon Jun 20 14:26:00 2016
@@ -218,7 +218,7 @@ LANGOPT(ObjCWeak, 1, 0, "Obj
 LANGOPT(ObjCSubscriptingLegacyRuntime , 1, 0, "Subscripting support in 
legacy ObjectiveC runtime")
 LANGOPT(FakeAddressSpaceMap , 1, 0, "OpenCL fake address space map")
 ENUM_LANGOPT(AddressSpaceMapMangling , AddrSpaceMapMangling, 2, ASMM_Target, 
"OpenCL address space map mangling mode")
-
+LANGOPT(IncludeDefaultHeader, 1, 0, "Include default header file for OpenCL")
 BENIGN_LANGOPT(DelayedTemplateParsing , 1, 0, "delayed template parsing")
 LANGOPT(BlocksRuntimeOptional , 1, 0, "optional blocks runtime")


Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=273191=273190=273191=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Mon Jun 20 14:26:00 2016
@@ -612,6 +612,8 @@ def fallow_half_arguments_and_returns :
   HelpText<"Allow function arguments and returns of type half">;
 def fdefault_calling_conv_EQ : Joined<["-"], "fd

Re: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

2016-11-03 Thread Richard Smith via cfe-commits
Hi,

This test (test/Headers/opencl-c-header.cl) is *extremely* slow -- it
parses the 17KLoC opencl-c.h header 40 times, and on my Debug builds it's
the slowest test by far, taking nearly 2 minutes to run *alone*. (For
reference, the *entire clang test suite* finishes in 90s on my machine with
this test removed.)

Please can you do something about this? Do we really need to parse this
header in 40 configurations here?

On Mon, Jun 20, 2016 at 12:26 PM, Yaxun Liu via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: yaxunl
> Date: Mon Jun 20 14:26:00 2016
> New Revision: 273191
>
> URL: http://llvm.org/viewvc/llvm-project?rev=273191=rev
> Log:
> [OpenCL] Include opencl-c.h by default as a clang module
>
> Include opencl-c.h by default as a module to utilize the automatic AST
> caching mechanism of clang modules.
>
> Add an option -finclude-default-header to enable default header for
> OpenCL, which is off by default.
>
> Differential Revision: http://reviews.llvm.org/D20444
>
> Modified:
> cfe/trunk/include/clang/Basic/LangOptions.def
> cfe/trunk/include/clang/Driver/CC1Options.td
> cfe/trunk/include/clang/Frontend/CompilerInvocation.h
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/lib/Headers/module.modulemap
> cfe/trunk/test/Headers/opencl-c-header.cl
>
> Modified: cfe/trunk/include/clang/Basic/LangOptions.def
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Basic/LangOptions.def?rev=273191=273190=273191=diff
> 
> ==
> --- cfe/trunk/include/clang/Basic/LangOptions.def (original)
> +++ cfe/trunk/include/clang/Basic/LangOptions.def Mon Jun 20 14:26:00 2016
> @@ -218,7 +218,7 @@ LANGOPT(ObjCWeak, 1, 0, "Obj
>  LANGOPT(ObjCSubscriptingLegacyRuntime , 1, 0, "Subscripting
> support in legacy ObjectiveC runtime")
>  LANGOPT(FakeAddressSpaceMap , 1, 0, "OpenCL fake address space map")
>  ENUM_LANGOPT(AddressSpaceMapMangling , AddrSpaceMapMangling, 2,
> ASMM_Target, "OpenCL address space map mangling mode")
> -
> +LANGOPT(IncludeDefaultHeader, 1, 0, "Include default header file for
> OpenCL")
>  BENIGN_LANGOPT(DelayedTemplateParsing , 1, 0, "delayed template parsing")
>  LANGOPT(BlocksRuntimeOptional , 1, 0, "optional blocks runtime")
>
>
> Modified: cfe/trunk/include/clang/Driver/CC1Options.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Driver/CC1Options.td?rev=273191=273190=273191=diff
> 
> ==
> --- cfe/trunk/include/clang/Driver/CC1Options.td (original)
> +++ cfe/trunk/include/clang/Driver/CC1Options.td Mon Jun 20 14:26:00 2016
> @@ -612,6 +612,8 @@ def fallow_half_arguments_and_returns :
>HelpText<"Allow function arguments and returns of type half">;
>  def fdefault_calling_conv_EQ : Joined<["-"], "fdefault-calling-conv=">,
>HelpText<"Set default MS calling convention">;
> +def finclude_default_header : Flag<["-"], "finclude-default-header">,
> +  HelpText<"Include the default header file for OpenCL">;
>
>  // C++ TSes.
>  def fcoroutines : Flag<["-"], "fcoroutines">,
>
> Modified: cfe/trunk/include/clang/Frontend/CompilerInvocation.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/
> CompilerInvocation.h?rev=273191=273190=273191=diff
> 
> ==
> --- cfe/trunk/include/clang/Frontend/CompilerInvocation.h (original)
> +++ cfe/trunk/include/clang/Frontend/CompilerInvocation.h Mon Jun 20
> 14:26:00 2016
> @@ -155,9 +155,10 @@ public:
>/// \param Opts - The LangOptions object to set up.
>/// \param IK - The input language.
>/// \param T - The target triple.
> +  /// \param PPOpts - The PreprocessorOptions affected.
>/// \param LangStd - The input language standard.
>static void setLangDefaults(LangOptions , InputKind IK,
> -   const llvm::Triple ,
> +   const llvm::Triple , PreprocessorOptions ,
> LangStandard::Kind LangStd = LangStandard::lang_
> unspecified);
>
>/// \brief Retrieve a module hash string that is suitable for uniquely
>
> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/
> Frontend/CompilerInvocation.cpp?rev=273191=273190=273191=diff
> 
> ==
> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Jun 20 14:26:00 2016
> @@ -1459,6 +1459,7 @@ bool isOpenCL(LangStandard::Kind LangStd
>
>  void CompilerInvocation::setLangDefaults(LangOptions , InputKind IK,
>   const llvm::Triple ,
> + PreprocessorOptions ,
>   LangStandard::Kind LangStd) {
> 

Re: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

2016-06-23 Thread Ismail Donmez via cfe-commits
Hi,

I won't have access to the system for ~2 weeks but the change looks
fine. Please commit if it passes the test on Linux with that.

Regards,
ismail


On Thu, Jun 23, 2016 at 4:39 PM, Liu, Yaxun (Sam) <yaxun@amd.com> wrote:
> I have a patch which may workaround this issue, however I could not test it 
> in Cygwin since I got issues build latest cmake in Cygwin and the downloaded 
> cmake does not work.
>
> Could you please try it?
>
> Thanks.
>
> Sam
>
> -Original Message-
> From: Ismail Donmez [mailto:ism...@i10z.com]
> Sent: Wednesday, June 22, 2016 1:52 PM
> To: Liu, Yaxun (Sam) <yaxun@amd.com>
> Cc: cfe-commits <cfe-commits@lists.llvm.org>
> Subject: Re: r273191 - [OpenCL] Include opencl-c.h by default as a clang 
> module
>
> Hi,
>
> On Wed, Jun 22, 2016 at 7:55 PM, Liu, Yaxun (Sam) <yaxun@amd.com> wrote:
>> The cmake of Cygwin itself does not support llvm. Which cmake did you use on 
>> Cygwin? Thanks.
>
> I use native windows cmake and this is the only test that ever failed with 
> this setup. chmod is from native cygwin which seems to be the problem.
>
> ismail
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

2016-06-23 Thread Liu, Yaxun (Sam) via cfe-commits
I have a patch which may workaround this issue, however I could not test it in 
Cygwin since I got issues build latest cmake in Cygwin and the downloaded cmake 
does not work.

Could you please try it?

Thanks.

Sam

-Original Message-
From: Ismail Donmez [mailto:ism...@i10z.com] 
Sent: Wednesday, June 22, 2016 1:52 PM
To: Liu, Yaxun (Sam) <yaxun@amd.com>
Cc: cfe-commits <cfe-commits@lists.llvm.org>
Subject: Re: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

Hi,

On Wed, Jun 22, 2016 at 7:55 PM, Liu, Yaxun (Sam) <yaxun@amd.com> wrote:
> The cmake of Cygwin itself does not support llvm. Which cmake did you use on 
> Cygwin? Thanks.

I use native windows cmake and this is the only test that ever failed with this 
setup. chmod is from native cygwin which seems to be the problem.

ismail
diff --git a/test/Headers/opencl-c-header.cl b/test/Headers/opencl-c-header.cl
index 4ba3b27..3723935 100644
--- a/test/Headers/opencl-c-header.cl
+++ b/test/Headers/opencl-c-header.cl
@@ -71,11 +71,11 @@
 // RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -o - 
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK 
--check-prefix=CHECK-MOD %s
 // RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -o - -cl-std=CL2.0 
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck 
--check-prefix=CHECK20 --check-prefix=CHECK-MOD %s
 // RUN: %clang_cc1 -triple amdgcn--amdhsa -emit-llvm -o - -cl-std=CL2.0  
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck 
--check-prefix=CHECK20 --check-prefix=CHECK-MOD %s
-// RUN: chmod u-w %t/* 
+// RUN: chmod u-w %t 
 // RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -o - 
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK 
--check-prefix=CHECK-MOD %s
 // RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -o - -cl-std=CL2.0 
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck 
--check-prefix=CHECK20 --check-prefix=CHECK-MOD %s
 // RUN: %clang_cc1 -triple amdgcn--amdhsa -emit-llvm -o - -cl-std=CL2.0 
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck 
--check-prefix=CHECK20 --check-prefix=CHECK-MOD %s
-// RUN: chmod u+w %t/*
+// RUN: chmod u+w %t
 
 char f(char x) {
 #if __OPENCL_C_VERSION__ != CL_VERSION_2_0
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

2016-06-22 Thread Ismail Donmez via cfe-commits
Hi,

On Wed, Jun 22, 2016 at 7:55 PM, Liu, Yaxun (Sam)  wrote:
> The cmake of Cygwin itself does not support llvm. Which cmake did you use on 
> Cygwin? Thanks.

I use native windows cmake and this is the only test that ever failed
with this setup. chmod is from native cygwin which seems to be the
problem.

ismail
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

2016-06-22 Thread Liu, Yaxun (Sam) via cfe-commits
The cmake of Cygwin itself does not support llvm. Which cmake did you use on 
Cygwin? Thanks.

Sam

-Original Message-
From: Ismail Donmez [mailto:ism...@i10z.com] 
Sent: Wednesday, June 22, 2016 12:37 PM
To: Liu, Yaxun (Sam) <yaxun@amd.com>
Cc: cfe-commits <cfe-commits@lists.llvm.org>
Subject: Re: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

On Wed, Jun 22, 2016 at 5:45 PM, Liu, Yaxun (Sam) <yaxun@amd.com> wrote:
> $ "chmod" "u-w"
> "C:\cygwin64\home\ismail\src\llvm\dist\tools\clang\test\Headers\Output\opencl-c-header.cl.tmp/*"
> # command stderr:
> r.cl.tmp/*: invalid mode: 'mp/*'
>
> the error msg is strange. On my Cygwin I got different error:
> chmod: cannot access 
> 'C:\cygwin64\home\ismail\src\llvm\dist\tools\clang\test\Headers\Output
> \opencl-c-header.cl.tmp/*': No such file or directory
>
> This is because * is not expanded when quoted.

Actually I added the quotes to test if it fixes the issue. Since you have 
cygwin can you reproduce the error?

ismail
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

2016-06-22 Thread Ismail Donmez via cfe-commits
On Wed, Jun 22, 2016 at 5:45 PM, Liu, Yaxun (Sam)  wrote:
> $ "chmod" "u-w"
> "C:\cygwin64\home\ismail\src\llvm\dist\tools\clang\test\Headers\Output\opencl-c-header.cl.tmp/*"
> # command stderr:
> r.cl.tmp/*: invalid mode: 'mp/*'
>
> the error msg is strange. On my Cygwin I got different error:
> chmod: cannot access 
> 'C:\cygwin64\home\ismail\src\llvm\dist\tools\clang\test\Headers\Output\opencl-c-header.cl.tmp/*':
>  No such file or directory
>
> This is because * is not expanded when quoted.

Actually I added the quotes to test if it fixes the issue. Since you
have cygwin can you reproduce the error?

ismail
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

2016-06-22 Thread Liu, Yaxun (Sam) via cfe-commits
$ "chmod" "u-w"
"C:\cygwin64\home\ismail\src\llvm\dist\tools\clang\test\Headers\Output\opencl-c-header.cl.tmp/*"
# command stderr:
r.cl.tmp/*: invalid mode: 'mp/*'

the error msg is strange. On my Cygwin I got different error:
chmod: cannot access 
'C:\cygwin64\home\ismail\src\llvm\dist\tools\clang\test\Headers\Output\opencl-c-header.cl.tmp/*':
 No such file or directory

This is because * is not expanded when quoted.

Sam

-Original Message-
From: Ismail Donmez [mailto:ism...@i10z.com] 
Sent: Wednesday, June 22, 2016 3:11 AM
To: Liu, Yaxun (Sam) <yaxun@amd.com>
Cc: cfe-commits <cfe-commits@lists.llvm.org>
Subject: Re: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

Hi,

On Mon, Jun 20, 2016 at 10:26 PM, Yaxun Liu via cfe-commits 
<cfe-commits@lists.llvm.org> wrote:
> Author: yaxunl
> Date: Mon Jun 20 14:26:00 2016
> New Revision: 273191
>
> URL: http://llvm.org/viewvc/llvm-project?rev=273191=rev
> Log:
> [OpenCL] Include opencl-c.h by default as a clang module
>
> Include opencl-c.h by default as a module to utilize the automatic AST 
> caching mechanism of clang modules.
>
> Add an option -finclude-default-header to enable default header for OpenCL, 
> which is off by default.
>
> Differential Revision: http://reviews.llvm.org/D20444
>
> Modified:
> cfe/trunk/include/clang/Basic/LangOptions.def
> cfe/trunk/include/clang/Driver/CC1Options.td
> cfe/trunk/include/clang/Frontend/CompilerInvocation.h
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/lib/Headers/module.modulemap
> cfe/trunk/test/Headers/opencl-c-header.cl

chmod lines doesn't seem to work on Cygwin:

$ "chmod" "u-w"
"C:\cygwin64\home\ismail\src\llvm\dist\tools\clang\test\Headers\Output\opencl-c-header.cl.tmp/*"
# command stderr:
r.cl.tmp/*: invalid mode: 'mp/*'
Try 'r.cl.tmp/* --help' for more information.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

2016-06-22 Thread Ismail Donmez via cfe-commits
Hi,

On Mon, Jun 20, 2016 at 10:26 PM, Yaxun Liu via cfe-commits
 wrote:
> Author: yaxunl
> Date: Mon Jun 20 14:26:00 2016
> New Revision: 273191
>
> URL: http://llvm.org/viewvc/llvm-project?rev=273191=rev
> Log:
> [OpenCL] Include opencl-c.h by default as a clang module
>
> Include opencl-c.h by default as a module to utilize the automatic AST 
> caching mechanism of clang modules.
>
> Add an option -finclude-default-header to enable default header for OpenCL, 
> which is off by default.
>
> Differential Revision: http://reviews.llvm.org/D20444
>
> Modified:
> cfe/trunk/include/clang/Basic/LangOptions.def
> cfe/trunk/include/clang/Driver/CC1Options.td
> cfe/trunk/include/clang/Frontend/CompilerInvocation.h
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/lib/Headers/module.modulemap
> cfe/trunk/test/Headers/opencl-c-header.cl

chmod lines doesn't seem to work on Cygwin:

$ "chmod" "u-w"
"C:\cygwin64\home\ismail\src\llvm\dist\tools\clang\test\Headers\Output\opencl-c-header.cl.tmp/*"
# command stderr:
r.cl.tmp/*: invalid mode: 'mp/*'
Try 'r.cl.tmp/* --help' for more information.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r273191 - [OpenCL] Include opencl-c.h by default as a clang module

2016-06-20 Thread Yaxun Liu via cfe-commits
Author: yaxunl
Date: Mon Jun 20 14:26:00 2016
New Revision: 273191

URL: http://llvm.org/viewvc/llvm-project?rev=273191=rev
Log:
[OpenCL] Include opencl-c.h by default as a clang module

Include opencl-c.h by default as a module to utilize the automatic AST caching 
mechanism of clang modules.

Add an option -finclude-default-header to enable default header for OpenCL, 
which is off by default.

Differential Revision: http://reviews.llvm.org/D20444

Modified:
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Frontend/CompilerInvocation.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Headers/module.modulemap
cfe/trunk/test/Headers/opencl-c-header.cl

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=273191=273190=273191=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Mon Jun 20 14:26:00 2016
@@ -218,7 +218,7 @@ LANGOPT(ObjCWeak, 1, 0, "Obj
 LANGOPT(ObjCSubscriptingLegacyRuntime , 1, 0, "Subscripting support in 
legacy ObjectiveC runtime")
 LANGOPT(FakeAddressSpaceMap , 1, 0, "OpenCL fake address space map")
 ENUM_LANGOPT(AddressSpaceMapMangling , AddrSpaceMapMangling, 2, ASMM_Target, 
"OpenCL address space map mangling mode")
-
+LANGOPT(IncludeDefaultHeader, 1, 0, "Include default header file for OpenCL")
 BENIGN_LANGOPT(DelayedTemplateParsing , 1, 0, "delayed template parsing")
 LANGOPT(BlocksRuntimeOptional , 1, 0, "optional blocks runtime")
 

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=273191=273190=273191=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Mon Jun 20 14:26:00 2016
@@ -612,6 +612,8 @@ def fallow_half_arguments_and_returns :
   HelpText<"Allow function arguments and returns of type half">;
 def fdefault_calling_conv_EQ : Joined<["-"], "fdefault-calling-conv=">,
   HelpText<"Set default MS calling convention">;
+def finclude_default_header : Flag<["-"], "finclude-default-header">,
+  HelpText<"Include the default header file for OpenCL">;
 
 // C++ TSes.
 def fcoroutines : Flag<["-"], "fcoroutines">,

Modified: cfe/trunk/include/clang/Frontend/CompilerInvocation.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInvocation.h?rev=273191=273190=273191=diff
==
--- cfe/trunk/include/clang/Frontend/CompilerInvocation.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInvocation.h Mon Jun 20 14:26:00 
2016
@@ -155,9 +155,10 @@ public:
   /// \param Opts - The LangOptions object to set up.
   /// \param IK - The input language.
   /// \param T - The target triple.
+  /// \param PPOpts - The PreprocessorOptions affected.
   /// \param LangStd - The input language standard.
   static void setLangDefaults(LangOptions , InputKind IK,
-   const llvm::Triple ,
+   const llvm::Triple , PreprocessorOptions ,
LangStandard::Kind LangStd = 
LangStandard::lang_unspecified);
   
   /// \brief Retrieve a module hash string that is suitable for uniquely 

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=273191=273190=273191=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Jun 20 14:26:00 2016
@@ -1459,6 +1459,7 @@ bool isOpenCL(LangStandard::Kind LangStd
 
 void CompilerInvocation::setLangDefaults(LangOptions , InputKind IK,
  const llvm::Triple ,
+ PreprocessorOptions ,
  LangStandard::Kind LangStd) {
   // Set some properties which depend solely on the input kind; it would be 
nice
   // to move these to the language standard, and have the driver resolve the
@@ -1543,6 +1544,10 @@ void CompilerInvocation::setLangDefaults
 Opts.DefaultFPContract = 1;
 Opts.NativeHalfType = 1;
 Opts.NativeHalfArgsAndReturns = 1;
+// Include default header file for OpenCL.
+if (Opts.IncludeDefaultHeader) {
+  PPOpts.Includes.push_back("opencl-c.h");
+}
   }
 
   Opts.CUDA = IK == IK_CUDA || IK == IK_PreprocessedCuda ||
@@ -1589,6 +1594,7 @@ static Visibility parseVisibility(Arg *a
 
 static void ParseLangArgs(LangOptions , ArgList , InputKind IK,