[OpenCL] Added distinct file extension for C++ for OpenCL.
authorAnastasia Stulova <anastasia.stulova@arm.com>
Wed, 3 Mar 2021 19:00:55 +0000 (19:00 +0000)
committerAnastasia Stulova <anastasia.stulova@arm.com>
Wed, 24 Mar 2021 13:07:04 +0000 (13:07 +0000)
Files compiled with C++ for OpenCL mode can now have a distinct
file extension - clcpp, then clang driver picks the compilation
mode automatically (-x clcpp) without the use of -cl-std=clc++.

Differential Revision: https://reviews.llvm.org/D96771

43 files changed:
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.clcpp [moved from clang/test/CodeGenOpenCLCXX/address-space-deduction.cl with 86% similarity]
clang/test/CodeGenOpenCLCXX/address-space-deduction2.clcpp [moved from clang/test/CodeGenOpenCLCXX/address-space-deduction2.cl with 77% similarity]
clang/test/CodeGenOpenCLCXX/addrspace-conversion.clcpp [moved from clang/test/CodeGenOpenCLCXX/addrspace-conversion.cl with 63% similarity]
clang/test/CodeGenOpenCLCXX/addrspace-derived-base.clcpp [moved from clang/test/CodeGenOpenCLCXX/addrspace-derived-base.cl with 95% similarity]
clang/test/CodeGenOpenCLCXX/addrspace-new-delete.clcpp [moved from clang/test/CodeGenOpenCLCXX/addrspace-new-delete.cl with 80% similarity]
clang/test/CodeGenOpenCLCXX/addrspace-of-this.clcpp [moved from clang/test/CodeGenOpenCLCXX/addrspace-of-this.cl with 95% similarity]
clang/test/CodeGenOpenCLCXX/addrspace-operators.clcpp [moved from clang/test/CodeGenOpenCLCXX/addrspace-operators.cl with 97% similarity]
clang/test/CodeGenOpenCLCXX/addrspace-references.clcpp [moved from clang/test/CodeGenOpenCLCXX/addrspace-references.cl with 93% similarity]
clang/test/CodeGenOpenCLCXX/addrspace-with-class.clcpp [moved from clang/test/CodeGenOpenCLCXX/addrspace-with-class.cl with 93% similarity]
clang/test/CodeGenOpenCLCXX/addrspace_cast.clcpp [moved from clang/test/CodeGenOpenCLCXX/addrspace_cast.cl with 71% similarity]
clang/test/CodeGenOpenCLCXX/atexit.clcpp [moved from clang/test/CodeGenOpenCLCXX/atexit.cl with 81% similarity]
clang/test/CodeGenOpenCLCXX/constexpr.clcpp [moved from clang/test/CodeGenOpenCLCXX/constexpr.cl with 94% similarity]
clang/test/CodeGenOpenCLCXX/global_init.clcpp [moved from clang/test/CodeGenOpenCLCXX/global_init.cl with 79% similarity]
clang/test/CodeGenOpenCLCXX/local_addrspace_init.clcpp [moved from clang/test/CodeGenOpenCLCXX/local_addrspace_init.cl with 89% similarity]
clang/test/CodeGenOpenCLCXX/method-overload-address-space.clcpp [moved from clang/test/CodeGenOpenCLCXX/method-overload-address-space.cl with 91% similarity]
clang/test/CodeGenOpenCLCXX/template-address-spaces.clcpp [moved from clang/test/CodeGenOpenCLCXX/template-address-spaces.cl with 91% similarity]
clang/test/Driver/cxx_for_opencl.clcpp [new file with mode: 0644]
clang/test/Driver/lit.local.cfg
clang/test/SemaOpenCLCXX/address-space-castoperators.clcpp [moved from clang/test/SemaOpenCLCXX/address-space-castoperators.cl with 93% similarity]
clang/test/SemaOpenCLCXX/address-space-cond.clcpp [moved from clang/test/SemaOpenCLCXX/address-space-cond.cl with 91% similarity]
clang/test/SemaOpenCLCXX/address-space-deduction.clcpp [moved from clang/test/SemaOpenCLCXX/address-space-deduction.cl with 97% similarity]
clang/test/SemaOpenCLCXX/address-space-lambda.clcpp [moved from clang/test/SemaOpenCLCXX/address-space-lambda.cl with 95% similarity]
clang/test/SemaOpenCLCXX/address-space-of-this-class-scope.clcpp [moved from clang/test/SemaOpenCLCXX/address-space-of-this-class-scope.cl with 90% similarity]
clang/test/SemaOpenCLCXX/address-space-of-this.clcpp [moved from clang/test/SemaOpenCLCXX/address-space-of-this.cl with 56% similarity]
clang/test/SemaOpenCLCXX/address-space-references.clcpp [moved from clang/test/SemaOpenCLCXX/address-space-references.cl with 95% similarity]
clang/test/SemaOpenCLCXX/address-space-templates.clcpp [moved from clang/test/SemaOpenCLCXX/address-space-templates.cl with 96% similarity]
clang/test/SemaOpenCLCXX/address_space_overloading.clcpp [moved from clang/test/SemaOpenCLCXX/address_space_overloading.cl with 83% similarity]
clang/test/SemaOpenCLCXX/addrspace-auto.clcpp [moved from clang/test/SemaOpenCLCXX/addrspace-auto.cl with 94% similarity]
clang/test/SemaOpenCLCXX/addrspace_cast.clcpp [moved from clang/test/SemaOpenCLCXX/addrspace_cast.cl with 95% similarity]
clang/test/SemaOpenCLCXX/addrspace_cast_ast_dump.clcpp [moved from clang/test/SemaOpenCLCXX/addrspace_cast_ast_dump.cl with 83% similarity]
clang/test/SemaOpenCLCXX/invalid-kernel.clcpp [moved from clang/test/SemaOpenCLCXX/invalid-kernel.cl with 89% similarity]
clang/test/SemaOpenCLCXX/members.clcpp [moved from clang/test/SemaOpenCLCXX/members.cl with 76% similarity]
clang/test/SemaOpenCLCXX/method-overload-address-space.clcpp [moved from clang/test/SemaOpenCLCXX/method-overload-address-space.cl with 86% similarity]
clang/test/SemaOpenCLCXX/newdelete.clcpp [moved from clang/test/SemaOpenCLCXX/newdelete.cl with 94% similarity]
clang/test/SemaOpenCLCXX/references.clcpp [moved from clang/test/SemaOpenCLCXX/references.cl with 89% similarity]
clang/test/SemaOpenCLCXX/restricted.clcpp [moved from clang/test/SemaOpenCLCXX/restricted.cl with 94% similarity]
clang/test/lit.cfg.py

