diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2016-03-18 13:31:00 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2016-03-18 13:31:00 +0000 |
commit | b21f585412eb9edc60ca6b441e27651757c6f4eb (patch) | |
tree | d3c27cf40c90f88d8d69fee2d589dfb02053de01 /include/clang/Sema/Lookup.h | |
parent | e41af4a9d90677a826df3da22e50d7f8499c8167 (diff) |
Make LookupResult movable again.
We lost copy semantics in r263730, because it only worked for a few very
specific cases. Move semantics don't have this issue. Sadly the
implementation is a bit messy but I don't know how to clean it up
without losing support for msvc 2013 :/
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263785 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Sema/Lookup.h')
-rw-r--r-- | include/clang/Sema/Lookup.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/clang/Sema/Lookup.h b/include/clang/Sema/Lookup.h index 2cc4418c32..81fc5a5e15 100644 --- a/include/clang/Sema/Lookup.h +++ b/include/clang/Sema/Lookup.h @@ -190,6 +190,44 @@ public: LookupResult(const LookupResult &) = delete; LookupResult &operator=(const LookupResult &) = delete; + LookupResult(LookupResult &&Other) + : ResultKind(std::move(Other.ResultKind)), + Ambiguity(std::move(Other.Ambiguity)), Decls(std::move(Other.Decls)), + Paths(std::move(Other.Paths)), + NamingClass(std::move(Other.NamingClass)), + BaseObjectType(std::move(Other.BaseObjectType)), + SemaPtr(std::move(Other.SemaPtr)), NameInfo(std::move(Other.NameInfo)), + NameContextRange(std::move(Other.NameContextRange)), + LookupKind(std::move(Other.LookupKind)), IDNS(std::move(Other.IDNS)), + Redecl(std::move(Other.Redecl)), HideTags(std::move(Other.HideTags)), + Diagnose(std::move(Other.Diagnose)), + AllowHidden(std::move(Other.AllowHidden)), + Shadowed(std::move(Other.Shadowed)) { + Other.Paths = nullptr; + Other.Diagnose = false; + } + LookupResult &operator=(LookupResult &&Other) { + ResultKind = std::move(Other.ResultKind); + Ambiguity = std::move(Other.Ambiguity); + Decls = std::move(Other.Decls); + Paths = std::move(Other.Paths); + NamingClass = std::move(Other.NamingClass); + BaseObjectType = std::move(Other.BaseObjectType); + SemaPtr = std::move(Other.SemaPtr); + NameInfo = std::move(Other.NameInfo); + NameContextRange = std::move(Other.NameContextRange); + LookupKind = std::move(Other.LookupKind); + IDNS = std::move(Other.IDNS); + Redecl = std::move(Other.Redecl); + HideTags = std::move(Other.HideTags); + Diagnose = std::move(Other.Diagnose); + AllowHidden = std::move(Other.AllowHidden); + Shadowed = std::move(Other.Shadowed); + Other.Paths = nullptr; + Other.Diagnose = false; + return *this; + } + ~LookupResult() { if (Diagnose) diagnose(); if (Paths) deletePaths(Paths); |