Anastasia updated this revision to Diff 327915. Anastasia added a comment. Herald added subscribers: kbarton, nemanjai.
- Renamed extensions to `cppcl` as it was more popular in RFC - Minimized number of changes in driver setup - Changed file extension in all C++ for OpenCL tests CHANGES SINCE LAST ACTION https://reviews.llvm.org/D96771/new/ https://reviews.llvm.org/D96771 Files: clang/include/clang/Basic/LangStandard.h clang/include/clang/Driver/Types.def clang/lib/Driver/Types.cpp clang/lib/Frontend/CompilerInvocation.cpp clang/lib/Frontend/FrontendActions.cpp clang/lib/Frontend/FrontendOptions.cpp clang/test/CodeGenOpenCLCXX/address-space-deduction.cl clang/test/CodeGenOpenCLCXX/address-space-deduction.cppcl clang/test/CodeGenOpenCLCXX/address-space-deduction2.cl clang/test/CodeGenOpenCLCXX/address-space-deduction2.cppcl clang/test/CodeGenOpenCLCXX/addrspace-conversion.cl clang/test/CodeGenOpenCLCXX/addrspace-conversion.cppcl clang/test/CodeGenOpenCLCXX/addrspace-derived-base.cl clang/test/CodeGenOpenCLCXX/addrspace-derived-base.cppcl clang/test/CodeGenOpenCLCXX/addrspace-new-delete.cl clang/test/CodeGenOpenCLCXX/addrspace-new-delete.cppcl clang/test/CodeGenOpenCLCXX/addrspace-of-this.cl clang/test/CodeGenOpenCLCXX/addrspace-of-this.cppcl clang/test/CodeGenOpenCLCXX/addrspace-operators.cl clang/test/CodeGenOpenCLCXX/addrspace-operators.cppcl clang/test/CodeGenOpenCLCXX/addrspace-references.cl clang/test/CodeGenOpenCLCXX/addrspace-references.cppcl clang/test/CodeGenOpenCLCXX/addrspace-with-class.cl clang/test/CodeGenOpenCLCXX/addrspace-with-class.cppcl clang/test/CodeGenOpenCLCXX/addrspace_cast.cl clang/test/CodeGenOpenCLCXX/addrspace_cast.cppcl clang/test/CodeGenOpenCLCXX/atexit.cl clang/test/CodeGenOpenCLCXX/atexit.cppcl clang/test/CodeGenOpenCLCXX/constexpr.cl clang/test/CodeGenOpenCLCXX/constexpr.cppcl clang/test/CodeGenOpenCLCXX/global_init.cl clang/test/CodeGenOpenCLCXX/global_init.cppcl clang/test/CodeGenOpenCLCXX/local_addrspace_init.cl clang/test/CodeGenOpenCLCXX/local_addrspace_init.cppcl clang/test/CodeGenOpenCLCXX/method-overload-address-space.cl clang/test/CodeGenOpenCLCXX/method-overload-address-space.cppcl clang/test/CodeGenOpenCLCXX/template-address-spaces.cl clang/test/CodeGenOpenCLCXX/template-address-spaces.cppcl clang/test/Driver/cxx_for_opencl.cppcl clang/test/Driver/lit.local.cfg clang/test/SemaOpenCLCXX/address-space-castoperators.cl clang/test/SemaOpenCLCXX/address-space-castoperators.cppcl clang/test/SemaOpenCLCXX/address-space-cond.cl clang/test/SemaOpenCLCXX/address-space-cond.cppcl clang/test/SemaOpenCLCXX/address-space-deduction.cl clang/test/SemaOpenCLCXX/address-space-deduction.cppcl clang/test/SemaOpenCLCXX/address-space-lambda.cl clang/test/SemaOpenCLCXX/address-space-lambda.cppcl clang/test/SemaOpenCLCXX/address-space-of-this-class-scope.cl clang/test/SemaOpenCLCXX/address-space-of-this-class-scope.cppcl clang/test/SemaOpenCLCXX/address-space-of-this.cl clang/test/SemaOpenCLCXX/address-space-of-this.cppcl clang/test/SemaOpenCLCXX/address-space-references.cl clang/test/SemaOpenCLCXX/address-space-references.cppcl clang/test/SemaOpenCLCXX/address-space-templates.cl clang/test/SemaOpenCLCXX/address-space-templates.cppcl clang/test/SemaOpenCLCXX/address_space_overloading.cl clang/test/SemaOpenCLCXX/address_space_overloading.cppcl clang/test/SemaOpenCLCXX/addrspace-auto.cl clang/test/SemaOpenCLCXX/addrspace-auto.cppcl clang/test/SemaOpenCLCXX/addrspace_cast.cl clang/test/SemaOpenCLCXX/addrspace_cast.cppcl clang/test/SemaOpenCLCXX/addrspace_cast_ast_dump.cl clang/test/SemaOpenCLCXX/addrspace_cast_ast_dump.cppcl clang/test/SemaOpenCLCXX/invalid-kernel.cl clang/test/SemaOpenCLCXX/invalid-kernel.cppcl clang/test/SemaOpenCLCXX/members.cl clang/test/SemaOpenCLCXX/members.cppcl clang/test/SemaOpenCLCXX/method-overload-address-space.cl clang/test/SemaOpenCLCXX/method-overload-address-space.cppcl clang/test/SemaOpenCLCXX/newdelete.cl clang/test/SemaOpenCLCXX/newdelete.cppcl clang/test/SemaOpenCLCXX/references.cl clang/test/SemaOpenCLCXX/references.cppcl clang/test/SemaOpenCLCXX/restricted.cl clang/test/SemaOpenCLCXX/restricted.cppcl clang/test/lit.cfg.py
Index: clang/test/lit.cfg.py =================================================================== --- clang/test/lit.cfg.py +++ clang/test/lit.cfg.py @@ -26,7 +26,7 @@ # suffixes: A list of file extensions to treat as test files. config.suffixes = ['.c', '.cpp', '.i', '.cppm', '.m', '.mm', '.cu', - '.ll', '.cl', '.s', '.S', '.modulemap', '.test', '.rs', '.ifs'] + '.ll', '.cl', '.cppcl', '.s', '.S', '.modulemap', '.test', '.rs', '.ifs'] # excludes: A list of directories to exclude from the testsuite. The 'Inputs' # subdirectories contain auxiliary inputs for various tests in their parent Index: clang/test/SemaOpenCLCXX/restricted.cppcl =================================================================== --- clang/test/SemaOpenCLCXX/restricted.cppcl +++ clang/test/SemaOpenCLCXX/restricted.cppcl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -pedantic -verify -fsyntax-only +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -pedantic -verify -fsyntax-only // This test checks that various C/C++/OpenCL C constructs are not available in // C++ for OpenCL. Index: clang/test/SemaOpenCLCXX/references.cppcl =================================================================== --- clang/test/SemaOpenCLCXX/references.cppcl +++ clang/test/SemaOpenCLCXX/references.cppcl @@ -1,5 +1,5 @@ -//RUN: %clang_cc1 %s -cl-std=clc++ -verify -fsyntax-only -triple spir -//RUN: %clang_cc1 %s -cl-std=clc++ -verify -fsyntax-only -DFPTREXT -triple spir +//RUN: %clang_cc1 %s -verify -fsyntax-only -triple spir +//RUN: %clang_cc1 %s -verify -fsyntax-only -DFPTREXT -triple spir #ifdef FPTREXT #pragma OPENCL EXTENSION __cl_clang_function_pointers : enable Index: clang/test/SemaOpenCLCXX/newdelete.cppcl =================================================================== --- clang/test/SemaOpenCLCXX/newdelete.cppcl +++ clang/test/SemaOpenCLCXX/newdelete.cppcl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -pedantic -verify -fsyntax-only +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -pedantic -verify -fsyntax-only class A { public: Index: clang/test/SemaOpenCLCXX/method-overload-address-space.cppcl =================================================================== --- clang/test/SemaOpenCLCXX/method-overload-address-space.cppcl +++ clang/test/SemaOpenCLCXX/method-overload-address-space.cppcl @@ -1,4 +1,4 @@ -//RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -pedantic -verify +//RUN: %clang_cc1 %s -triple spir-unknown-unknown -pedantic -verify struct C { void m1() __local __local; //expected-warning{{multiple identical address spaces specified for type}} Index: clang/test/SemaOpenCLCXX/members.cppcl =================================================================== --- clang/test/SemaOpenCLCXX/members.cppcl +++ clang/test/SemaOpenCLCXX/members.cppcl @@ -1,5 +1,5 @@ -//RUN: %clang_cc1 %s -triple spir -cl-std=clc++ -verify -fsyntax-only -//RUN: %clang_cc1 %s -triple spir -cl-std=clc++ -verify -fsyntax-only -DFUNCPTREXT +//RUN: %clang_cc1 %s -triple spir -verify -fsyntax-only +//RUN: %clang_cc1 %s -triple spir -verify -fsyntax-only -DFUNCPTREXT #ifdef FUNCPTREXT #pragma OPENCL EXTENSION __cl_clang_function_pointers : enable Index: clang/test/SemaOpenCLCXX/invalid-kernel.cppcl =================================================================== --- clang/test/SemaOpenCLCXX/invalid-kernel.cppcl +++ clang/test/SemaOpenCLCXX/invalid-kernel.cppcl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -cl-std=clc++ -pedantic -verify -fsyntax-only +// RUN: %clang_cc1 %s -pedantic -verify -fsyntax-only struct C { kernel void m(); //expected-error{{kernel functions cannot be class members}} Index: clang/test/SemaOpenCLCXX/addrspace_cast_ast_dump.cppcl =================================================================== --- clang/test/SemaOpenCLCXX/addrspace_cast_ast_dump.cppcl +++ clang/test/SemaOpenCLCXX/addrspace_cast_ast_dump.cppcl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -pedantic -verify -ast-dump | FileCheck %s +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -pedantic -verify -ast-dump | FileCheck %s // expected-no-diagnostics Index: clang/test/SemaOpenCLCXX/addrspace_cast.cppcl =================================================================== --- clang/test/SemaOpenCLCXX/addrspace_cast.cppcl +++ clang/test/SemaOpenCLCXX/addrspace_cast.cppcl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -pedantic -verify -fsyntax-only +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -pedantic -verify -fsyntax-only void foo(global int *gl, const global int *gl_const, global int &gl_ref) { //FIXME: Diagnostics can be improved to be more specific in some cases. Index: clang/test/SemaOpenCLCXX/addrspace-auto.cppcl =================================================================== --- clang/test/SemaOpenCLCXX/addrspace-auto.cppcl +++ clang/test/SemaOpenCLCXX/addrspace-auto.cppcl @@ -1,4 +1,4 @@ -//RUN: %clang_cc1 %s -cl-std=clc++ -pedantic -ast-dump -verify | FileCheck %s +//RUN: %clang_cc1 %s -pedantic -ast-dump -verify | FileCheck %s __constant int i = 1; //CHECK: |-VarDecl {{.*}} ai '__global int':'__global int' Index: clang/test/SemaOpenCLCXX/address_space_overloading.cppcl =================================================================== --- clang/test/SemaOpenCLCXX/address_space_overloading.cppcl +++ clang/test/SemaOpenCLCXX/address_space_overloading.cppcl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only // expected-no-diagnostics struct RetGlob { Index: clang/test/SemaOpenCLCXX/address-space-templates.cppcl =================================================================== --- clang/test/SemaOpenCLCXX/address-space-templates.cppcl +++ clang/test/SemaOpenCLCXX/address-space-templates.cppcl @@ -1,4 +1,4 @@ -//RUN: %clang_cc1 %s -cl-std=clc++ -pedantic -verify -ast-dump | FileCheck %s +//RUN: %clang_cc1 %s -pedantic -verify -ast-dump | FileCheck %s template <typename T> struct S { Index: clang/test/SemaOpenCLCXX/address-space-references.cppcl =================================================================== --- clang/test/SemaOpenCLCXX/address-space-references.cppcl +++ clang/test/SemaOpenCLCXX/address-space-references.cppcl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -pedantic -verify -fsyntax-only +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -pedantic -verify -fsyntax-only __global const int& f(__global float &ref) { return ref; // expected-error{{reference of type 'const __global int &' cannot bind to a temporary object because of address space mismatch}} Index: clang/test/SemaOpenCLCXX/address-space-of-this.cppcl =================================================================== --- clang/test/SemaOpenCLCXX/address-space-of-this.cppcl +++ clang/test/SemaOpenCLCXX/address-space-of-this.cppcl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -pedantic -verify -fsyntax-only +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -pedantic -verify -fsyntax-only // expected-no-diagnostics // Extract from PR38614 Index: clang/test/SemaOpenCLCXX/address-space-of-this-class-scope.cppcl =================================================================== --- clang/test/SemaOpenCLCXX/address-space-of-this-class-scope.cppcl +++ clang/test/SemaOpenCLCXX/address-space-of-this-class-scope.cppcl @@ -1,4 +1,4 @@ -//RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -pedantic -verify +//RUN: %clang_cc1 %s -triple spir-unknown-unknown -pedantic -verify struct C { auto fGlob() __global -> decltype(this); Index: clang/test/SemaOpenCLCXX/address-space-lambda.cppcl =================================================================== --- clang/test/SemaOpenCLCXX/address-space-lambda.cppcl +++ clang/test/SemaOpenCLCXX/address-space-lambda.cppcl @@ -1,5 +1,5 @@ -//RUN: %clang_cc1 %s -cl-std=clc++ -pedantic -ast-dump -verify | FileCheck %s -//RUN: %clang_cc1 %s -cl-std=clc++ -pedantic -ast-dump -verify -triple i386-windows | FileCheck %s +//RUN: %clang_cc1 %s -pedantic -ast-dump -verify | FileCheck %s +//RUN: %clang_cc1 %s -pedantic -ast-dump -verify -triple i386-windows | FileCheck %s //CHECK: CXXMethodDecl {{.*}} constexpr operator() 'int (__private int){{.*}} const __generic' auto glambda = [](auto a) { return a; }; Index: clang/test/SemaOpenCLCXX/address-space-deduction.cppcl =================================================================== --- clang/test/SemaOpenCLCXX/address-space-deduction.cppcl +++ clang/test/SemaOpenCLCXX/address-space-deduction.cppcl @@ -1,4 +1,4 @@ -//RUN: %clang_cc1 %s -cl-std=clc++ -pedantic -ast-dump -verify | FileCheck %s +//RUN: %clang_cc1 %s -pedantic -ast-dump -verify | FileCheck %s //expected-no-diagnostics Index: clang/test/SemaOpenCLCXX/address-space-cond.cppcl =================================================================== --- clang/test/SemaOpenCLCXX/address-space-cond.cppcl +++ clang/test/SemaOpenCLCXX/address-space-cond.cppcl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -cl-std=clc++ -pedantic -verify +// RUN: %clang_cc1 %s -pedantic -verify namespace PointerRvalues { Index: clang/test/SemaOpenCLCXX/address-space-castoperators.cppcl =================================================================== --- clang/test/SemaOpenCLCXX/address-space-castoperators.cppcl +++ clang/test/SemaOpenCLCXX/address-space-castoperators.cppcl @@ -1,4 +1,4 @@ -//RUN: %clang_cc1 %s -cl-std=clc++ -pedantic -ast-dump -verify | FileCheck %s +//RUN: %clang_cc1 %s -pedantic -ast-dump -verify | FileCheck %s void nester_ptr() { local int * * locgen; Index: clang/test/Driver/lit.local.cfg =================================================================== --- clang/test/Driver/lit.local.cfg +++ clang/test/Driver/lit.local.cfg @@ -1,5 +1,5 @@ config.suffixes = ['.c', '.cpp', '.h', '.m', '.mm', '.S', '.s', '.f90', '.F90', '.f95', - '.cu', '.rs', '.cl', '.hip'] + '.cu', '.rs', '.cl', '.cppcl', '.hip'] config.substitutions = list(config.substitutions) config.substitutions.insert(0, ('%clang_cc1', Index: clang/test/Driver/cxx_for_opencl.cppcl =================================================================== --- /dev/null +++ clang/test/Driver/cxx_for_opencl.cppcl @@ -0,0 +1,15 @@ +// RUN: %clang %s -Xclang -verify -fsyntax-only +// RUN: %clang %s -cl-std=clc++ -Xclang -verify -fsyntax-only +// RUN: %clang %s -cl-std=cl2.0 -Xclang -verify -fsyntax-only + +#ifdef __OPENCL_CPP_VERSION__ +//expected-no-diagnostics +#endif + +kernel void k(){ + auto a = get_local_id(1); +#ifndef __OPENCL_CPP_VERSION__ +//expected-error@-2{{OpenCL C version 2.0 does not support the 'auto' storage class specifier}} +//expected-warning@-3{{type specifier missing, defaults to 'int'}} +#endif +} Index: clang/test/CodeGenOpenCLCXX/template-address-spaces.cppcl =================================================================== --- clang/test/CodeGenOpenCLCXX/template-address-spaces.cppcl +++ clang/test/CodeGenOpenCLCXX/template-address-spaces.cppcl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -cl-std=clc++ %s -emit-llvm -o - -O0 -triple spir-unknown-unknown | FileCheck %s +// RUN: %clang_cc1 %s -emit-llvm -o - -O0 -triple spir-unknown-unknown | FileCheck %s template <typename T> struct S{ Index: clang/test/CodeGenOpenCLCXX/method-overload-address-space.cppcl =================================================================== --- clang/test/CodeGenOpenCLCXX/method-overload-address-space.cppcl +++ clang/test/CodeGenOpenCLCXX/method-overload-address-space.cppcl @@ -1,4 +1,4 @@ -//RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -emit-llvm -O0 -o - | FileCheck %s +//RUN: %clang_cc1 %s -triple spir-unknown-unknown -emit-llvm -O0 -o - | FileCheck %s struct C { void foo() __local; Index: clang/test/CodeGenOpenCLCXX/local_addrspace_init.cppcl =================================================================== --- clang/test/CodeGenOpenCLCXX/local_addrspace_init.cppcl +++ clang/test/CodeGenOpenCLCXX/local_addrspace_init.cppcl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple spir -cl-std=clc++ -emit-llvm -O0 -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple spir -emit-llvm -O0 -o - | FileCheck %s // Test that we don't initialize local address space objects. //CHECK: @_ZZ4testE1i = internal addrspace(3) global i32 undef Index: clang/test/CodeGenOpenCLCXX/global_init.cppcl =================================================================== --- clang/test/CodeGenOpenCLCXX/global_init.cppcl +++ clang/test/CodeGenOpenCLCXX/global_init.cppcl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple spir -cl-std=clc++ -emit-llvm -O0 -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple spir -emit-llvm -O0 -o - | FileCheck %s struct S { S() {} Index: clang/test/CodeGenOpenCLCXX/constexpr.cppcl =================================================================== --- clang/test/CodeGenOpenCLCXX/constexpr.cppcl +++ clang/test/CodeGenOpenCLCXX/constexpr.cppcl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -O0 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -emit-llvm -o - | FileCheck %s typedef int int2 __attribute__((ext_vector_type(2))); typedef int int4 __attribute__((ext_vector_type(4))); Index: clang/test/CodeGenOpenCLCXX/atexit.cppcl =================================================================== --- clang/test/CodeGenOpenCLCXX/atexit.cppcl +++ clang/test/CodeGenOpenCLCXX/atexit.cppcl @@ -1,4 +1,4 @@ -//RUN: %clang_cc1 %s -triple spir -cl-std=clc++ -emit-llvm -O0 -o - | FileCheck %s +//RUN: %clang_cc1 %s -triple spir -emit-llvm -O0 -o - | FileCheck %s struct S { ~S(){}; Index: clang/test/CodeGenOpenCLCXX/addrspace_cast.cppcl =================================================================== --- clang/test/CodeGenOpenCLCXX/addrspace_cast.cppcl +++ clang/test/CodeGenOpenCLCXX/addrspace_cast.cppcl @@ -1,4 +1,4 @@ -//RUN: %clang_cc1 %s -triple spir -cl-std=clc++ -emit-llvm -O0 -o - | FileCheck %s +//RUN: %clang_cc1 %s -triple spir -emit-llvm -O0 -o - | FileCheck %s //CHECK-LABEL: define{{.*}} spir_func void @_Z3barPU3AS1i void bar(global int *gl) { Index: clang/test/CodeGenOpenCLCXX/addrspace-with-class.cppcl =================================================================== --- clang/test/CodeGenOpenCLCXX/addrspace-with-class.cppcl +++ clang/test/CodeGenOpenCLCXX/addrspace-with-class.cppcl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -emit-llvm -O0 -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -emit-llvm -O0 -o - | FileCheck %s // RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CLC++ -emit-llvm -O0 -o - | FileCheck %s --check-prefix=CHECK-DEFINITIONS // This test ensures the proper address spaces and address space cast are used Index: clang/test/CodeGenOpenCLCXX/addrspace-references.cppcl =================================================================== --- clang/test/CodeGenOpenCLCXX/addrspace-references.cppcl +++ clang/test/CodeGenOpenCLCXX/addrspace-references.cppcl @@ -1,4 +1,4 @@ -//RUN: %clang_cc1 %s -cl-std=clc++ -triple spir -emit-llvm -o - -O0 | FileCheck %s +//RUN: %clang_cc1 %s -triple spir -emit-llvm -o - -O0 | FileCheck %s typedef short short2 __attribute__((ext_vector_type(2))); Index: clang/test/CodeGenOpenCLCXX/addrspace-operators.cppcl =================================================================== --- clang/test/CodeGenOpenCLCXX/addrspace-operators.cppcl +++ clang/test/CodeGenOpenCLCXX/addrspace-operators.cppcl @@ -1,4 +1,4 @@ -//RUN: %clang_cc1 %s -triple spir -cl-std=clc++ -emit-llvm -O0 -o - | FileCheck %s +//RUN: %clang_cc1 %s -triple spir -emit-llvm -O0 -o - | FileCheck %s enum E { a, Index: clang/test/CodeGenOpenCLCXX/addrspace-of-this.cppcl =================================================================== --- clang/test/CodeGenOpenCLCXX/addrspace-of-this.cppcl +++ clang/test/CodeGenOpenCLCXX/addrspace-of-this.cppcl @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -emit-llvm -pedantic -verify -O0 -o - -DDECL | FileCheck %s --check-prefixes="COMMON,EXPL" -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -emit-llvm -pedantic -verify -O0 -o - -DDECL -DUSE_DEFLT | FileCheck %s --check-prefixes="COMMON,IMPL" -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -emit-llvm -pedantic -verify -O0 -o - | FileCheck %s --check-prefixes="COMMON,IMPL" +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -emit-llvm -pedantic -verify -O0 -o - -DDECL | FileCheck %s --check-prefixes="COMMON,EXPL" +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -emit-llvm -pedantic -verify -O0 -o - -DDECL -DUSE_DEFLT | FileCheck %s --check-prefixes="COMMON,IMPL" +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -emit-llvm -pedantic -verify -O0 -o - | FileCheck %s --check-prefixes="COMMON,IMPL" // expected-no-diagnostics // Test that the 'this' pointer is in the __generic address space. Index: clang/test/CodeGenOpenCLCXX/addrspace-new-delete.cppcl =================================================================== --- clang/test/CodeGenOpenCLCXX/addrspace-new-delete.cppcl +++ clang/test/CodeGenOpenCLCXX/addrspace-new-delete.cppcl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple spir -cl-std=clc++ -emit-llvm -O0 -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple spir -emit-llvm -O0 -o - | FileCheck %s typedef __SIZE_TYPE__ size_t; Index: clang/test/CodeGenOpenCLCXX/addrspace-derived-base.cppcl =================================================================== --- clang/test/CodeGenOpenCLCXX/addrspace-derived-base.cppcl +++ clang/test/CodeGenOpenCLCXX/addrspace-derived-base.cppcl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple spir -cl-std=clc++ -emit-llvm -O0 -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple spir -emit-llvm -O0 -o - | FileCheck %s struct B { int mb; Index: clang/test/CodeGenOpenCLCXX/addrspace-conversion.cppcl =================================================================== --- clang/test/CodeGenOpenCLCXX/addrspace-conversion.cppcl +++ clang/test/CodeGenOpenCLCXX/addrspace-conversion.cppcl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -emit-llvm -O0 -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -emit-llvm -O0 -o - | FileCheck %s void bar(__generic volatile unsigned int* ptr) { Index: clang/test/CodeGenOpenCLCXX/address-space-deduction2.cppcl =================================================================== --- clang/test/CodeGenOpenCLCXX/address-space-deduction2.cppcl +++ clang/test/CodeGenOpenCLCXX/address-space-deduction2.cppcl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -O0 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -emit-llvm -o - | FileCheck %s class P { public: Index: clang/test/CodeGenOpenCLCXX/address-space-deduction.cppcl =================================================================== --- clang/test/CodeGenOpenCLCXX/address-space-deduction.cppcl +++ clang/test/CodeGenOpenCLCXX/address-space-deduction.cppcl @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -O0 -emit-llvm -o - | FileCheck %s -check-prefixes=COMMON,PTR -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -O0 -emit-llvm -o - -DREF | FileCheck %s -check-prefixes=COMMON,REF +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -emit-llvm -o - | FileCheck %s -check-prefixes=COMMON,PTR +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -emit-llvm -o - -DREF | FileCheck %s -check-prefixes=COMMON,REF #ifdef REF #define PTR & Index: clang/lib/Frontend/FrontendOptions.cpp =================================================================== --- clang/lib/Frontend/FrontendOptions.cpp +++ clang/lib/Frontend/FrontendOptions.cpp @@ -29,6 +29,7 @@ .Case("cppm", Language::CXX) .Case("iim", InputKind(Language::CXX).getPreprocessed()) .Case("cl", Language::OpenCL) + .Case("cppcl", Language::OpenCLCXX) .Cases("cu", "cuh", Language::CUDA) .Case("hip", Language::HIP) .Cases("ll", "bc", Language::LLVM_IR) Index: clang/lib/Frontend/FrontendActions.cpp =================================================================== --- clang/lib/Frontend/FrontendActions.cpp +++ clang/lib/Frontend/FrontendActions.cpp @@ -862,6 +862,7 @@ case Language::ObjC: case Language::ObjCXX: case Language::OpenCL: + case Language::OpenCLCXX: case Language::CUDA: case Language::HIP: break; Index: clang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -515,7 +515,9 @@ static unsigned getOptimizationLevel(ArgList &Args, InputKind IK, DiagnosticsEngine &Diags) { unsigned DefaultOpt = llvm::CodeGenOpt::None; - if (IK.getLanguage() == Language::OpenCL && !Args.hasArg(OPT_cl_opt_disable)) + if ((IK.getLanguage() == Language::OpenCL || + IK.getLanguage() == Language::OpenCLCXX) && + !Args.hasArg(OPT_cl_opt_disable)) DefaultOpt = llvm::CodeGenOpt::Default; if (Arg *A = Args.getLastArg(options::OPT_O_Group)) { @@ -2512,6 +2514,9 @@ case Language::OpenCL: Lang = "cl"; break; + case Language::OpenCLCXX: + Lang = "cppcl"; + break; case Language::CUDA: Lang = "cuda"; break; @@ -2700,6 +2705,7 @@ DashX = llvm::StringSwitch<InputKind>(XValue) .Case("c", Language::C) .Case("cl", Language::OpenCL) + .Case("cppcl", Language::OpenCLCXX) .Case("cuda", Language::CUDA) .Case("hip", Language::HIP) .Case("c++", Language::CXX) @@ -3065,6 +3071,9 @@ case Language::OpenCL: LangStd = LangStandard::lang_opencl10; break; + case Language::OpenCLCXX: + LangStd = LangStandard::lang_openclcpp; + break; case Language::CUDA: LangStd = LangStandard::lang_cuda; break; @@ -3200,7 +3209,11 @@ return S.getLanguage() == Language::C; case Language::OpenCL: - return S.getLanguage() == Language::OpenCL; + return S.getLanguage() == Language::OpenCL || + S.getLanguage() == Language::OpenCLCXX; + + case Language::OpenCLCXX: + return S.getLanguage() == Language::OpenCLCXX; case Language::CXX: case Language::ObjCXX: @@ -3237,6 +3250,8 @@ return "Objective-C++"; case Language::OpenCL: return "OpenCL"; + case Language::OpenCLCXX: + return "C++ for OpenCL"; case Language::CUDA: return "CUDA"; case Language::RenderScript: Index: clang/lib/Driver/Types.cpp =================================================================== --- clang/lib/Driver/Types.cpp +++ clang/lib/Driver/Types.cpp @@ -126,7 +126,7 @@ case TY_Asm: case TY_C: case TY_PP_C: - case TY_CL: + case TY_CL: case TY_CLCXX: case TY_CUDA: case TY_PP_CUDA: case TY_CUDA_DEVICE: case TY_HIP: @@ -160,7 +160,7 @@ } } -bool types::isOpenCL(ID Id) { return Id == TY_CL; } +bool types::isOpenCL(ID Id) { return Id == TY_CL || Id == TY_CLCXX; } bool types::isCXX(ID Id) { switch (Id) { @@ -249,6 +249,7 @@ .Case("cc", TY_CXX) .Case("CC", TY_CXX) .Case("cl", TY_CL) + .Case("cppcl", TY_CLCXX) .Case("cp", TY_CXX) .Case("cu", TY_CUDA) .Case("hh", TY_CXXHeader) @@ -396,6 +397,7 @@ case types::TY_ObjCXX: return types::TY_ObjCXXHeader; case types::TY_CL: + case types::TY_CLCXX: return types::TY_CLHeader; } } Index: clang/include/clang/Driver/Types.def =================================================================== --- clang/include/clang/Driver/Types.def +++ clang/include/clang/Driver/Types.def @@ -38,6 +38,7 @@ TYPE("cpp-output", PP_C, INVALID, "i", phases::Compile, phases::Backend, phases::Assemble, phases::Link) TYPE("c", C, PP_C, "c", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) TYPE("cl", CL, PP_C, "cl", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("cppcl", CLCXX, PP_CXX, "cppcl", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) TYPE("cuda-cpp-output", PP_CUDA, INVALID, "cui", phases::Compile, phases::Backend, phases::Assemble, phases::Link) TYPE("cuda", CUDA, PP_CUDA, "cu", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) TYPE("cuda", CUDA_DEVICE, PP_CUDA, "cu", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) Index: clang/include/clang/Basic/LangStandard.h =================================================================== --- clang/include/clang/Basic/LangStandard.h +++ clang/include/clang/Basic/LangStandard.h @@ -32,6 +32,7 @@ ObjC, ObjCXX, OpenCL, + OpenCLCXX, CUDA, RenderScript, HIP,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits