[clang-tools-extra] r325868 - [clangd] BindWithForward -> Bind. NFC
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 22 23:54:17 PST 2018
Author: sammccall
Date: Thu Feb 22 23:54:17 2018
New Revision: 325868
URL: http://llvm.org/viewvc/llvm-project?rev=325868&view=rev
Log:
[clangd] BindWithForward -> Bind. NFC
Modified:
clang-tools-extra/trunk/clangd/ClangdServer.cpp
clang-tools-extra/trunk/clangd/Function.h
clang-tools-extra/trunk/clangd/TUScheduler.cpp
clang-tools-extra/trunk/unittests/clangd/SyncAPI.cpp
Modified: clang-tools-extra/trunk/clangd/ClangdServer.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdServer.cpp?rev=325868&r1=325867&r2=325868&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ClangdServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdServer.cpp Thu Feb 22 23:54:17 2018
@@ -181,10 +181,9 @@ void ClangdServer::codeComplete(
Callback(make_tagged(std::move(Result), std::move(TaggedFS.Tag)));
};
- WorkScheduler.runWithPreamble("CodeComplete", File,
- BindWithForward(Task, std::move(Contents),
- File.str(),
- std::move(Callback)));
+ WorkScheduler.runWithPreamble(
+ "CodeComplete", File,
+ Bind(Task, std::move(Contents), File.str(), std::move(Callback)));
}
void ClangdServer::signatureHelp(
@@ -224,9 +223,8 @@ void ClangdServer::signatureHelp(
TaggedFS.Tag));
};
- WorkScheduler.runWithPreamble(
- "SignatureHelp", File,
- BindWithForward(Action, File.str(), std::move(Callback)));
+ WorkScheduler.runWithPreamble("SignatureHelp", File,
+ Bind(Action, File.str(), std::move(Callback)));
}
llvm::Expected<tooling::Replacements>
@@ -312,7 +310,7 @@ void ClangdServer::rename(
WorkScheduler.runWithAST(
"Rename", File,
- BindWithForward(Action, File.str(), NewName.str(), std::move(Callback)));
+ Bind(Action, File.str(), NewName.str(), std::move(Callback)));
}
Expected<tooling::Replacements>
@@ -378,8 +376,7 @@ void ClangdServer::dumpAST(PathRef File,
Callback(Result);
};
- WorkScheduler.runWithAST("DumpAST", File,
- BindWithForward(Action, std::move(Callback)));
+ WorkScheduler.runWithAST("DumpAST", File, Bind(Action, std::move(Callback)));
}
void ClangdServer::findDefinitions(
@@ -396,7 +393,7 @@ void ClangdServer::findDefinitions(
};
WorkScheduler.runWithAST("Definitions", File,
- BindWithForward(Action, std::move(Callback)));
+ Bind(Action, std::move(Callback)));
}
llvm::Optional<Path> ClangdServer::switchSourceHeader(PathRef Path) {
@@ -493,7 +490,7 @@ void ClangdServer::findDocumentHighlight
};
WorkScheduler.runWithAST("Highlights", File,
- BindWithForward(Action, std::move(Callback)));
+ Bind(Action, std::move(Callback)));
}
void ClangdServer::findHover(
@@ -516,8 +513,7 @@ void ClangdServer::findHover(
Callback(make_tagged(std::move(Result), TaggedFS.Tag));
};
- WorkScheduler.runWithAST("Hover", File,
- BindWithForward(Action, std::move(Callback)));
+ WorkScheduler.runWithAST("Hover", File, Bind(Action, std::move(Callback)));
}
void ClangdServer::scheduleReparseAndDiags(
Modified: clang-tools-extra/trunk/clangd/Function.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Function.h?rev=325868&r1=325867&r2=325868&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/Function.h (original)
+++ clang-tools-extra/trunk/clangd/Function.h Thu Feb 22 23:54:17 2018
@@ -117,7 +117,7 @@ public:
std::forward<RestArgs>(Rest)...)) {
#ifndef NDEBUG
- assert(!WasCalled && "Can only call result of BindWithForward once.");
+ assert(!WasCalled && "Can only call result of Bind once.");
WasCalled = true;
#endif
return CallImpl(llvm::index_sequence_for<Args...>(),
@@ -132,7 +132,7 @@ public:
/// The returned object must be called no more than once, as \p As are
/// std::forwarded'ed (therefore can be moved) into \p F during the call.
template <class Func, class... Args>
-ForwardBinder<Func, Args...> BindWithForward(Func F, Args &&... As) {
+ForwardBinder<Func, Args...> Bind(Func F, Args &&... As) {
return ForwardBinder<Func, Args...>(
std::make_tuple(std::forward<Func>(F), std::forward<Args>(As)...));
}
Modified: clang-tools-extra/trunk/clangd/TUScheduler.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/TUScheduler.cpp?rev=325868&r1=325867&r2=325868&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/TUScheduler.cpp (original)
+++ clang-tools-extra/trunk/clangd/TUScheduler.cpp Thu Feb 22 23:54:17 2018
@@ -218,7 +218,7 @@ void ASTWorker::update(
OnUpdated(std::move(*Diags));
};
- startTask("Update", BindWithForward(Task, std::move(OnUpdated)), WantDiags);
+ startTask("Update", Bind(Task, std::move(OnUpdated)), WantDiags);
}
void ASTWorker::runWithAST(
@@ -239,7 +239,7 @@ void ASTWorker::runWithAST(
LastASTSize = ActualAST->getUsedBytes();
};
- startTask(Name, BindWithForward(Task, std::move(Action)),
+ startTask(Name, Bind(Task, std::move(Action)),
/*UpdateType=*/llvm::None);
}
@@ -472,10 +472,9 @@ void TUScheduler::runWithPreamble(
Action(InputsAndPreamble{InputsCopy, Preamble.get()});
};
- PreambleTasks->runAsync(
- "task:" + llvm::sys::path::filename(File),
- BindWithForward(Task, std::string(Name), std::string(File),
- Context::current().clone(), std::move(Action)));
+ PreambleTasks->runAsync("task:" + llvm::sys::path::filename(File),
+ Bind(Task, std::string(Name), std::string(File),
+ Context::current().clone(), std::move(Action)));
}
std::vector<std::pair<Path, std::size_t>>
Modified: clang-tools-extra/trunk/unittests/clangd/SyncAPI.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/SyncAPI.cpp?rev=325868&r1=325867&r2=325868&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/SyncAPI.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/SyncAPI.cpp Thu Feb 22 23:54:17 2018
@@ -32,7 +32,7 @@ template <typename T> struct CaptureProx
operator UniqueFunction<void(T)>() && {
assert(!Future.valid() && "conversion to callback called multiple times");
Future = Promise.get_future();
- return BindWithForward(
+ return Bind(
[](std::promise<std::shared_ptr<T>> Promise, T Value) {
Promise.set_value(std::make_shared<T>(std::move(Value)));
},
More information about the cfe-commits
mailing list