[llvm] [TextAPI] Use function_ref where possible, NFCI (PR #76732)
Cyndy Ishida via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 2 08:23:54 PST 2024
https://github.com/cyndyishida created https://github.com/llvm/llvm-project/pull/76732
None
>From 109f17508fbe173306c92152d995d6a9ccbcd729 Mon Sep 17 00:00:00 2001
From: Cyndy Ishida <cyndy_ishida at apple.com>
Date: Tue, 2 Jan 2024 08:18:01 -0800
Subject: [PATCH] [TextAPI] Use function_ref where possible, NFCI
---
llvm/lib/TextAPI/TextStubV5.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
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