[PATCH] D59219: [PR41007][OpenCL] Allow printf and toolchain reserved variadic functions in C++
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 11 09:42:12 PDT 2019
Anastasia created this revision.
Anastasia added a reviewer: neil.hickey.
Herald added subscribers: ebevhan, yaxunl.
As for OpenCL C, we will allow `printf` and other variadic functions (prefixed by "__") in C++ mode.
https://reviews.llvm.org/D59219
Files:
lib/Sema/SemaType.cpp
test/SemaOpenCL/extensions.cl
Index: test/SemaOpenCL/extensions.cl
===================================================================
--- test/SemaOpenCL/extensions.cl
+++ test/SemaOpenCL/extensions.cl
@@ -28,7 +28,7 @@
// enabled by default with -cl-std=CL2.0).
//
// RUN: %clang_cc1 %s -triple amdgcn-unknown-unknown -verify -pedantic -fsyntax-only -cl-std=CL2.0 -finclude-default-header
-// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-std=c++
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-std=c++ -finclude-default-header
#ifdef _OPENCL_H_
// expected-no-diagnostics
Index: lib/Sema/SemaType.cpp
===================================================================
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -4585,7 +4585,7 @@
if (FTI.isVariadic &&
!(D.getIdentifier() &&
((D.getIdentifier()->getName() == "printf" &&
- LangOpts.OpenCLVersion >= 120) ||
+ (LangOpts.OpenCLCPlusPlus || LangOpts.OpenCLVersion >= 120)) ||
D.getIdentifier()->getName().startswith("__")))) {
S.Diag(D.getIdentifierLoc(), diag::err_opencl_variadic_function);
D.setInvalidType(true);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59219.190108.patch
Type: text/x-patch
Size: 1240 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190311/0d8167ff/attachment-0001.bin>
More information about the cfe-commits
mailing list