This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGd1c8a151df83: [OpenCL] Added distinct file extension for C++ for OpenCL. (authored by Anastasia). Herald added a subscriber: ldrumm. Herald added a project: clang.
Changed prior to commit: https://reviews.llvm.org/D96771?vs=331317&id=332952#toc Repository: rG LLVM Github Monorepo 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.clcpp clang/test/CodeGenOpenCLCXX/address-space-deduction2.cl clang/test/CodeGenOpenCLCXX/address-space-deduction2.clcpp clang/test/CodeGenOpenCLCXX/addrspace-conversion.cl clang/test/CodeGenOpenCLCXX/addrspace-conversion.clcpp clang/test/CodeGenOpenCLCXX/addrspace-derived-base.cl clang/test/CodeGenOpenCLCXX/addrspace-derived-base.clcpp clang/test/CodeGenOpenCLCXX/addrspace-new-delete.cl clang/test/CodeGenOpenCLCXX/addrspace-new-delete.clcpp clang/test/CodeGenOpenCLCXX/addrspace-of-this.cl clang/test/CodeGenOpenCLCXX/addrspace-of-this.clcpp clang/test/CodeGenOpenCLCXX/addrspace-operators.cl clang/test/CodeGenOpenCLCXX/addrspace-operators.clcpp clang/test/CodeGenOpenCLCXX/addrspace-references.cl clang/test/CodeGenOpenCLCXX/addrspace-references.clcpp clang/test/CodeGenOpenCLCXX/addrspace-with-class.cl clang/test/CodeGenOpenCLCXX/addrspace-with-class.clcpp clang/test/CodeGenOpenCLCXX/addrspace_cast.cl clang/test/CodeGenOpenCLCXX/addrspace_cast.clcpp clang/test/CodeGenOpenCLCXX/atexit.cl clang/test/CodeGenOpenCLCXX/atexit.clcpp clang/test/CodeGenOpenCLCXX/constexpr.cl clang/test/CodeGenOpenCLCXX/constexpr.clcpp clang/test/CodeGenOpenCLCXX/global_init.cl clang/test/CodeGenOpenCLCXX/global_init.clcpp clang/test/CodeGenOpenCLCXX/local_addrspace_init.cl clang/test/CodeGenOpenCLCXX/local_addrspace_init.clcpp clang/test/CodeGenOpenCLCXX/method-overload-address-space.cl clang/test/CodeGenOpenCLCXX/method-overload-address-space.clcpp clang/test/CodeGenOpenCLCXX/template-address-spaces.cl clang/test/CodeGenOpenCLCXX/template-address-spaces.clcpp clang/test/Driver/cxx_for_opencl.clcpp clang/test/Driver/lit.local.cfg clang/test/SemaOpenCLCXX/address-space-castoperators.cl clang/test/SemaOpenCLCXX/address-space-castoperators.clcpp clang/test/SemaOpenCLCXX/address-space-cond.cl clang/test/SemaOpenCLCXX/address-space-cond.clcpp clang/test/SemaOpenCLCXX/address-space-deduction.cl clang/test/SemaOpenCLCXX/address-space-deduction.clcpp clang/test/SemaOpenCLCXX/address-space-lambda.cl clang/test/SemaOpenCLCXX/address-space-lambda.clcpp clang/test/SemaOpenCLCXX/address-space-of-this-class-scope.cl clang/test/SemaOpenCLCXX/address-space-of-this-class-scope.clcpp clang/test/SemaOpenCLCXX/address-space-of-this.cl clang/test/SemaOpenCLCXX/address-space-of-this.clcpp clang/test/SemaOpenCLCXX/address-space-references.cl clang/test/SemaOpenCLCXX/address-space-references.clcpp clang/test/SemaOpenCLCXX/address-space-templates.cl clang/test/SemaOpenCLCXX/address-space-templates.clcpp clang/test/SemaOpenCLCXX/address_space_overloading.cl clang/test/SemaOpenCLCXX/address_space_overloading.clcpp clang/test/SemaOpenCLCXX/addrspace-auto.cl clang/test/SemaOpenCLCXX/addrspace-auto.clcpp clang/test/SemaOpenCLCXX/addrspace_cast.cl clang/test/SemaOpenCLCXX/addrspace_cast.clcpp clang/test/SemaOpenCLCXX/addrspace_cast_ast_dump.cl clang/test/SemaOpenCLCXX/addrspace_cast_ast_dump.clcpp clang/test/SemaOpenCLCXX/invalid-kernel.cl clang/test/SemaOpenCLCXX/invalid-kernel.clcpp clang/test/SemaOpenCLCXX/members.cl clang/test/SemaOpenCLCXX/members.clcpp clang/test/SemaOpenCLCXX/method-overload-address-space.cl clang/test/SemaOpenCLCXX/method-overload-address-space.clcpp clang/test/SemaOpenCLCXX/newdelete.cl clang/test/SemaOpenCLCXX/newdelete.clcpp clang/test/SemaOpenCLCXX/references.cl clang/test/SemaOpenCLCXX/references.clcpp clang/test/SemaOpenCLCXX/restricted.cl clang/test/SemaOpenCLCXX/restricted.clcpp 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', '.clcpp', '.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.clcpp =================================================================== --- clang/test/SemaOpenCLCXX/restricted.clcpp +++ clang/test/SemaOpenCLCXX/restricted.clcpp @@ -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.clcpp =================================================================== --- clang/test/SemaOpenCLCXX/references.clcpp +++ clang/test/SemaOpenCLCXX/references.clcpp @@ -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.clcpp =================================================================== --- clang/test/SemaOpenCLCXX/newdelete.clcpp +++ clang/test/SemaOpenCLCXX/newdelete.clcpp @@ -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.clcpp =================================================================== --- clang/test/SemaOpenCLCXX/method-overload-address-space.clcpp +++ clang/test/SemaOpenCLCXX/method-overload-address-space.clcpp @@ -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.clcpp =================================================================== --- clang/test/SemaOpenCLCXX/members.clcpp +++ clang/test/SemaOpenCLCXX/members.clcpp @@ -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.clcpp =================================================================== --- clang/test/SemaOpenCLCXX/invalid-kernel.clcpp +++ clang/test/SemaOpenCLCXX/invalid-kernel.clcpp @@ -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.clcpp =================================================================== --- clang/test/SemaOpenCLCXX/addrspace_cast_ast_dump.clcpp +++ clang/test/SemaOpenCLCXX/addrspace_cast_ast_dump.clcpp @@ -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.clcpp =================================================================== --- clang/test/SemaOpenCLCXX/addrspace_cast.clcpp +++ clang/test/SemaOpenCLCXX/addrspace_cast.clcpp @@ -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.clcpp =================================================================== --- clang/test/SemaOpenCLCXX/addrspace-auto.clcpp +++ clang/test/SemaOpenCLCXX/addrspace-auto.clcpp @@ -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.clcpp =================================================================== --- clang/test/SemaOpenCLCXX/address_space_overloading.clcpp +++ clang/test/SemaOpenCLCXX/address_space_overloading.clcpp @@ -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.clcpp =================================================================== --- clang/test/SemaOpenCLCXX/address-space-templates.clcpp +++ clang/test/SemaOpenCLCXX/address-space-templates.clcpp @@ -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.clcpp =================================================================== --- clang/test/SemaOpenCLCXX/address-space-references.clcpp +++ clang/test/SemaOpenCLCXX/address-space-references.clcpp @@ -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.clcpp =================================================================== --- clang/test/SemaOpenCLCXX/address-space-of-this.clcpp +++ clang/test/SemaOpenCLCXX/address-space-of-this.clcpp @@ -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.clcpp =================================================================== --- clang/test/SemaOpenCLCXX/address-space-of-this-class-scope.clcpp +++ clang/test/SemaOpenCLCXX/address-space-of-this-class-scope.clcpp @@ -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.clcpp =================================================================== --- clang/test/SemaOpenCLCXX/address-space-lambda.clcpp +++ clang/test/SemaOpenCLCXX/address-space-lambda.clcpp @@ -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.clcpp =================================================================== --- clang/test/SemaOpenCLCXX/address-space-deduction.clcpp +++ clang/test/SemaOpenCLCXX/address-space-deduction.clcpp @@ -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.clcpp =================================================================== --- clang/test/SemaOpenCLCXX/address-space-cond.clcpp +++ clang/test/SemaOpenCLCXX/address-space-cond.clcpp @@ -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.clcpp =================================================================== --- clang/test/SemaOpenCLCXX/address-space-castoperators.clcpp +++ clang/test/SemaOpenCLCXX/address-space-castoperators.clcpp @@ -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', '.clcpp', '.hip'] config.substitutions = list(config.substitutions) config.substitutions.insert(0, ('%clang_cc1', Index: clang/test/Driver/cxx_for_opencl.clcpp =================================================================== --- /dev/null +++ clang/test/Driver/cxx_for_opencl.clcpp @@ -0,0 +1,18 @@ +// 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 +// RUN: %clang %s -### 2>&1 | FileCheck %s + +// CHECK: "-x" "clcpp" + +#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.clcpp =================================================================== --- clang/test/CodeGenOpenCLCXX/template-address-spaces.clcpp +++ clang/test/CodeGenOpenCLCXX/template-address-spaces.clcpp @@ -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.clcpp =================================================================== --- clang/test/CodeGenOpenCLCXX/method-overload-address-space.clcpp +++ clang/test/CodeGenOpenCLCXX/method-overload-address-space.clcpp @@ -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.clcpp =================================================================== --- clang/test/CodeGenOpenCLCXX/local_addrspace_init.clcpp +++ clang/test/CodeGenOpenCLCXX/local_addrspace_init.clcpp @@ -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.clcpp =================================================================== --- clang/test/CodeGenOpenCLCXX/global_init.clcpp +++ clang/test/CodeGenOpenCLCXX/global_init.clcpp @@ -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.clcpp =================================================================== --- clang/test/CodeGenOpenCLCXX/constexpr.clcpp +++ clang/test/CodeGenOpenCLCXX/constexpr.clcpp @@ -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.clcpp =================================================================== --- clang/test/CodeGenOpenCLCXX/atexit.clcpp +++ clang/test/CodeGenOpenCLCXX/atexit.clcpp @@ -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.clcpp =================================================================== --- clang/test/CodeGenOpenCLCXX/addrspace_cast.clcpp +++ clang/test/CodeGenOpenCLCXX/addrspace_cast.clcpp @@ -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.clcpp =================================================================== --- clang/test/CodeGenOpenCLCXX/addrspace-with-class.clcpp +++ clang/test/CodeGenOpenCLCXX/addrspace-with-class.clcpp @@ -1,5 +1,5 @@ -// 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 -cl-std=CLC++ -emit-llvm -O0 -o - | FileCheck %s --check-prefix=CHECK-DEFINITIONS +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -emit-llvm -O0 -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -emit-llvm -O0 -o - | FileCheck %s --check-prefix=CHECK-DEFINITIONS // This test ensures the proper address spaces and address space cast are used // for constructors, member functions and destructors. Index: clang/test/CodeGenOpenCLCXX/addrspace-references.clcpp =================================================================== --- clang/test/CodeGenOpenCLCXX/addrspace-references.clcpp +++ clang/test/CodeGenOpenCLCXX/addrspace-references.clcpp @@ -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.clcpp =================================================================== --- clang/test/CodeGenOpenCLCXX/addrspace-operators.clcpp +++ clang/test/CodeGenOpenCLCXX/addrspace-operators.clcpp @@ -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.clcpp =================================================================== --- clang/test/CodeGenOpenCLCXX/addrspace-of-this.clcpp +++ clang/test/CodeGenOpenCLCXX/addrspace-of-this.clcpp @@ -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.clcpp =================================================================== --- clang/test/CodeGenOpenCLCXX/addrspace-new-delete.clcpp +++ clang/test/CodeGenOpenCLCXX/addrspace-new-delete.clcpp @@ -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.clcpp =================================================================== --- clang/test/CodeGenOpenCLCXX/addrspace-derived-base.clcpp +++ clang/test/CodeGenOpenCLCXX/addrspace-derived-base.clcpp @@ -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.clcpp =================================================================== --- clang/test/CodeGenOpenCLCXX/addrspace-conversion.clcpp +++ clang/test/CodeGenOpenCLCXX/addrspace-conversion.clcpp @@ -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.clcpp =================================================================== --- clang/test/CodeGenOpenCLCXX/address-space-deduction2.clcpp +++ clang/test/CodeGenOpenCLCXX/address-space-deduction2.clcpp @@ -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.clcpp =================================================================== --- clang/test/CodeGenOpenCLCXX/address-space-deduction.clcpp +++ clang/test/CodeGenOpenCLCXX/address-space-deduction.clcpp @@ -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("clcpp", 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 @@ -867,6 +867,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 @@ -520,7 +520,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)) { @@ -2510,6 +2512,9 @@ case Language::OpenCL: Lang = "cl"; break; + case Language::OpenCLCXX: + Lang = "clcpp"; + break; case Language::CUDA: Lang = "cuda"; break; @@ -2698,6 +2703,7 @@ DashX = llvm::StringSwitch<InputKind>(XValue) .Case("c", Language::C) .Case("cl", Language::OpenCL) + .Case("clcpp", Language::OpenCLCXX) .Case("cuda", Language::CUDA) .Case("hip", Language::HIP) .Case("c++", Language::CXX) @@ -3063,6 +3069,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; @@ -3198,7 +3207,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: @@ -3235,6 +3248,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("clcpp", 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("clcpp", CLCXX, PP_CXX, "clcpp", 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