Skip to content

Commit e157d24

Browse files
authored
[SYCL][NFC] Wrap classes in .cpp into a namespace to disable external linkage. (#1776)
Signed-off-by: Konstantin S Bobrovsky <[email protected]>
1 parent 0c2e99c commit e157d24

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

clang/lib/CodeGen/CGSYCLRuntime.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
using namespace clang;
2121
using namespace CodeGen;
2222

23+
namespace {
24+
2325
/// Various utilities.
2426
/// TODO partially duplicates functionality from SemaSYCL.cpp, can be shared.
2527
class Util {
@@ -52,6 +54,8 @@ const char *WG_SCOPE_MD_ID = "work_group_scope";
5254
const char *WI_SCOPE_MD_ID = "work_item_scope";
5355
const char *PFWI_MD_ID = "parallel_for_work_item";
5456

57+
} // anonymous namespace
58+
5559
bool CGSYCLRuntime::actOnFunctionStart(const FunctionDecl &FD,
5660
llvm::Function &F) {
5761
SYCLScopeAttr *Scope = FD.getAttr<SYCLScopeAttr>();

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ enum KernelInvocationKind {
5454
const static std::string InitMethodName = "__init";
5555
const static std::string FinalizeMethodName = "__finalize";
5656

57+
namespace {
58+
5759
/// Various utilities.
5860
class Util {
5961
public:
@@ -91,6 +93,8 @@ class Util {
9193
ArrayRef<Util::DeclContextDesc> Scopes);
9294
};
9395

96+
} // anonymous namespace
97+
9498
// This information is from Section 4.13 of the SYCL spec
9599
// https://www.khronos.org/registry/SYCL/specs/sycl-1.2.1.pdf
96100
// This function returns false if the math lib function

0 commit comments

Comments
 (0)