Skip to content

Commit 683d7eb

Browse files
committed
Apply some review feedback
1 parent 0f288d7 commit 683d7eb

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

clang/include/clang/Sema/Sema.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ class SYCLIntegrationFooter {
440440
SYCLIntegrationFooter(Sema &S) : S(S) {}
441441
bool emit(StringRef MainSrc);
442442
void addVarDecl(const VarDecl *VD);
443-
bool metSYCLDeviceGlobals() { return DeviceGlobalsEmitted; }
443+
bool isDeviceGlobalsEmitted() { return DeviceGlobalsEmitted; }
444444

445445
private:
446446
bool emit(raw_ostream &O);

clang/lib/Sema/Sema.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,8 +1101,8 @@ void Sema::ActOnEndOfTranslationUnitFragment(TUFragmentKind Kind) {
11011101
// Set the names of the kernels, now that the names have settled down. This
11021102
// needs to happen before we generate the integration headers.
11031103
SetSYCLKernelNames();
1104-
// Make sure that the footer emitted before header, since only after the
1105-
// footer is emitted it is known that translation unit contains device
1104+
// Make sure that the footer is emitted before header, since only after the
1105+
// footer is emitted is it known that translation unit contains device
11061106
// global variables.
11071107
if (SyclIntFooter != nullptr)
11081108
SyclIntFooter->emit(getLangOpts().SYCLIntFooter);

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4684,14 +4684,14 @@ void SYCLIntegrationHeader::emit(raw_ostream &O) {
46844684
// whose sole purpose is to run its constructor before the application's
46854685
// main() function.
46864686

4687-
if (S.getSyclIntegrationFooter().metSYCLDeviceGlobals()) {
4687+
if (S.getSyclIntegrationFooter().isDeviceGlobalsEmitted()) {
46884688
O << "namespace {\n";
46894689

46904690
O << "class __sycl_device_global_registration {\n";
46914691
O << "public:\n";
46924692
O << " __sycl_device_global_registration() noexcept;\n";
46934693
O << "};\n";
4694-
O << "__sycl_device_global_registration __sycl_device_global_registerer;\n";
4694+
O << "__sycl_device_global_registration __sycl_device_global_registrar;\n";
46954695

46964696
O << "} // namespace\n";
46974697

@@ -4971,7 +4971,7 @@ static void PrintNSClosingBraces(raw_ostream &OS, const DeclContext *DC) {
49714971
[](raw_ostream &OS, const NamespaceDecl *NS) {}, OS, DC);
49724972
}
49734973

4974-
static std::string EmitSpecIdShim(raw_ostream &OS, unsigned &ShimCounter,
4974+
static std::string EmitShim(raw_ostream &OS, unsigned &ShimCounter,
49754975
const std::string &LastShim,
49764976
const NamespaceDecl *AnonNS) {
49774977
std::string NewShimName =
@@ -4991,7 +4991,7 @@ static std::string EmitSpecIdShim(raw_ostream &OS, unsigned &ShimCounter,
49914991
}
49924992

49934993
// Emit the list of shims required for a DeclContext, calls itself recursively.
4994-
static void EmitSpecIdShims(raw_ostream &OS, unsigned &ShimCounter,
4994+
static void EmitShims(raw_ostream &OS, unsigned &ShimCounter,
49954995
const DeclContext *DC,
49964996
std::string &NameForLastShim) {
49974997
if (DC->isTranslationUnit()) {
@@ -5007,7 +5007,7 @@ static void EmitSpecIdShims(raw_ostream &OS, unsigned &ShimCounter,
50075007
} else if (const auto *ND = dyn_cast<NamespaceDecl>(CurDecl)) {
50085008
if (ND->isAnonymousNamespace()) {
50095009
// Print current shim, reset 'name for last shim'.
5010-
NameForLastShim = EmitSpecIdShim(OS, ShimCounter, NameForLastShim, ND);
5010+
NameForLastShim = EmitShim(OS, ShimCounter, NameForLastShim, ND);
50115011
} else {
50125012
NameForLastShim = ND->getNameAsString() + "::" + NameForLastShim;
50135013
}
@@ -5021,13 +5021,13 @@ static void EmitSpecIdShims(raw_ostream &OS, unsigned &ShimCounter,
50215021
"Unhandled decl type");
50225022
}
50235023

5024-
EmitSpecIdShims(OS, ShimCounter, CurDecl->getDeclContext(), NameForLastShim);
5024+
EmitShims(OS, ShimCounter, CurDecl->getDeclContext(), NameForLastShim);
50255025
}
50265026

50275027
// Emit the list of shims required for a variable declaration.
50285028
// Returns a string containing the FQN of the 'top most' shim, including its
50295029
// function call parameters.
5030-
static std::string EmitSpecIdShims(raw_ostream &OS, unsigned &ShimCounter,
5030+
static std::string EmitShims(raw_ostream &OS, unsigned &ShimCounter,
50315031
PrintingPolicy &Policy, const VarDecl *VD) {
50325032
if (!VD->isInAnonymousNamespace())
50335033
return "";
@@ -5036,7 +5036,7 @@ static std::string EmitSpecIdShims(raw_ostream &OS, unsigned &ShimCounter,
50365036
VD->getNameForDiagnostic(stream, Policy, false);
50375037
stream.flush();
50385038

5039-
EmitSpecIdShims(OS, ShimCounter, VD->getDeclContext(), RelativeName);
5039+
EmitShims(OS, ShimCounter, VD->getDeclContext(), RelativeName);
50405040
return RelativeName;
50415041
}
50425042

@@ -5074,7 +5074,7 @@ bool SYCLIntegrationFooter::emit(raw_ostream &OS) {
50745074
OS << "#include <CL/sycl/detail/defines_elementary.hpp>\n";
50755075

50765076
Visited.insert(VD);
5077-
std::string TopShim = EmitSpecIdShims(OS, ShimCounter, Policy, VD);
5077+
std::string TopShim = EmitShims(OS, ShimCounter, Policy, VD);
50785078
if (Util::isSyclDeviceGlobalType(VD->getType())) {
50795079
DeviceGlobalsEmitted = true;
50805080
DeviceGlobOS << "device_global_map::add(";

clang/test/CodeGenSYCL/device_global_int_footer_header.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
// RUN: FileCheck -input-file=%t.footer.h %s --check-prefix=CHECK-FOOTER
33
// RUN: FileCheck -input-file=%t.header.h %s --check-prefix=CHECK-HEADER
44

5-
// Try and compile all this stuff.
5+
// Try and compile generated integration header and footer on host.
66
// RUN: %clang_cc1 -fsycl-is-host -x c++ -std=c++17 -internal-isystem %S/Inputs -fsyntax-only -include %t.header.h -include %s %t.footer.h
77

88
// This test checks that integration header and footer are emitted correctly
9-
// for device_global variables. It also checks that emitted costructs
9+
// for device_global variables. It also checks that emitted constructs
1010
// are syntactically correct.
1111

1212
#include "sycl.hpp"
@@ -25,7 +25,7 @@ int main() {
2525
// CHECK-HEADER-NEXT: public:
2626
// CHECK-HEADER-NEXT: __sycl_device_global_registration() noexcept;
2727
// CHECK-HEADER-NEXT: };
28-
// CHECK-HEADER-NEXT: __sycl_device_global_registration __sycl_device_global_registerer;
28+
// CHECK-HEADER-NEXT: __sycl_device_global_registration __sycl_device_global_registrar;
2929
// CHECK-HEADER-NEXT: } // namespace
3030
// CHECK-HEADER: } // namespace detail
3131
// CHECK-HEADER: } // namespace sycl

clang/test/CodeGenSYCL/device_globals_with_spec_ids.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %clang_cc1 -fsycl-is-device -std=c++17 -internal-isystem %S/Inputs -triple spir64-unknown-unknown -fsycl-int-footer=%t.footer.h -fsycl-int-header=%t.header.h %s -emit-llvm -o %t.ll
22
// RUN: FileCheck -input-file=%t.footer.h %s
33

4-
// Try and compile all this stuff.
4+
// Try and compile generated integration header and footer on host.
55
// RUN: %clang_cc1 -fsycl-is-host -x c++ -std=c++17 -internal-isystem %S/Inputs -fsyntax-only -include %t.header.h -include %s %t.footer.h
66

77
// This test checks that integration footer is emitted correctly if both

0 commit comments

Comments
 (0)