Skip to content

Commit 00b7797

Browse files
committed
[SYCL] do not support any SYCL standard except 2020
[SYCL] fix formatting [SYCL] remove spaces
1 parent d280a9c commit 00b7797

File tree

5 files changed

+16
-22
lines changed

5 files changed

+16
-22
lines changed

clang/include/clang/Basic/LangOptions.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ class LangOptionsBase {
148148

149149
enum SYCLMajorVersion {
150150
SYCL_None,
151-
SYCL_2017,
152151
SYCL_2020,
153152
// The "default" SYCL version to be used when none is specified on the
154153
// frontend command line.

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8346,8 +8346,8 @@ def sycl_std_EQ : Joined<["-"], "sycl-std=">, Group<sycl_Group>,
83468346
Flags<[NoArgumentUnused]>,
83478347
Visibility<[ClangOption, CC1Option, CLOption]>,
83488348
HelpText<"SYCL language standard to compile for.">,
8349-
Values<"2020,2017,121,1.2.1,sycl-1.2.1">,
8350-
NormalizedValues<["SYCL_2020", "SYCL_2017", "SYCL_2017", "SYCL_2017", "SYCL_2017"]>,
8349+
Values<"2020">,
8350+
NormalizedValues<["SYCL_2020"]>,
83518351
NormalizedValuesScope<"LangOptions">,
83528352
MarshallingInfoEnum<LangOpts<"SYCLVersion">, "SYCL_None">,
83538353
ShouldParseIf<!strconcat(fsycl_is_device.KeyPath, "||", fsycl_is_host.KeyPath)>;

clang/lib/Frontend/InitPreprocessor.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,7 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
584584

585585
if (LangOpts.SYCLIsDevice || LangOpts.SYCLIsHost) {
586586
// SYCL Version is set to a value when building SYCL applications
587-
if (LangOpts.getSYCLVersion() == LangOptions::SYCL_2017)
588-
Builder.defineMacro("CL_SYCL_LANGUAGE_VERSION", "121");
589-
else if (LangOpts.getSYCLVersion() == LangOptions::SYCL_2020)
587+
if (LangOpts.getSYCLVersion() == LangOptions::SYCL_2020)
590588
Builder.defineMacro("SYCL_LANGUAGE_VERSION", "202012L");
591589
}
592590

clang/test/Preprocessor/sycl-macro.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// RUN: %clang_cc1 %s -E -dM | FileCheck %s
2-
// RUN: %clang_cc1 %s -fsycl-is-device -sycl-std=2017 -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD %s
3-
// RUN: %clang_cc1 %s -fsycl-is-host -sycl-std=2017 -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD %s
42
// RUN: %clang_cc1 %s -fsycl-is-host -sycl-std=2020 -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD-2020 %s
53
// RUN: %clang_cc1 %s -fsycl-is-host -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD-2020 %s
6-
// RUN: %clang_cc1 %s -fsycl-is-device -sycl-std=1.2.1 -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD %s
74
// RUN: %clang_cc1 %s -fsycl-is-device -sycl-std=2020 -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD-2020 %s
85
// RUN: %clang_cc1 %s -fsycl-is-device -E -dM | FileCheck --check-prefixes=CHECK-SYCL %s
96

clang/unittests/Frontend/CompilerInvocationTest.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ TEST_F(CommandLineTest, ConditionalParsingIfFalseFlagNotPresent) {
603603
}
604604

605605
TEST_F(CommandLineTest, ConditionalParsingIfFalseFlagPresent) {
606-
const char *Args[] = {"-sycl-std=2017"};
606+
const char *Args[] = {"-sycl-std=2020"};
607607

608608
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
609609

@@ -641,50 +641,50 @@ TEST_F(CommandLineTest, ConditionalParsingIfOddSyclStdArg1) {
641641

642642
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
643643

644-
ASSERT_FALSE(Diags->hasErrorOccurred());
644+
ASSERT_TRUE(Diags->hasErrorOccurred());
645645
ASSERT_TRUE(Invocation.getLangOpts().SYCLIsDevice);
646646
ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost);
647-
ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_2017);
647+
ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_None);
648648

649649
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
650650

651651
ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fsycl-is-device")));
652652
ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fsycl-is-host"))));
653-
ASSERT_THAT(GeneratedArgs, Contains(HasSubstr("-sycl-std=2017")));
653+
ASSERT_THAT(GeneratedArgs, Not(Contains(HasSubstr("-sycl-std=2020"))));
654654
}
655655

656656
TEST_F(CommandLineTest, ConditionalParsingIfOddSyclStdArg2) {
657657
const char *Args[] = {"-fsycl-is-device", "-sycl-std=1.2.1"};
658658

659659
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
660660

661-
ASSERT_FALSE(Diags->hasErrorOccurred());
661+
ASSERT_TRUE(Diags->hasErrorOccurred());
662662
ASSERT_TRUE(Invocation.getLangOpts().SYCLIsDevice);
663663
ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost);
664-
ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_2017);
664+
ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_None);
665665

666666
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
667667

668668
ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fsycl-is-device")));
669669
ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fsycl-is-host"))));
670-
ASSERT_THAT(GeneratedArgs, Contains(HasSubstr("-sycl-std=2017")));
670+
ASSERT_THAT(GeneratedArgs, Not(Contains(HasSubstr("-sycl-std=2020"))));
671671
}
672672

673673
TEST_F(CommandLineTest, ConditionalParsingIfOddSyclStdArg3) {
674674
const char *Args[] = {"-fsycl-is-device", "-sycl-std=sycl-1.2.1"};
675675

676676
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
677677

678-
ASSERT_FALSE(Diags->hasErrorOccurred());
678+
ASSERT_TRUE(Diags->hasErrorOccurred());
679679
ASSERT_TRUE(Invocation.getLangOpts().SYCLIsDevice);
680680
ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost);
681-
ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_2017);
681+
ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_None);
682682

683683
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
684684

685685
ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fsycl-is-device")));
686686
ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fsycl-is-host"))));
687-
ASSERT_THAT(GeneratedArgs, Contains(HasSubstr("-sycl-std=2017")));
687+
ASSERT_THAT(GeneratedArgs, Not(Contains(HasSubstr("-sycl-std=2020"))));
688688
}
689689

690690
TEST_F(CommandLineTest, ConditionalParsingIfTrueFlagNotPresentHost) {
@@ -718,17 +718,17 @@ TEST_F(CommandLineTest, ConditionalParsingIfTrueFlagNotPresentDevice) {
718718
}
719719

720720
TEST_F(CommandLineTest, ConditionalParsingIfTrueFlagPresent) {
721-
const char *Args[] = {"-fsycl-is-device", "-sycl-std=2017"};
721+
const char *Args[] = {"-fsycl-is-device", "-sycl-std=2020"};
722722

723723
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
724724

725725
ASSERT_FALSE(Diags->hasErrorOccurred());
726-
ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_2017);
726+
ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_2020);
727727

728728
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
729729

730730
ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fsycl-is-device")));
731-
ASSERT_THAT(GeneratedArgs, Contains(StrEq("-sycl-std=2017")));
731+
ASSERT_THAT(GeneratedArgs, Contains(StrEq("-sycl-std=2020")));
732732
}
733733

734734
// Wide integer option.

0 commit comments

Comments
 (0)