@@ -6029,6 +6029,23 @@ static void OutputStableNameInChars(raw_ostream &O, StringRef Name) {
60296029 }
60306030}
60316031
6032+ static void EmitPragmaDiagnosticPush (raw_ostream &O, StringRef DiagName) {
6033+ O << " \n " ;
6034+ O << " #ifdef __clang__\n " ;
6035+ O << " #pragma clang diagnostic push\n " ;
6036+ O << " #pragma clang diagnostic ignored \" " << DiagName.str () << " \"\n " ;
6037+ O << " #endif // defined(__clang__)\n " ;
6038+ O << " \n " ;
6039+ }
6040+
6041+ static void EmitPragmaDiagnosticPop (raw_ostream &O) {
6042+ O << " \n " ;
6043+ O << " #ifdef __clang__\n " ;
6044+ O << " #pragma clang diagnostic pop\n " ;
6045+ O << " #endif // defined(__clang__)\n " ;
6046+ O << " \n " ;
6047+ }
6048+
60326049void SYCLIntegrationHeader::emit (raw_ostream &O) {
60336050 O << " // This is auto-generated SYCL integration header.\n " ;
60346051 O << " \n " ;
@@ -6127,6 +6144,9 @@ void SYCLIntegrationHeader::emit(raw_ostream &O) {
61276144 // main() function.
61286145
61296146 if (NeedToEmitDeviceGlobalRegistration) {
6147+ // Supress the reserved identifier diagnostic that clang generates
6148+ // for the construct below.
6149+ EmitPragmaDiagnosticPush (O, " -Wreserved-identifier" );
61306150 O << " namespace {\n " ;
61316151
61326152 O << " class __sycl_device_global_registration {\n " ;
@@ -6138,12 +6158,16 @@ void SYCLIntegrationHeader::emit(raw_ostream &O) {
61386158 O << " } // namespace\n " ;
61396159
61406160 O << " \n " ;
6161+ EmitPragmaDiagnosticPop (O);
61416162 }
61426163
61436164 // Generate declaration of variable of type __sycl_host_pipe_registration
61446165 // whose sole purpose is to run its constructor before the application's
61456166 // main() function.
61466167 if (NeedToEmitHostPipeRegistration) {
6168+ // Supress the reserved identifier diagnostic that clang generates
6169+ // for the construct below.
6170+ EmitPragmaDiagnosticPush (O, " -Wreserved-identifier" );
61476171 O << " namespace {\n " ;
61486172
61496173 O << " class __sycl_host_pipe_registration {\n " ;
@@ -6155,6 +6179,7 @@ void SYCLIntegrationHeader::emit(raw_ostream &O) {
61556179 O << " } // namespace\n " ;
61566180
61576181 O << " \n " ;
6182+ EmitPragmaDiagnosticPop (O);
61586183 }
61596184
61606185
@@ -6723,12 +6748,16 @@ bool SYCLIntegrationFooter::emit(raw_ostream &OS) {
67236748 OS << " #include <sycl/detail/device_global_map.hpp>\n " ;
67246749 DeviceGlobOS.flush ();
67256750 OS << " namespace sycl::detail {\n " ;
6751+ // Supress the old-style case diagnostic that clang generates
6752+ // for the construct below in DeviceGlobalsBuf.
6753+ EmitPragmaDiagnosticPush (OS, " -Wold-style-cast" );
67266754 OS << " namespace {\n " ;
67276755 OS << " __sycl_device_global_registration::__sycl_device_global_"
67286756 " registration() noexcept {\n " ;
67296757 OS << DeviceGlobalsBuf;
67306758 OS << " }\n " ;
67316759 OS << " } // namespace (unnamed)\n " ;
6760+ EmitPragmaDiagnosticPop (OS);
67326761 OS << " } // namespace sycl::detail\n " ;
67336762
67346763 S.getSyclIntegrationHeader ().addDeviceGlobalRegistration ();
@@ -6738,12 +6767,16 @@ bool SYCLIntegrationFooter::emit(raw_ostream &OS) {
67386767 OS << " #include <sycl/detail/host_pipe_map.hpp>\n " ;
67396768 HostPipesOS.flush ();
67406769 OS << " namespace sycl::detail {\n " ;
6770+ // Supress the old-style case diagnostic that clang generates
6771+ // for the construct below in HostPipesBuf.
6772+ EmitPragmaDiagnosticPush (OS, " -Wold-style-cast" );
67416773 OS << " namespace {\n " ;
67426774 OS << " __sycl_host_pipe_registration::__sycl_host_pipe_"
67436775 " registration() noexcept {\n " ;
67446776 OS << HostPipesBuf;
67456777 OS << " }\n " ;
67466778 OS << " } // namespace (unnamed)\n " ;
6779+ EmitPragmaDiagnosticPop (OS);
67476780 OS << " } // namespace sycl::detail\n " ;
67486781
67496782 S.getSyclIntegrationHeader ().addHostPipeRegistration ();
0 commit comments