From 64936ce91dba4fe91655629ce1a25895f2af6f51 Mon Sep 17 00:00:00 2001 From: Yaxun Liu Date: Fri, 13 May 2016 15:44:37 +0000 Subject: [OpenCL] Add supported OpenCL extensions to target info. Add supported OpenCL extensions to target info. It serves as default values to save the users of the burden setting each supported extensions and optional core features in command line. Differential Revision: http://reviews.llvm.org/D19484 llvm-svn: 269431 --- clang/lib/Frontend/InitPreprocessor.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/lib/Frontend/InitPreprocessor.cpp') diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 1c7793e285a..5d38d5f9503 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -938,6 +938,15 @@ static void InitializePredefinedMacros(const TargetInfo &TI, Builder.defineMacro("__CUDA_ARCH__"); } + // OpenCL definitions. + if (LangOpts.OpenCL) { +#define OPENCLEXT(Ext) \ + if (TI.getSupportedOpenCLOpts().is_##Ext##_supported( \ + LangOpts.OpenCLVersion)) \ + Builder.defineMacro(#Ext); +#include "clang/Basic/OpenCLExtensions.def" + } + // Get other target #defines. TI.getTargetDefines(LangOpts, Builder); } -- cgit v1.2.3