Skip to content

Commit 20920a3

Browse files
committed
Apply suggestions
1 parent a8f5d9b commit 20920a3

File tree

7 files changed

+22
-9
lines changed

7 files changed

+22
-9
lines changed

clang/include/clang/Basic/LangOptions.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ LANGOPT(
273273
"get/operator[], get_id/operator[] and get_global_id/get_global_linear_id "
274274
"in SYCL class id, iterm and nd_iterm")
275275
LANGOPT(SYCLDisableRangeRounding, 1, 0, "Disable parallel for range rounding")
276-
LANGOPT(SYCLEnableIntHeader, 1, 0, "Enable diagnostics based on SYCL integration header")
276+
LANGOPT(SYCLEnableIntHeaderDiags, 1, 0, "Enable diagnostics based on SYCL integration header")
277277

278278
LANGOPT(HIPUseNewLaunchAPI, 1, 0, "Use new kernel launching API for HIP")
279279

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6057,9 +6057,9 @@ def fenable_sycl_dae : Flag<["-"], "fenable-sycl-dae">,
60576057
def fsycl_disable_range_rounding : Flag<["-"], "fsycl-disable-range-rounding">,
60586058
HelpText<"Disable parallel for range rounding.">,
60596059
MarshallingInfoFlag<LangOpts<"SYCLDisableRangeRounding">>;
6060-
def fsycl_enable_int_header: Flag<["-"], "fsycl-enable-int-header">,
6060+
def fsycl_enable_int_header: Flag<["-"], "fsycl-enable-int-header-diags">,
60616061
HelpText<"Enable diagnostics based on SYCL integration header.">,
6062-
MarshallingInfoFlag<LangOpts<"SYCLEnableIntHeader">>;
6062+
MarshallingInfoFlag<LangOpts<"SYCLEnableIntHeaderDiags">>;
60636063

60646064
} // let Flags = [CC1Option, NoDriverOption]
60656065

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4854,9 +4854,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
48544854
CmdArgs.push_back("-dependency-filter");
48554855
CmdArgs.push_back(Args.MakeArgString(Header));
48564856

4857-
// Since this is host compilation and integration header is included,
4858-
// enable integration header based diagnostics.
4859-
CmdArgs.push_back("-fsycl-enable-int-header");
4857+
// Since this is a host compilation and the integration header is
4858+
// included, enable the integration header based diagnostics.
4859+
CmdArgs.push_back("-fsycl-enable-int-header-diags");
48604860
}
48614861
// Let the FE know we are doing a SYCL offload compilation, but we are
48624862
// doing the host pass.

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,13 @@ static bool FixupInvocation(CompilerInvocation &Invocation,
491491
Diags.Report(diag::err_drv_argument_not_allowed_with) << "-fsycl-is-device"
492492
<< "-fsycl-is-host";
493493

494+
// SYCLEnableIntHeader implies SYCLIsHost. Error if
495+
// -fsycl-enable-int-header-diags is passed without -fsycl-is-host.
496+
if (LangOpts.SYCLEnableIntHeaderDiags && !LangOpts.SYCLIsHost)
497+
Diags.Report(diag::err_opt_not_valid_without_opt)
498+
<< "-fsycl-enable-int-header-diags"
499+
<< "-fsycl-is-host";
500+
494501
if (Args.hasArg(OPT_fgnu89_inline) && LangOpts.CPlusPlus)
495502
Diags.Report(diag::err_drv_argument_not_allowed_with)
496503
<< "-fgnu89-inline" << GetInputKindName(IK);

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3529,8 +3529,7 @@ class SYCLKernelNameTypeVisitor
35293529
// ::KernelName1). Since this is not visible to runtime code that
35303530
// submits kernels, this is invalid.
35313531
if (Tag->isCompleteDefinition() ||
3532-
(S.getLangOpts().SYCLIsHost &&
3533-
S.getLangOpts().SYCLEnableIntHeader)) {
3532+
S.getLangOpts().SYCLEnableIntHeaderDiags) {
35343533
S.Diag(KernelInvocationFuncLoc,
35353534
diag::err_sycl_kernel_incorrectly_named)
35363535
<< /* kernel name should be forward declarable at namespace
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Test that we disallow -fsycl-enable-int-header-diags without -fsycl-is-host.
2+
3+
// RUN: not %clang_cc1 -fsycl-enable-int-header-diags %s 2>&1 | FileCheck --check-prefix=ERROR %s
4+
// RUN: not %clang_cc1 -fsycl-is-device -fsycl-enable-int-header-diags %s 2>&1 | FileCheck --check-prefix=ERROR %s
5+
6+
// ERROR: error: option '-fsycl-enable-int-header-diags' cannot be specified without '-fsycl-is-host'
7+

clang/test/SemaSYCL/non-fwd-declarable-kernel-name.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clang_cc1 -fsycl-is-device -internal-isystem %S/Inputs -fno-sycl-unnamed-lambda -fsyntax-only -sycl-std=2020 -fsycl-int-header=%t.h %s
2-
// RUN: %clang_cc1 -fsycl-is-host -DHEADER_FLAG -fsycl-enable-int-header -internal-isystem %S/Inputs -fno-sycl-unnamed-lambda -fsyntax-only -verify -include %t.h %s
2+
// RUN: %clang_cc1 -fsycl-is-host -DHEADER_FLAG -fsycl-enable-int-header-diags -internal-isystem %S/Inputs -fno-sycl-unnamed-lambda -fsyntax-only -verify -include %t.h %s
33
// RUN: %clang_cc1 -fsycl-is-host -DNO_HEADER_FLAG -internal-isystem %S/Inputs -fno-sycl-unnamed-lambda -fsyntax-only -verify -include %t.h %s
44

55
// This test verifies that incorrect kernel names are diagnosed correctly if

0 commit comments

Comments
 (0)