r244826 - -Wdeprecated: SavedInstanceContext is returned by value but isn't really copyable, but it can be made movable

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 12 15:58:11 PDT 2015


Author: dblaikie
Date: Wed Aug 12 17:58:10 2015
New Revision: 244826

URL: http://llvm.org/viewvc/llvm-project?rev=244826&view=rev
Log:
-Wdeprecated: SavedInstanceContext is returned by value but isn't really copyable, but it can be made movable

Modified:
    cfe/trunk/lib/Sema/SemaAccess.cpp

Modified: cfe/trunk/lib/Sema/SemaAccess.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaAccess.cpp?rev=244826&r1=244825&r2=244826&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaAccess.cpp (original)
+++ cfe/trunk/lib/Sema/SemaAccess.cpp Wed Aug 12 17:58:10 2015
@@ -182,15 +182,20 @@ struct AccessTarget : public AccessedEnt
 
   class SavedInstanceContext {
   public:
+    SavedInstanceContext(SavedInstanceContext &&S)
+        : Target(S.Target), Has(S.Has) {
+      S.Target = nullptr;
+    }
     ~SavedInstanceContext() {
-      Target.HasInstanceContext = Has;
+      if (Target)
+        Target->HasInstanceContext = Has;
     }
 
   private:
     friend struct AccessTarget;
     explicit SavedInstanceContext(AccessTarget &Target)
-      : Target(Target), Has(Target.HasInstanceContext) {}
-    AccessTarget &Target;
+        : Target(&Target), Has(Target.HasInstanceContext) {}
+    AccessTarget *Target;
     bool Has;
   };
 




More information about the cfe-commits mailing list