public:
// Construct a yaml Input object from a StringRef and optional user-data.
Input(StringRef InputContent, void *Ctxt=NULL);
-
+ ~Input();
+
// Check if there was an syntax or semantic error during parsing.
llvm::error_code error();
class HNode {
public:
HNode(Node *n) : _node(n) { }
+ virtual ~HNode() { }
static inline bool classof(const HNode *) { return true; }
Node *_node;
class EmptyHNode : public HNode {
public:
EmptyHNode(Node *n) : HNode(n) { }
+ virtual ~EmptyHNode() {}
static inline bool classof(const HNode *n) {
return NullNode::classof(n->_node);
}
class ScalarHNode : public HNode {
public:
ScalarHNode(Node *n, StringRef s) : HNode(n), _value(s) { }
+ virtual ~ScalarHNode() { }
StringRef value() const { return _value; }
class MapHNode : public HNode {
public:
MapHNode(Node *n) : HNode(n) { }
+ virtual ~MapHNode();
static inline bool classof(const HNode *n) {
return MappingNode::classof(n->_node);
class SequenceHNode : public HNode {
public:
SequenceHNode(Node *n) : HNode(n) { }
+ virtual ~SequenceHNode();
static inline bool classof(const HNode *n) {
return SequenceNode::classof(n->_node);
void nextDocument();
private:
- llvm::yaml::Stream *Strm;
- llvm::SourceMgr SrcMgr;
+ llvm::SourceMgr SrcMgr; // must be before Strm
+ OwningPtr<llvm::yaml::Stream> Strm;
+ OwningPtr<HNode> TopNode;
llvm::error_code EC;
- llvm::BumpPtrAllocator Allocator;
+ llvm::BumpPtrAllocator StringAllocator;
llvm::yaml::document_iterator DocIterator;
std::vector<bool> BitValuesUsed;
HNode *CurrentNode;