LLVM 22.0.0git
llvm::yaml::PolymorphicTraits< T > Struct Template Reference

This class should be specialized by any type that can be represented as a scalar, map, or sequence, decided dynamically. More...

#include "llvm/Support/YAMLTraits.h"

Inheritance diagram for llvm::yaml::PolymorphicTraits< T >:
[legend]

Detailed Description

template<typename T>
struct llvm::yaml::PolymorphicTraits< T >

This class should be specialized by any type that can be represented as a scalar, map, or sequence, decided dynamically.

For example:

typedef std::unique_ptr<MyBase> MyPoly;

template<> struct PolymorphicTraits<MyPoly> { static NodeKind getKind(const MyPoly &poly) { return poly->getKind(); } static MyScalar& getAsScalar(MyPoly &poly) { if (!poly || !isa<MyScalar>(poly)) poly.reset(new MyScalar()); return *cast<MyScalar>(poly.get()); } // ... };

Definition at line 295 of file YAMLTraits.h.


The documentation for this struct was generated from the following file: