================
@@ -35,6 +36,44 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
return OS;
}
+class ReflectionValue {
+public:
+ // Note: 'NamespaceDecl' is currently unused; it's only here because
+ // it's an incomplete type in this header to make sure this pointer
+ // union works with incomplete types.
+ using OperandType =
+ llvm::PointerUnion<const TypeSourceInfo *, const NamespaceDecl *>;
+
+private:
+ ReflectionKind Kind;
+ OperandType Operand;
+
+ ReflectionValue(ReflectionKind Kind, OperandType Operand)
+ : Kind(Kind), Operand(Operand) {}
+
+public:
+ /// Create a null reflection.
+ ReflectionValue() : Kind(ReflectionKind::Null), Operand(nullptr) {}
+
+ /// Create a type or type alias reflection.
+ explicit ReflectionValue(const TypeSourceInfo *TSI);
+
+ /// Do not use this other than to implement serialization as pairing
+ /// an operand with the wrong kind will cause Clang to crash.
+ static ReflectionValue CreateUnsafe(ReflectionKind Kind, const void
*Operand);
----------------
tbaederr wrote:
```suggestion
static ReflectionValue createUnsafe(ReflectionKind Kind, const void *Operand);
```
https://github.com/llvm/llvm-project/pull/236991
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits