[PATCH] D55850: [OpenCL] Allow address spaces as method qualifiers
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 21 08:11:49 PST 2019
Anastasia added a comment.
After rebase I had to modify the following test:
Index: test/SemaOpenCLCXX/address_space_overloading.cl
===================================================================
--- test/SemaOpenCLCXX/address_space_overloading.cl (revision 351746)
+++ test/SemaOpenCLCXX/address_space_overloading.cl (working copy)
@@ -1,12 +1,12 @@
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=c++
-// expected-no-diagnostics
+// FIXME: This test shouldn't trigger any errors.
struct RetGlob {
int dummy;
};
-struct RetGen {
+struct RetGen { //expected-error{{binding value of type '__generic RetGen' to reference to type 'RetGen' drops <<ERROR>> qualifiers}}
char dummy;
};
@@ -19,5 +19,5 @@
__local int *ArgLoc;
RetGlob TestGlob = foo(ArgGlob);
RetGen TestGen = foo(ArgGen);
- TestGen = foo(ArgLoc);
+ TestGen = foo(ArgLoc); //expected-note{{in implicit copy assignment operator for 'RetGen' first required here}}
}
After looking at it, I realized that there is another un-handled path for address spaces in the initialization sequence. That gets hit during the creation of a return statement when we define implicit copy assignment. assignment. As a result I end up with the following incorrect AST:
UnaryOperator 0x75a910 '__generic struct RetGen' lvalue prefix '*' cannot overflow
`-CXXThisExpr 0x75a900 '__generic struct RetGen *' this
As I wasn't sure whether I should fix the initialization sequence again by splitting the address space conversion to move it to a later step or just fix the type of *this expr, I will upload a separate fix for this instead of reopening this review.
The overloading resolution seems to work fine at least which is what this test is supposed to check.
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55850/new/
https://reviews.llvm.org/D55850
More information about the cfe-commits
mailing list