Skip to content

Commit e502a1b

Browse files
committed
Apply comments
1 parent 39b0393 commit e502a1b

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6834,15 +6834,16 @@ class FreeFunctionPrinter {
68346834
auto TemplateArgPrinter = [&](const TemplateArgument &Arg) {
68356835
if (Arg.getKind() != TemplateArgument::ArgKind::Expression ||
68366836
Arg.isInstantiationDependent()) {
6837-
Arg.print(Policy, ParmListOstream, false /* IncludeType */);
6837+
Arg.print(Policy, ParmListOstream, /* IncludeType = */ false);
68386838
return;
68396839
}
68406840

68416841
Expr *E = Arg.getAsExpr();
6842+
assert(E && "Failed to get an Expr for an Expression template arg?");
68426843
if (E->getType().getTypePtr()->isScopedEnumeralType()) {
68436844
// Scoped enumerations can't be implicitly cast from integers, so
6844-
// we don't need to evaluate them
6845-
Arg.print(Policy, ParmListOstream, false /* IncludeType */);
6845+
// we don't need to evaluate them.
6846+
Arg.print(Policy, ParmListOstream, /* IncludeType = */ false);
68466847
return;
68476848
}
68486849

@@ -6861,7 +6862,7 @@ class FreeFunctionPrinter {
68616862
if (I != 0)
68626863
ParmListOstream << ", ";
68636864
// If we have a specialized argument, use it. Otherwise fallback to a
6864-
// default argument
6865+
// default argument.
68656866
TemplateArgPrinter(I < SE ? SpecArgs[I] : DeclArgs[I]);
68666867
}
68676868

clang/test/CodeGenSYCL/free-function-kernel-expr-as-template-arg.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ enum class class_enum_typed : int {
3838
VAL_D
3939
};
4040

41+
constexpr int bar(int arg) {
42+
return arg + 42;
43+
}
44+
4145
} // namespace ns
4246

4347
template<int V>
@@ -99,3 +103,8 @@ void constexpr_ns2(Arg4<ns::class_enum::VAL_A>) {}
99103
void constexpr_ns2(Arg5<ns::class_enum_typed::VAL_C>) {}
100104

101105
// CHECK: void constexpr_ns2(Arg5<ns::class_enum_typed::VAL_C> );
106+
107+
[[__sycl_detail__::add_ir_attributes_function("sycl-nd-range-kernel", 2)]]
108+
void constexpr_call(Arg<ns::bar(B)>) {}
109+
110+
// CHECK: void constexpr_call(Arg<45> );

0 commit comments

Comments
 (0)