[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.
Re-commit after fixing build error due to missing override attribute.
Differential Revision: http://reviews.llvm.org/D19484
llvm-svn: 269670
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 1c7793e..5d38d5f 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -938,6 +938,15 @@
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);
}