Skip to content
Closed
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
2 changes: 2 additions & 0 deletions clang/lib/Frontend/InitPreprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,8 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
}

if (LangOpts.SYCL) {
// DPCPP compiler identification macro
Builder.defineMacro("__DPCPP_COMPILER__", "1");
// SYCL Version is set to a value when building SYCL applications
if (LangOpts.getSYCLVersion() == LangOptions::SYCL_2017) {
Builder.defineMacro("CL_SYCL_LANGUAGE_VERSION", "121");
Expand Down
8 changes: 8 additions & 0 deletions clang/test/Preprocessor/predefined-macros.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,11 @@
// CHECK-HIP-DEV: #define __HIPCC__ 1
// CHECK-HIP-DEV: #define __HIP_DEVICE_COMPILE__ 1
// CHECK-HIP-DEV: #define __HIP__ 1

// RUN: %clang_cc1 %s -E -dM -fsycl -o - \
// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-FSYCL
// CHECK-FSYCL: #define __DPCPP_COMPILER__ 1

// RUN: %clang_cc1 %s -E -dM -o - \
// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-NO-FSYCL
// CHECK-NO-FSYCL-NOT: #define __DPCPP_COMPILER__ 1