[llvm] [LLVM][Support] add nonNull function helper (PR #188718)
Jakub Kuderski via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 30 07:26:24 PDT 2026
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <github at keenuts.net>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/188718 at github.com>
================
@@ -811,6 +811,25 @@ T cantFail(Expected<T> ValOrErr, const char *Msg = nullptr) {
}
}
+template <typename T>
+using compare_nullptr_t = decltype(std::declval<T &>() == nullptr);
+
+template <typename T>
+using is_nullptr_comparable = llvm::is_detected<compare_nullptr_t, T>;
----------------
kuhar wrote:
You can wrap it in the `detail` namespace
https://github.com/llvm/llvm-project/pull/188718
More information about the llvm-commits
mailing list