================
@@ -253,9 +253,15 @@ inline raw_ostream &operator<<(raw_ostream &OS,
ASTNodeKind K) {
class DynTypedNode {
public:
/// Creates a \c DynTypedNode from \c Node.
- template <typename T>
- static DynTypedNode create(const T &Node) {
- return BaseConverter<T>::create(Node);
+ template <typename T> static DynTypedNode create(const T &Node) {
+ using Converter = BaseConverter<T>;
+ static_assert(
+ Converter::StoresPointer ==
+ ASTNodeKind::getFromNodeKind<typename Converter::StoredType>()
----------------
tJener wrote:
I went with the awkwardness of the stored type because
`DynTypedNode::create<T>` can be called for some `T` that doesn't have a
`KindToKindId` specialization. For example
```c++
const UsingType& Using = /* ... */;
const TypeWithKeyword& Type = Using;
DynTypedNode::create(Type);
```
https://github.com/llvm/llvm-project/pull/237451
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits