Skip to content

Commit 9c3d98d

Browse files
premanandraobader
authored andcommitted
[SYCL] Windows MS-Compatibility changes
Signed-off-by: Premanand M Rao <[email protected]>
1 parent 5e815d6 commit 9c3d98d

File tree

5 files changed

+34
-0
lines changed

5 files changed

+34
-0
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3562,6 +3562,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
35623562
CmdArgs.push_back(IsMSVC ? "-std=c++14" : "-std=c++11");
35633563
if (IsMSVC) {
35643564
CmdArgs.push_back("-fms-extensions");
3565+
CmdArgs.push_back("-fms-compatibility");
3566+
CmdArgs.push_back("-fdelayed-template-parsing");
35653567
VersionTuple MSVT = TC.computeMSVCVersion(&D, Args);
35663568
if (!MSVT.empty())
35673569
CmdArgs.push_back(Args.MakeArgString("-fms-compatibility-version=" +
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
// RUN: %clang_cc1 %s -E -dM | FileCheck %s
22
// RUN: %clang_cc1 %s -fsycl-is-device -E -dM | FileCheck --check-prefix=CHECK-SYCL %s
33
// RUN: %clang_cc1 %s -fsycl -E -dM | FileCheck --check-prefix=CHECK-ANY-SYCL %s
4+
// RUN: %clang_cc1 %s -fsycl-is-device -E -dM -fms-compatibility | FileCheck --check-prefix=CHECK-MSVC %s
45
// CHECK-NOT:#define __SYCL_DEVICE_ONLY__ 1
56
// CHECK-NOT:#define CL_SYCL_LANGUAGE_VERSION 121
67
// CHECK-ANY-SYCL-NOT:#define __SYCL_DEVICE_ONLY__ 1
78
// CHECK-ANY-SYCL:#define CL_SYCL_LANGUAGE_VERSION 121
89
// CHECK-SYCL:#define CL_SYCL_LANGUAGE_VERSION 121
10+
// CHECK-MSVC-NOT: __GNUC__
11+
// CHECK-MSVC-NOT: __STDC__
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// RUN: %clang -c %s -fsycl -E -dM -o - | FileCheck --check-prefix=CHECK-MSVC %s
2+
// REQUIRES: system-windows
3+
// CHECK-MSVC-NOT: __GNUC__
4+
// CHECK-MSVC-NOT: __STDC__
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// RUN: %clang_cc1 -std=c++1y -verify -fsyntax-only %s
2+
// RUN: %clang_cc1 -std=c++1y -verify -fsyntax-only %s -DDELAYED_TEMPLATE_PARSING -fdelayed-template-parsing
3+
// RUN: %clang %s -DDELAYED_TEMPLATE_PARSING -fsycl -c
4+
// REQUIRES: system-windows
5+
6+
template<typename T> struct U {
7+
#ifndef DELAYED_TEMPLATE_PARSING
8+
auto f(); // expected-note {{here}}
9+
int g() { return f(); } // expected-error {{cannot be used before it is defined}}
10+
#else
11+
// expected-no-diagnostics
12+
auto f();
13+
int g() { return f(); }
14+
#endif
15+
};
16+
#ifndef DELAYED_TEMPLATE_PARSING
17+
template int U<int>::g(); // expected-note {{in instantiation of}}
18+
#else
19+
template int U<int>::g();
20+
#endif
21+
template<typename T> auto U<T>::f() { return T(); }
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// RUN: %clang %s -fsycl -c
2+
// REQUIRES: system-windows
3+
4+
#include <windows.h>

0 commit comments

Comments
 (0)