[flang-commits] [flang] [flang][cli] Add diagnostic flags to the CLI (PR #142022)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Thu May 29 13:11:16 PDT 2025


================
@@ -58,15 +59,51 @@ constexpr std::array<std::string_view, ITEMS> EnumNames(const char *p) {
   return result;
 }
 
+template <typename F, typename T>
+std::optional<T> inline fmap(std::optional<F> x, std::function<T(const F)> f) {
+  return x ? std::optional<T>{f(*x)} : std::nullopt;
+}
+
+using Predicate = std::function<bool(const std::string_view)>;
+// Finds the first index for which the predicate returns true.
+std::optional<int> FindEnumIndex(
+    Predicate pred, int size, const std::string_view *names);
----------------
klausler wrote:

`std::size_t`, not `int`

https://github.com/llvm/llvm-project/pull/142022


More information about the flang-commits mailing list