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

llvm-svn: 244826
This commit is contained in:
David Blaikie 2015-08-12 22:58:10 +00:00
parent 295282e0ab
commit 8533e96e42
1 changed files with 8 additions and 3 deletions

View File

@ -182,15 +182,20 @@ struct AccessTarget : public AccessedEntity {
class SavedInstanceContext { class SavedInstanceContext {
public: public:
SavedInstanceContext(SavedInstanceContext &&S)
: Target(S.Target), Has(S.Has) {
S.Target = nullptr;
}
~SavedInstanceContext() { ~SavedInstanceContext() {
Target.HasInstanceContext = Has; if (Target)
Target->HasInstanceContext = Has;
} }
private: private:
friend struct AccessTarget; friend struct AccessTarget;
explicit SavedInstanceContext(AccessTarget &Target) explicit SavedInstanceContext(AccessTarget &Target)
: Target(Target), Has(Target.HasInstanceContext) {} : Target(&Target), Has(Target.HasInstanceContext) {}
AccessTarget &Target; AccessTarget *Target;
bool Has; bool Has;
}; };