[clang-tools-extra] 1746068 - Clangd Matchers.h: Fix -Wdeprecated-copy by making the defaulted copy ctor and deleted copy assignment operators explicit

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon May 10 14:31:23 PDT 2021


Author: David Blaikie
Date: 2021-05-10T14:31:11-07:00
New Revision: 174606877df46f3e8ce0c60a4c744687d3ee3271

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

LOG: Clangd Matchers.h: Fix -Wdeprecated-copy by making the defaulted copy ctor and deleted copy assignment operators explicit

Added: 
    

Modified: 
    clang-tools-extra/clangd/unittests/Matchers.h

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/unittests/Matchers.h b/clang-tools-extra/clangd/unittests/Matchers.h
index d477cf75e7239..2bd915d83a7a1 100644
--- a/clang-tools-extra/clangd/unittests/Matchers.h
+++ b/clang-tools-extra/clangd/unittests/Matchers.h
@@ -132,6 +132,8 @@ PolySubsequenceMatcher<Args...> HasSubsequence(Args &&... M) {
 template <typename InnerMatcher> class OptionalMatcher {
 public:
   explicit OptionalMatcher(const InnerMatcher &matcher) : matcher_(matcher) {}
+  OptionalMatcher(const OptionalMatcher&) = default;
+  OptionalMatcher &operator=(const OptionalMatcher&) = delete;
 
   // This type conversion operator template allows Optional(m) to be
   // used as a matcher for any Optional type whose value type is
@@ -155,6 +157,9 @@ template <typename InnerMatcher> class OptionalMatcher {
     explicit Impl(const InnerMatcher &matcher)
         : matcher_(::testing::MatcherCast<const Value &>(matcher)) {}
 
+    Impl(const Impl&) = default;
+    Impl &operator=(const Impl&) = delete;
+
     virtual void DescribeTo(::std::ostream *os) const {
       *os << "has a value that ";
       matcher_.DescribeTo(os);
@@ -177,13 +182,9 @@ template <typename InnerMatcher> class OptionalMatcher {
 
   private:
     const Matcher<const Value &> matcher_;
-
-    GTEST_DISALLOW_ASSIGN_(Impl);
   };
 
   const InnerMatcher matcher_;
-
-  GTEST_DISALLOW_ASSIGN_(OptionalMatcher);
 };
 
 // Creates a matcher that matches an Optional that has a value


        


More information about the cfe-commits mailing list