Author: stulova Date: Tue Mar 12 05:46:56 2019 New Revision: 355915 URL: http://llvm.org/viewvc/llvm-project?rev=355915&view=rev Log: [PR41007][OpenCL] Allow printf in C++ mode.
As for OpenCL C, we need to allow using printf and toolchain variadic functions (prefixed by "__") in C++ mode. Differential Revision: https://reviews.llvm.org/D59219 Modified: cfe/trunk/lib/Sema/SemaType.cpp cfe/trunk/test/SemaOpenCL/extensions.cl Modified: cfe/trunk/lib/Sema/SemaType.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=355915&r1=355914&r2=355915&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaType.cpp (original) +++ cfe/trunk/lib/Sema/SemaType.cpp Tue Mar 12 05:46:56 2019 @@ -4585,7 +4585,7 @@ static TypeSourceInfo *GetFullTypeForDec 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); Modified: cfe/trunk/test/SemaOpenCL/extensions.cl URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/extensions.cl?rev=355915&r1=355914&r2=355915&view=diff ============================================================================== --- cfe/trunk/test/SemaOpenCL/extensions.cl (original) +++ cfe/trunk/test/SemaOpenCL/extensions.cl Tue Mar 12 05:46:56 2019 @@ -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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits