summaryrefslogtreecommitdiffstats
path: root/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Frontend/InitPreprocessor.cpp')
-rw-r--r--lib/Frontend/InitPreprocessor.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp
index 66807b097d..b0fb124251 100644
--- a/lib/Frontend/InitPreprocessor.cpp
+++ b/lib/Frontend/InitPreprocessor.cpp
@@ -1,9 +1,8 @@
//===--- InitPreprocessor.cpp - PP initialization code. ---------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -548,7 +547,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
// TS features.
if (LangOpts.ConceptsTS)
Builder.defineMacro("__cpp_experimental_concepts", "1L");
- if (LangOpts.CoroutinesTS)
+ if (LangOpts.Coroutines)
Builder.defineMacro("__cpp_coroutines", "201703L");
}
@@ -831,7 +830,8 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
DefineFmt("__UINTPTR", TI.getUIntPtrType(), TI, Builder);
DefineTypeWidth("__UINTPTR_WIDTH__", TI.getUIntPtrType(), TI, Builder);
- DefineFloatMacros(Builder, "FLT16", &TI.getHalfFormat(), "F16");
+ if (TI.hasFloat16Type())
+ DefineFloatMacros(Builder, "FLT16", &TI.getHalfFormat(), "F16");
DefineFloatMacros(Builder, "FLT", &TI.getFloatFormat(), "F");
DefineFloatMacros(Builder, "DBL", &TI.getDoubleFormat(), "");
DefineFloatMacros(Builder, "LDBL", &TI.getLongDoubleFormat(), "L");
@@ -1057,12 +1057,17 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
Builder.defineMacro("__CLANG_CUDA_APPROX_TRANSCENDENTALS__");
}
+ // Define a macro indicating that the source file is being compiled with a
+ // SYCL device compiler which doesn't produce host binary.
+ if (LangOpts.SYCLIsDevice) {
+ Builder.defineMacro("__SYCL_DEVICE_ONLY__", "1");
+ }
+
// OpenCL definitions.
if (LangOpts.OpenCL) {
-#define OPENCLEXT(Ext) \
- if (TI.getSupportedOpenCLOpts().isSupported(#Ext, \
- LangOpts.OpenCLVersion)) \
- Builder.defineMacro(#Ext);
+#define OPENCLEXT(Ext) \
+ if (TI.getSupportedOpenCLOpts().isSupported(#Ext, LangOpts)) \
+ Builder.defineMacro(#Ext);
#include "clang/Basic/OpenCLExtensions.def"
auto Arch = TI.getTriple().getArch();