[clang] [clang]: support std::meta::info for primitive types (PR #190356)

via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 4 08:27:23 PDT 2026


================
@@ -494,6 +500,18 @@ static void profileIntValue(llvm::FoldingSetNodeID &ID, const llvm::APInt &V) {
     ID.AddInteger((uint32_t)V.extractBitsAsZExtValue(std::min(32u, N - I), I));
 }
 
+static void profileReflection(llvm::FoldingSetNodeID &ID, APValue V) {
+  ID.AddInteger(static_cast<int>(V.getReflectionOperandKind()));
+  switch (V.getReflectionOperandKind()) {
+    case ReflectionKind::Type: {
+      const TypeSourceInfo* info = static_cast<const TypeSourceInfo*>(V.getOpaqueReflectionOperand());
+      ID.AddPointer((info->getType().getCanonicalType().getAsOpaquePtr()));
----------------
Sirraide wrote:

Yeah, I have a feeling that this might get a bit complicated then because e.g. if `Foo` is a record type, both `struct Foo` and `class Foo` denote the same type (and afaik their reflections should be equivalent), but iirc they end up being different non-canonical `Type*`s...

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


More information about the cfe-commits mailing list