[PATCH] D159045: [clang-tidy] Improved documentation for readability-function-size
Piotr Zegar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 31 10:07:01 PDT 2023
PiotrZSL added a comment.
In D159045#4631820 <https://reviews.llvm.org/D159045#4631820>, @felix642 wrote:
> In that case, I agree with you, it would be helpful to add this feature. I think supporting an empty value rather than a boolean is preferable. We should maybe do that in another Differential though. I can open an issue on github and I'll open another diff when I'm ready. What do you think?
Yes this should be done as a separate change.
Probably something like this would be needed in ClangTidyCheck.h.
template <typename T>
std::enable_if_t<std::is_integral_v<T>, std::optional<T>> get(StringRef LocalName, std::optional<T> Default) const {
if (std::optional<StringRef> Value = get(LocalName)) {
if (value == "none" || value == "null" || value == "false" || value == "") // and -1 for unsigned types for backward combability
return std::nullopt;
T Result{};
if (!StringRef(*Value).getAsInteger(10, Result))
return Result;
diagnoseBadIntegerOption(NamePrefix + LocalName, *Value);
}
return Default;
}
And storing would need to be updated in similar way.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D159045/new/
https://reviews.llvm.org/D159045
More information about the cfe-commits
mailing list