]> granicus.if.org Git - clang/commitdiff
Revert "[CUDA][HIP] Fix typo in `BestViableFunction`"
authorMitch Phillips <mitchphillips@outlook.com>
Thu, 19 Sep 2019 21:11:28 +0000 (21:11 +0000)
committerMitch Phillips <mitchphillips@outlook.com>
Thu, 19 Sep 2019 21:11:28 +0000 (21:11 +0000)
Broke the msan buildbots (see comments on rL372318 for more details).

This reverts commit eb231d15825ac345b546f4c99372d1cac8f14f02.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372353 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaOverload.cpp
test/SemaCUDA/function-overload.cu
test/SemaCUDA/implicit-member-target-collision-cxx11.cu

index 3e07bd218156b4c64e77990ab8e330f593216342..9cf778f934c09eef235ad2886a2dc5154525cbf4 100644 (file)
@@ -9422,19 +9422,17 @@ OverloadCandidateSet::BestViableFunction(Sema &S, SourceLocation Loc,
     const FunctionDecl *Caller = dyn_cast<FunctionDecl>(S.CurContext);
     bool ContainsSameSideCandidate =
         llvm::any_of(Candidates, [&](OverloadCandidate *Cand) {
-          // Consider viable function only.
-          return Cand->Viable && Cand->Function &&
+          return Cand->Function &&
                  S.IdentifyCUDAPreference(Caller, Cand->Function) ==
                      Sema::CFP_SameSide;
         });
     if (ContainsSameSideCandidate) {
-      // Clear viable flag for WrongSide varible candidates.
-      llvm::for_each(Candidates, [&](OverloadCandidate *Cand) {
-        if (Cand->Viable && Cand->Function &&
-            S.IdentifyCUDAPreference(Caller, Cand->Function) ==
-                Sema::CFP_WrongSide)
-          Cand->Viable = false;
-      });
+      auto IsWrongSideCandidate = [&](OverloadCandidate *Cand) {
+        return Cand->Function &&
+               S.IdentifyCUDAPreference(Caller, Cand->Function) ==
+                   Sema::CFP_WrongSide;
+      };
+      llvm::erase_if(Candidates, IsWrongSideCandidate);
     }
   }
 
index b9efd1c09e6994e1b44797d85a45992e58087f53..1d78636a7089b6fa3b51d1027fd2d2c751f57791 100644 (file)
@@ -402,20 +402,3 @@ __host__ void test_host_template_overload() {
 __device__ void test_device_template_overload() {
   template_overload(1); // OK. Attribute-based overloading picks __device__ variant.
 }
-
-// Two classes with `operator-` defined. One of them is device only.
-struct C1;
-struct C2;
-__device__
-int operator-(const C1 &x, const C1 &y);
-int operator-(const C2 &x, const C2 &y);
-
-template <typename T>
-__host__ __device__ int constexpr_overload(const T &x, const T &y) {
-  return x - y;
-}
-
-// Verify that function overloading doesn't prune candidate wrongly.
-int test_constexpr_overload(C2 &x, C2 &y) {
-  return constexpr_overload(x, y);
-}
index 06015ed0d6d8edcb56884ca2e15c3ca777af0823..7aa1dd3f208807ebd14edb20e72593a0a47e8f15 100644 (file)
@@ -74,13 +74,11 @@ struct B4_with_device_copy_ctor {
 struct C4_with_collision : A4_with_host_copy_ctor, B4_with_device_copy_ctor {
 };
 
-// expected-note@-3 {{candidate constructor (the implicit copy constructor) not viable: call to invalid function from __host__ function}}
-// expected-note@-4 {{implicit copy constructor inferred target collision: call to both __host__ and __device__ members}}
-// expected-note@-5 {{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}}
+// expected-note@-3 {{copy constructor of 'C4_with_collision' is implicitly deleted because base class 'B4_with_device_copy_ctor' has no copy constructor}}
 
 void hostfoo4() {
   C4_with_collision c;
-  C4_with_collision c2 = c; // expected-error {{no matching constructor for initialization of 'C4_with_collision'}}
+  C4_with_collision c2 = c; // expected-error {{call to implicitly-deleted copy constructor of 'C4_with_collision'}}
 }
 
 //------------------------------------------------------------------------------