index f82ce05..b078540 100644 (file)
@@ -32,6 +32,7 @@ enum class Language : uint8_t {
   ObjC,
   ObjCXX,
   OpenCL,
+  OpenCLCXX,
   CUDA,
   RenderScript,
   HIP,
index 79e8d10..997eea4 100644 (file)
@@ -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 9bdebe2..b7ccdf2 100644 (file)
@@ -126,7 +126,7 @@ bool types::isAcceptedByClang(ID Id) {
 
   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::isObjC(ID Id) {
   }
 }
 
-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 @@ types::ID types::lookupTypeForExtension(llvm::StringRef Ext) {
            .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 @@ ID types::lookupHeaderTypeForSourceType(ID Id) {
   case types::TY_ObjCXX:
     return types::TY_ObjCXXHeader;
   case types::TY_CL:
+  case types::TY_CLCXX:
     return types::TY_CLHeader;
   }
 }
index ffaf368..56aa4b4 100644 (file)
@@ -520,7 +520,9 @@ static bool FixupInvocation(CompilerInvocation &Invocation,
 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 @@ static void GenerateFrontendArgs(const FrontendOptions &Opts,
     case Language::OpenCL:
       Lang = "cl";
       break;
+    case Language::OpenCLCXX:
+      Lang = "clcpp";
+      break;
     case Language::CUDA:
       Lang = "cuda";
       break;
@@ -2698,6 +2703,7 @@ static bool ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
     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 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
     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 @@ static bool IsInputCompatibleWithStandard(InputKind IK,
     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 @@ static const StringRef GetInputKindName(InputKind IK) {
     return "Objective-C++";
   case Language::OpenCL:
     return "OpenCL";
+  case Language::OpenCLCXX:
+    return "C++ for OpenCL";
   case Language::CUDA:
     return "CUDA";
   case Language::RenderScript:
index 4e5043b..0a84971 100644 (file)
@@ -867,6 +867,7 @@ void PrintPreambleAction::ExecuteAction() {
   case Language::ObjC:
   case Language::ObjCXX:
   case Language::OpenCL:
+  case Language::OpenCLCXX:
   case Language::CUDA:
   case Language::HIP:
     break;
index 4ea13cf..37ac428 100644 (file)
@@ -29,6 +29,7 @@ InputKind FrontendOptions::getInputKindForExtension(StringRef Extension) {
       .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)
@@ -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 &
@@ -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:
@@ -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)
 {
@@ -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;
@@ -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;
 
@@ -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.
@@ -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,
@@ -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)));
 
@@ -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.
@@ -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) {
similarity index 81%
rename from clang/test/CodeGenOpenCLCXX/atexit.cl
rename to clang/test/CodeGenOpenCLCXX/atexit.clcpp
index 2b28aea..e987790 100644 (file)
@@ -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(){};
similarity index 94%
rename from clang/test/CodeGenOpenCLCXX/constexpr.cl
rename to clang/test/CodeGenOpenCLCXX/constexpr.clcpp
index 4f2ed7d..7a04d16 100644 (file)
@@ -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)));
similarity index 79%
rename from clang/test/CodeGenOpenCLCXX/global_init.cl
rename to clang/test/CodeGenOpenCLCXX/global_init.clcpp
index 9f602be..4e02d4a 100644 (file)
@@ -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() {}
@@ -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
@@ -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;
@@ -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{
diff --git a/clang/test/Driver/cxx_for_opencl.clcpp b/clang/test/Driver/cxx_for_opencl.clcpp
new file mode 100644 (file)
index 0000000..e3e89c5
--- /dev/null
@@ -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 7ab6c29..fe5d67a 100644 (file)
@@ -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',
@@ -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;
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -cl-std=clc++ -pedantic -verify
+// RUN: %clang_cc1 %s -pedantic -verify
 
 namespace PointerRvalues {
 
@@ -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
 
@@ -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; };
@@ -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);
@@ -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
@@ -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}}
@@ -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 {
@@ -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 {
similarity index 94%
rename from clang/test/SemaOpenCLCXX/addrspace-auto.cl
rename to clang/test/SemaOpenCLCXX/addrspace-auto.clcpp
index 2860237..7862564 100644 (file)
@@ -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'
similarity index 95%
rename from clang/test/SemaOpenCLCXX/addrspace_cast.cl
rename to clang/test/SemaOpenCLCXX/addrspace_cast.clcpp
index 3bf0175..37cf1bc 100644 (file)
@@ -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.
@@ -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
 
similarity index 89%
rename from clang/test/SemaOpenCLCXX/invalid-kernel.cl
rename to clang/test/SemaOpenCLCXX/invalid-kernel.clcpp
index 2efdb75..2cbfffd 100644 (file)
@@ -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}}
similarity index 76%
rename from clang/test/SemaOpenCLCXX/members.cl
rename to clang/test/SemaOpenCLCXX/members.clcpp
index 855948f..c0a885c 100644 (file)
@@ -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
@@ -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}}
similarity index 94%
rename from clang/test/SemaOpenCLCXX/newdelete.cl
rename to clang/test/SemaOpenCLCXX/newdelete.clcpp
index 2ef2784..127efbe 100644 (file)
@@ -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:
similarity index 89%
rename from clang/test/SemaOpenCLCXX/references.cl
rename to clang/test/SemaOpenCLCXX/references.clcpp
index 42acb12..cffcc2c 100644 (file)
@@ -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
similarity index 94%
rename from clang/test/SemaOpenCLCXX/restricted.cl
rename to clang/test/SemaOpenCLCXX/restricted.clcpp
index c00c634..2a84b41 100644 (file)
@@ -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 f9f49d7..21b6745 100644 (file)
@@ -26,7 +26,7 @@ config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
 
 # 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