[PATCH] D40486: [clangd] Implemented logging using Context
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 13 03:38:57 PST 2017
sammccall accepted this revision.
sammccall added inline comments.
================
Comment at: clangd/Function.h:157
+
+ ScopeExitGuard(ScopeExitGuard &&Other)
+ : F(std::move(Other.F)), Moved(Other.Moved) {
----------------
ilya-biryukov wrote:
> sammccall wrote:
> > I'm struggling to think of cases where moving these guards is the right solution.
> > Can we delete the move ops until we need them? It seems to make this class almost trivial.
> We need moves as we return the class by value from the `onScopeGuard` function. Neither of these will compile without move constructors:
> ```
> auto Guard = onScopeGuard([]() { /*...*/ });
> auto Guard2(onScopeGuard([]() { /*...*/ }));
> auto Guard3{onScopeGuard([]() { /*...*/ })};
> ```
>
Of course :-)
As you pointed out offline, making the member Optional<Func> would let you use the default move operators at least.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D40486
More information about the cfe-commits
mailing list