[PATCH] D59219: [PR41007][OpenCL] Allow printf and toolchain reserved variadic functions in C++
bader added a comment. > May be test/Driver/include-default-header.cl would make more sense to show > the intent? test/Headers/opencl-c-header.cl sounds like good candidate. Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D59219/new/ https://reviews.llvm.org/D59219 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D59219: [PR41007][OpenCL] Allow printf and toolchain reserved variadic functions in C++
Anastasia marked an inline comment as done. Anastasia added inline comments. Comment at: cfe/trunk/test/SemaOpenCL/extensions.cl:31 // 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 bader wrote: > Shoudn't we move this test to test/SemaOpenCLCXX? > Does `-finclude-default-header` include opencl-c.h? I think it's an overkill > to test that OpenCL C++ allows printf. Ideally we should minimize number of > times we parsing 11500+ lines header in LIT tests. > Shoudn't we move this test to test/SemaOpenCLCXX? Right now test/SemaOpenCLCXX and other corresponding folders contain only functionality specific to C++. In test/SemaOpenCL we will keep tests that are OpenCL C compatible even though we are parsing some of them in C++ mode too. We could create a common folder but I don't see much value in this. Let me know if you have other thoughts. > Does -finclude-default-header include opencl-c.h? I think it's an overkill to > test that OpenCL C++ allows printf. Ideally we should minimize number of > times we parsing 11500+ lines header in LIT tests. Yes, I perfectly agree. I would like to make sure that the header is parsed successfully in C++ mode. So it is not just for `printf`. There are a few other places where we parse the header, I can move this into them if you prefer. May be test/Driver/include-default-header.cl would make more sense to show the intent? Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D59219/new/ https://reviews.llvm.org/D59219 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D59219: [PR41007][OpenCL] Allow printf and toolchain reserved variadic functions in C++
bader added inline comments. Comment at: cfe/trunk/test/SemaOpenCL/extensions.cl:31 // 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 Shoudn't we move this test to test/SemaOpenCLCXX? Does `-finclude-default-header` include opencl-c.h? I think it's an overkill to test that OpenCL C++ allows printf. Ideally we should minimize number of times we parsing 11500+ lines header in LIT tests. Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D59219/new/ https://reviews.llvm.org/D59219 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D59219: [PR41007][OpenCL] Allow printf and toolchain reserved variadic functions in C++
This revision was automatically updated to reflect the committed changes. Closed by commit rL355915: [PR41007][OpenCL] Allow printf in C++ mode. (authored by stulova, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D59219?vs=190108&id=190239#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D59219/new/ https://reviews.llvm.org/D59219 Files: cfe/trunk/lib/Sema/SemaType.cpp cfe/trunk/test/SemaOpenCL/extensions.cl Index: cfe/trunk/test/SemaOpenCL/extensions.cl === --- cfe/trunk/test/SemaOpenCL/extensions.cl +++ cfe/trunk/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: cfe/trunk/lib/Sema/SemaType.cpp === --- cfe/trunk/lib/Sema/SemaType.cpp +++ cfe/trunk/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); Index: cfe/trunk/test/SemaOpenCL/extensions.cl === --- cfe/trunk/test/SemaOpenCL/extensions.cl +++ cfe/trunk/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: cfe/trunk/lib/Sema/SemaType.cpp === --- cfe/trunk/lib/Sema/SemaType.cpp +++ cfe/trunk/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); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D59219: [PR41007][OpenCL] Allow printf and toolchain reserved variadic functions in C++
neil.hickey accepted this revision. neil.hickey added a comment. This revision is now accepted and ready to land. LGTM! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D59219/new/ https://reviews.llvm.org/D59219 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D59219: [PR41007][OpenCL] Allow printf and toolchain reserved variadic functions in C++
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); 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); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits