[llvm] 8fa3184 - [TextAPI] Use function_ref where possible, NFCI (#76732)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 2 09:47:42 PST 2024
Author: Cyndy Ishida
Date: 2024-01-02T09:47:38-08:00
New Revision: 8fa3184539df441ca325d8b70ae5b573c46d8450
URL: https://github.com/llvm/llvm-project/commit/8fa3184539df441ca325d8b70ae5b573c46d8450
DIFF: https://github.com/llvm/llvm-project/commit/8fa3184539df441ca325d8b70ae5b573c46d8450.diff
LOG: [TextAPI] Use function_ref where possible, NFCI (#76732)
Added:
Modified:
llvm/lib/TextAPI/TextStubV5.cpp
Removed:
################################################################################
diff --git a/llvm/lib/TextAPI/TextStubV5.cpp b/llvm/lib/TextAPI/TextStubV5.cpp
index 2f82bc03480b94..aea772dbc4be3e 100644
--- a/llvm/lib/TextAPI/TextStubV5.cpp
+++ b/llvm/lib/TextAPI/TextStubV5.cpp
@@ -201,8 +201,9 @@ Expected<StubT> getRequiredValue(
template <typename JsonT, typename StubT = JsonT>
Expected<StubT> getRequiredValue(
TBDKey Key, const Object *Obj,
- std::function<std::optional<JsonT>(const Object *, StringRef)> GetValue,
- StubT DefaultValue, std::function<std::optional<StubT>(JsonT)> Validate) {
+ std::function<std::optional<JsonT>(const Object *, StringRef)> const
+ GetValue,
+ StubT DefaultValue, function_ref<std::optional<StubT>(JsonT)> Validate) {
std::optional<JsonT> Val = GetValue(Obj, Keys[Key]);
if (!Val)
return DefaultValue;
@@ -215,7 +216,7 @@ Expected<StubT> getRequiredValue(
}
Error collectFromArray(TBDKey Key, const Object *Obj,
- std::function<void(StringRef)> Append,
+ function_ref<void(StringRef)> Append,
bool IsRequired = false) {
const auto *Values = Obj->getArray(Keys[Key]);
if (!Values) {
More information about the llvm-commits
mailing list