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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D159045:... Félix-Antoine Constantin via Phabricator via cfe-commits
    • [PATCH] D15... Félix-Antoine Constantin via Phabricator via cfe-commits
    • [PATCH] D15... Félix-Antoine Constantin via Phabricator via cfe-commits
    • [PATCH] D15... Piotr Zegar via Phabricator via cfe-commits
    • [PATCH] D15... Félix-Antoine Constantin via Phabricator via cfe-commits
    • [PATCH] D15... Piotr Zegar via Phabricator via cfe-commits
    • [PATCH] D15... Félix-Antoine Constantin via Phabricator via cfe-commits
    • [PATCH] D15... Piotr Zegar via Phabricator via cfe-commits

Reply via email to