[PATCH] D57824: [OpenCL][PR40603] Align the use of extensions in C++ to be backwards compatible with OpenCL C v2.0

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 7 03:39:22 PST 2019

Anastasia marked an inline comment as done.
Anastasia added inline comments.

Comment at: lib/Frontend/InitPreprocessor.cpp:1063
+    auto OpenCLVersion =
+        LangOpts.OpenCLCPlusPlus ? 200 : LangOpts.OpenCLVersion;
+#define OPENCLEXT(Ext)                                                         \
svenvh wrote:
> Why not set `OpenCLVersion` in `lib/Frontend/CompilerInvocation.cpp` instead?  Then you wouldn't have to "override" the version in multiple places (which increases the risk of missing one or more places).
I think we deliberately wanted to separate OpenCL C versions from OpenCL C++. One big reason is that we don't automatically inherit the same behavior but rather do it explicitly. I could look at moving this logic into extensions implementation directly however this will mean it will need to know more internals of LangOpts. I will give it a try!



More information about the cfe-commits mailing list