[llvm] [ADT] Add detection utility for incomplete types (PR #65495)
Jakub Kuderski via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 6 09:25:43 PDT 2023
================
@@ -2476,6 +2476,16 @@ bool hasNItemsOrLess(ContainerTy &&C, unsigned N) {
template <class Ptr> auto to_address(const Ptr &P) { return P.operator->(); }
template <class T> constexpr T *to_address(T *P) { return P; }
+// Detect incomplete types, relying on the fact that their size is unknown.
+namespace detail {
+template <typename T> using has_sizeof = decltype(sizeof(T));
+} // namespace detail
+
+/// Detects when type `T` is incomplete. This is true for forward declarations
+/// and types with a full definition.
----------------
kuhar wrote:
Right, thanks!
https://github.com/llvm/llvm-project/pull/65495
More information about the llvm-commits
mailing list