[llvm] [PatternMatchHelpers] Introduce m_Unless (NFC) (PR #212454)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 30 08:00:32 PDT 2026
================
@@ -100,6 +100,18 @@ template <typename Ty> struct match_bind { // NOLINT
return false;
}
};
+
+/// Inverting matcher that matches a value not matching P.
+template <typename Ty> struct match_unless { // NOLINT
+ Ty P;
+ match_unless(const Ty &P) : P(P) {}
+ template <typename ITy> bool match(ITy *V) const { return !P.match(V); }
+};
+
+template <typename Pattern>
+inline match_unless<Pattern> m_Unless(const Pattern &P) { // NOLINT
----------------
lukel97 wrote:
Copy over the existing `/// Match if the inner matcher does *NOT* match.` comment?
https://github.com/llvm/llvm-project/pull/212454
More information about the llvm-commits
mailing list