Skip to content

Commit 2208322

Browse files
committed
Fix the frontend unit test behavior.
If -sycl-std is passed to the driver without -fsycl, then it is not passed to the -cc1 invocation.
1 parent e09bb27 commit 2208322

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

clang/include/clang/Driver/Options.td

+5-4
Original file line numberDiff line numberDiff line change
@@ -4271,10 +4271,6 @@ def fsycl : Flag<["-"], "fsycl">, Flags<[NoXarchOption, CoreOption]>, Group<sycl
42714271
HelpText<"Enables SYCL kernels compilation for device">;
42724272
def fno_sycl : Flag<["-"], "fno-sycl">, Flags<[NoXarchOption, CoreOption]>, Group<sycl_Group>,
42734273
HelpText<"Disables SYCL kernels compilation for device">;
4274-
def sycl_std_EQ : Joined<["-"], "sycl-std=">, Group<sycl_Group>, Flags<[CC1Option, NoArgumentUnused, CoreOption]>,
4275-
HelpText<"SYCL language standard to compile for.">, Values<"2020,2017,121,1.2.1,sycl-1.2.1">,
4276-
NormalizedValues<["SYCL_2020", "SYCL_2017", "SYCL_2017", "SYCL_2017", "SYCL_2017"]>, NormalizedValuesScope<"LangOptions">,
4277-
MarshallingInfoString<LangOpts<"SYCLVersion">, "SYCL_None">, AutoNormalizeEnum;
42784274
defm sycl_esimd: OptInFFlag<"sycl-explicit-simd", "Enable", "Disable", " SYCL explicit SIMD extension.", [CC1Option,CoreOption], LangOpts<"SYCLExplicitSIMD">>;
42794275
defm sycl_early_optimizations : OptOutFFlag<"sycl-early-optimizations", "Enable", "Disable", " standard optimization pipeline for SYCL device compiler", [CoreOption]>;
42804276
def fsycl_dead_args_optimization : Flag<["-"], "fsycl-dead-args-optimization">,
@@ -5486,6 +5482,11 @@ def fsycl_is_device : Flag<["-"], "fsycl-is-device">,
54865482
def fsycl_is_host : Flag<["-"], "fsycl-is-host">,
54875483
HelpText<"SYCL host compilation">,
54885484
MarshallingInfoFlag<LangOpts<"SYCLIsHost">>;
5485+
def sycl_std_EQ : Joined<["-"], "sycl-std=">, Group<sycl_Group>, Flags<[CC1Option, NoArgumentUnused, CoreOption]>,
5486+
HelpText<"SYCL language standard to compile for.">, Values<"2020,2017,121,1.2.1,sycl-1.2.1">,
5487+
NormalizedValues<["SYCL_2020", "SYCL_2017", "SYCL_2017", "SYCL_2017", "SYCL_2017"]>, NormalizedValuesScope<"LangOptions">,
5488+
MarshallingInfoString<LangOpts<"SYCLVersion">, "SYCL_None">,
5489+
ShouldParseIf<!strconcat(fsycl_is_device.KeyPath, "||", fsycl_is_host.KeyPath)>, AutoNormalizeEnum;
54895490
def fsycl_int_header : Separate<["-"], "fsycl-int-header">,
54905491
HelpText<"Generate SYCL integration header into this file.">,
54915492
MarshallingInfoString<LangOpts<"SYCLIntHeader">>;

clang/unittests/Frontend/CompilerInvocationTest.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -559,12 +559,12 @@ TEST_F(CommandLineTest, ConditionalParsingIfTrueFlagPresent) {
559559
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
560560

561561
ASSERT_TRUE(Diags->hasErrorOccurred());
562-
ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_2017);
562+
ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_None);
563563

564564
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
565565

566566
ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fsycl"))));
567-
ASSERT_THAT(GeneratedArgs, Contains(StrEq("-sycl-std=2017")));
567+
ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-sycl-std=2017"))));
568568
}
569569

570570
// Wide integer option.

0 commit comments

Comments
 (0)