Skip to content

Commit

Permalink
[SYCL] Add aliases to OpenCL event and sampler types for SYCL
Browse files Browse the repository at this point in the history
event_t and sampler_t type names are replaced with __ocl_event_t and
__ocl_sampler_t to avoid potential collisions with user types.

This change allows to re-use OpenCL event and sampler types for SYCL and replace
OpTypeEvent and OpTypeSampler with __ocl_event_t and __ocl_sampler_t in SYCL
headers.

OpenCL diagnostics is not enabled.

Signed-off-by: Mariya Podchishchaeva <mariya.podchishchaeva@intel.com>
  • Loading branch information
Fznamznon authored and bader committed May 29, 2019
1 parent cd9de48 commit 7db9ce8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clang/lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target,
InitBuiltinType(ObjCBuiltinClassTy, BuiltinType::ObjCClass);
InitBuiltinType(ObjCBuiltinSelTy, BuiltinType::ObjCSel);

if (LangOpts.OpenCL) {
if (LangOpts.OpenCL || LangOpts.SYCLIsDevice) {
#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
InitBuiltinType(SingletonId, BuiltinType::Id);
#include "clang/Basic/OpenCLImageTypes.def"
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CodeGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const HeaderSearchOptions &HSO,

if (LangOpts.ObjC)
createObjCRuntime();
if (LangOpts.OpenCL)
if (LangOpts.OpenCL || LangOpts.SYCLIsDevice)
createOpenCLRuntime();
if (LangOpts.OpenMP)
createOpenMPRuntime();
Expand Down
4 changes: 4 additions & 0 deletions clang/lib/Sema/Sema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ void Sema::Initialize() {

addImplicitTypedef("size_t", Context.getSizeType());
}
if (getLangOpts().SYCLIsDevice) {
addImplicitTypedef("__ocl_event_t", Context.OCLEventTy);
addImplicitTypedef("__ocl_sampler_t", Context.OCLSamplerTy);
}

// Initialize predefined OpenCL types and supported extensions and (optional)
// core features.
Expand Down

0 comments on commit 7db9ce8

Please sign in to comment.