This revision was automatically updated to reflect the committed changes. Closed by commit rL351546: [OpenCL] Fix overloading ranking rules for addrspace conversions. (authored by stulova, committed by ). Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D56735?vs=182245&id=182491#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D56735/new/ https://reviews.llvm.org/D56735 Files: cfe/trunk/lib/Sema/SemaOverload.cpp cfe/trunk/test/SemaOpenCLCXX/address_space_overloading.cl Index: cfe/trunk/lib/Sema/SemaOverload.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaOverload.cpp +++ cfe/trunk/lib/Sema/SemaOverload.cpp @@ -4019,9 +4019,12 @@ // to unwrap. This essentially mimics what // IsQualificationConversion does, but here we're checking for a // strict subset of qualifiers. - if (T1.getCVRQualifiers() == T2.getCVRQualifiers()) + if (T1.getQualifiers().withoutObjCLifetime() == + T2.getQualifiers().withoutObjCLifetime()) // The qualifiers are the same, so this doesn't tell us anything // about how the sequences rank. + // ObjC ownership quals are omitted above as they interfere with + // the ARC overload rule. ; else if (T2.isMoreQualifiedThan(T1)) { // T1 has fewer qualifiers, so it could be the better sequence. Index: cfe/trunk/test/SemaOpenCLCXX/address_space_overloading.cl =================================================================== --- cfe/trunk/test/SemaOpenCLCXX/address_space_overloading.cl +++ cfe/trunk/test/SemaOpenCLCXX/address_space_overloading.cl @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=c++ + +// expected-no-diagnostics + +struct RetGlob { + int dummy; +}; + +struct RetGen { + char dummy; +}; + +RetGlob foo(const __global int *); +RetGen foo(const __generic int *); + +void kernel k() { + __global int *ArgGlob; + __generic int *ArgGen; + __local int *ArgLoc; + RetGlob TestGlob = foo(ArgGlob); + RetGen TestGen = foo(ArgGen); + TestGen = foo(ArgLoc); +}
Index: cfe/trunk/lib/Sema/SemaOverload.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaOverload.cpp +++ cfe/trunk/lib/Sema/SemaOverload.cpp @@ -4019,9 +4019,12 @@ // to unwrap. This essentially mimics what // IsQualificationConversion does, but here we're checking for a // strict subset of qualifiers. - if (T1.getCVRQualifiers() == T2.getCVRQualifiers()) + if (T1.getQualifiers().withoutObjCLifetime() == + T2.getQualifiers().withoutObjCLifetime()) // The qualifiers are the same, so this doesn't tell us anything // about how the sequences rank. + // ObjC ownership quals are omitted above as they interfere with + // the ARC overload rule. ; else if (T2.isMoreQualifiedThan(T1)) { // T1 has fewer qualifiers, so it could be the better sequence. Index: cfe/trunk/test/SemaOpenCLCXX/address_space_overloading.cl =================================================================== --- cfe/trunk/test/SemaOpenCLCXX/address_space_overloading.cl +++ cfe/trunk/test/SemaOpenCLCXX/address_space_overloading.cl @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=c++ + +// expected-no-diagnostics + +struct RetGlob { + int dummy; +}; + +struct RetGen { + char dummy; +}; + +RetGlob foo(const __global int *); +RetGen foo(const __generic int *); + +void kernel k() { + __global int *ArgGlob; + __generic int *ArgGen; + __local int *ArgLoc; + RetGlob TestGlob = foo(ArgGlob); + RetGen TestGen = foo(ArgGen); + TestGen = foo(ArgLoc); +}
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits