-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 {
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;
};