[clang] [clang]: implement std::meta::is_type (PR #211653)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 29 03:32:20 PDT 2026


================
@@ -0,0 +1,17 @@
+//===--- BuiltinsMeta.td - Builtins for reflection metafunctions ---*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===-------------------------------------------------------------------------===//
+
+// All metafunctions should be consteval.
+class CXXMetaBuiltin<string name, string prototype, list<Attribute> Attrs = []>
+    : LangBuiltin<"REFLECTION_LANG"> {
+  let Spellings = [!strconcat("__builtin_meta_", name)];
+  let Prototype = prototype;
+  let Attributes = !listconcat([Consteval], Attrs);
+}
+
+def MetaIsType : CXXMetaBuiltin<"is_type", "bool(std::meta::info)", [NoThrow]>;
----------------
cor3ntin wrote:

Is there any throwing meta builtin?

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


More information about the cfe-commits mailing list