Skip to content

[SYCL] Wrap classes in .cpp into a namespace to disable external linkage #1776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions clang/lib/CodeGen/CGSYCLRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
using namespace clang;
using namespace CodeGen;

namespace {

/// Various utilities.
/// TODO partially duplicates functionality from SemaSYCL.cpp, can be shared.
class Util {
Expand Down Expand Up @@ -52,6 +54,8 @@ const char *WG_SCOPE_MD_ID = "work_group_scope";
const char *WI_SCOPE_MD_ID = "work_item_scope";
const char *PFWI_MD_ID = "parallel_for_work_item";

} // anonymous namespace

bool CGSYCLRuntime::actOnFunctionStart(const FunctionDecl &FD,
llvm::Function &F) {
SYCLScopeAttr *Scope = FD.getAttr<SYCLScopeAttr>();
Expand Down
4 changes: 4 additions & 0 deletions clang/lib/Sema/SemaSYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ enum KernelInvocationKind {
const static std::string InitMethodName = "__init";
const static std::string FinalizeMethodName = "__finalize";

namespace {

/// Various utilities.
class Util {
public:
Expand Down Expand Up @@ -91,6 +93,8 @@ class Util {
ArrayRef<Util::DeclContextDesc> Scopes);
};

} // anonymous namespace

// This information is from Section 4.13 of the SYCL spec
// https://www.khronos.org/registry/SYCL/specs/sycl-1.2.1.pdf
// This function returns false if the math lib function
Expand Down