[clang] a72f11e - Fix a pair of tests that would fail on a win32 box

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 17 14:30:15 PST 2020


Author: Erich Keane
Date: 2020-11-17T14:28:52-08:00
New Revision: a72f11ee20fec2df5611c49ec5ec2ce32ab8eb4c

URL: https://github.com/llvm/llvm-project/commit/a72f11ee20fec2df5611c49ec5ec2ce32ab8eb4c
DIFF: https://github.com/llvm/llvm-project/commit/a72f11ee20fec2df5611c49ec5ec2ce32ab8eb4c.diff

LOG: Fix a pair of tests that would fail on a win32 box

The tests don't specify a triple in some cases, since they shouldn't be
necessary, so I've updated the tests to detect via macro when they are
running on win32 to give the slightly altered diagnostic.

Added: 
    

Modified: 
    clang/test/CXX/expr/expr.prim/expr.prim.lambda/default-arguments.cpp
    clang/test/SemaOpenCLCXX/address-space-lambda.cl

Removed: 
    


################################################################################
diff  --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/default-arguments.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/default-arguments.cpp
index 5d3c63f92c28..3e28288fb82a 100644
--- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/default-arguments.cpp
+++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/default-arguments.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify=expected,nowin32
-// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify=expected,win32 -triple i386-windows
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify -triple i386-windows
 
 void defargs() {
   auto l1 = [](int i, int j = 17, int k = 18) { return i + j + k; };
@@ -44,9 +44,12 @@ template void defargs_in_template_unused(NoDefaultCtor);  // expected-note{{in i
 template<typename T>
 void defargs_in_template_used() {
   auto l1 = [](const T& value = T()) { }; // expected-error{{no matching constructor for initialization of 'NoDefaultCtor'}} \
-                                          // expected-note{{candidate function not viable: requires single argument 'value', but no arguments were provided}} \
-                                          // nowin32-note{{conversion candidate of type 'void (*)(const NoDefaultCtor &)'}}\
-                                          // win32-note{{conversion candidate of type 'void (*)(const NoDefaultCtor &) __attribute__((thiscall))'}}
+                                          // expected-note{{candidate function not viable: requires single argument 'value', but no arguments were provided}}
+#if defined(_WIN32) && !defined(_WIN64)
+                                          // expected-note at 46{{conversion candidate of type 'void (*)(const NoDefaultCtor &) __attribute__((thiscall))'}}
+#else
+                                          // expected-note at 46{{conversion candidate of type 'void (*)(const NoDefaultCtor &)'}}
+#endif
   l1(); // expected-error{{no matching function for call to object of type '(lambda at }}
 }
 

diff  --git a/clang/test/SemaOpenCLCXX/address-space-lambda.cl b/clang/test/SemaOpenCLCXX/address-space-lambda.cl
index c9e1ec3735a8..571ea9035877 100644
--- a/clang/test/SemaOpenCLCXX/address-space-lambda.cl
+++ b/clang/test/SemaOpenCLCXX/address-space-lambda.cl
@@ -1,5 +1,5 @@
-//RUN: %clang_cc1 %s -cl-std=clc++ -pedantic -ast-dump -verify=expected,nowin32 | FileCheck %s
-//RUN: %clang_cc1 %s -cl-std=clc++ -pedantic -ast-dump -verify=expected,win32 -triple i386-windows | FileCheck %s
+//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
 
 //CHECK: CXXMethodDecl {{.*}} constexpr operator() 'int (__private int){{.*}} const __generic'
 auto glambda = [](auto a) { return a; };
@@ -32,12 +32,27 @@ __kernel void test_qual() {
 //CHECK: |-CXXMethodDecl {{.*}} constexpr operator() 'void () {{.*}}const __generic'
   auto priv2 = []() __generic {};
   priv2();
-  auto priv3 = []() __global {}; //expected-note{{candidate function not viable: 'this' object is in address space '__private', but method expects object in address space '__global'}} //nowin32-note{{conversion candidate of type 'void (*)()'}}//win32-note{{conversion candidate of type 'void (*)() __attribute__((thiscall))'}}
+  auto priv3 = []() __global {}; //expected-note{{candidate function not viable: 'this' object is in address space '__private', but method expects object in address space '__global'}}
+#if defined(_WIN32) && !defined(_WIN64)
+  //expected-note at 35{{conversion candidate of type 'void (*)() __attribute__((thiscall))'}}
+#else
+  //expected-note at 35{{conversion candidate of type 'void (*)()'}}
+#endif
   priv3(); //expected-error{{no matching function for call to object of type}}
 
-  __constant auto const1 = []() __private{}; //expected-note{{candidate function not viable: 'this' object is in address space '__constant', but method expects object in address space '__private'}} //nowin32-note{{conversion candidate of type 'void (*)()'}} //win32-note{{conversion candidate of type 'void (*)() __attribute__((thiscall))'}}
+  __constant auto const1 = []() __private{}; //expected-note{{candidate function not viable: 'this' object is in address space '__constant', but method expects object in address space '__private'}}
+#if defined(_WIN32) && !defined(_WIN64)
+  //expected-note at 43{{conversion candidate of type 'void (*)() __attribute__((thiscall))'}}
+#else
+  //expected-note at 43{{conversion candidate of type 'void (*)()'}}
+#endif
   const1(); //expected-error{{no matching function for call to object of type '__constant (lambda at}}
-  __constant auto const2 = []() __generic{}; //expected-note{{candidate function not viable: 'this' object is in address space '__constant', but method expects object in address space '__generic'}} //nowin32-note{{conversion candidate of type 'void (*)()'}} //win32-note{{conversion candidate of type 'void (*)() __attribute__((thiscall))'}}
+  __constant auto const2 = []() __generic{}; //expected-note{{candidate function not viable: 'this' object is in address space '__constant', but method expects object in address space '__generic'}}
+#if defined(_WIN32) && !defined(_WIN64)
+  //expected-note at 50{{conversion candidate of type 'void (*)() __attribute__((thiscall))'}}
+#else
+  //expected-note at 50{{conversion candidate of type 'void (*)()'}}
+#endif
   const2(); //expected-error{{no matching function for call to object of type '__constant (lambda at}}
 //CHECK: |-CXXMethodDecl {{.*}} constexpr operator() 'void () {{.*}}const __constant'
   __constant auto const3 = []() __constant{};


        


More information about the cfe-commits mailing list