diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Support/YAMLTraits.cpp')
| -rw-r--r-- | contrib/llvm-project/llvm/lib/Support/YAMLTraits.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/contrib/llvm-project/llvm/lib/Support/YAMLTraits.cpp b/contrib/llvm-project/llvm/lib/Support/YAMLTraits.cpp index 5f0cedc71829..09eb36943de9 100644 --- a/contrib/llvm-project/llvm/lib/Support/YAMLTraits.cpp +++ b/contrib/llvm-project/llvm/lib/Support/YAMLTraits.cpp @@ -40,7 +40,7 @@ IO::IO(void *Context) : Ctxt(Context) {} IO::~IO() = default; -void *IO::getContext() const { +void *IO::getContext() { return Ctxt; } @@ -79,7 +79,7 @@ void Input::ScalarHNode::anchor() {} void Input::MapHNode::anchor() {} void Input::SequenceHNode::anchor() {} -bool Input::outputting() const { +bool Input::outputting() { return false; } @@ -87,6 +87,7 @@ bool Input::setCurrentDocument() { if (DocIterator != Strm->end()) { Node *N = DocIterator->getRoot(); if (!N) { + assert(Strm->failed() && "Root is NULL iff parsing failed"); EC = make_error_code(errc::invalid_argument); return false; } @@ -376,12 +377,12 @@ std::unique_ptr<Input::HNode> Input::createHNodes(Node *N) { // Copy string to permanent storage KeyStr = StringStorage.str().copy(StringAllocator); } - return std::make_unique<ScalarHNode>(N, KeyStr); + return llvm::make_unique<ScalarHNode>(N, KeyStr); } else if (BlockScalarNode *BSN = dyn_cast<BlockScalarNode>(N)) { StringRef ValueCopy = BSN->getValue().copy(StringAllocator); - return std::make_unique<ScalarHNode>(N, ValueCopy); + return llvm::make_unique<ScalarHNode>(N, ValueCopy); } else if (SequenceNode *SQ = dyn_cast<SequenceNode>(N)) { - auto SQHNode = std::make_unique<SequenceHNode>(N); + auto SQHNode = llvm::make_unique<SequenceHNode>(N); for (Node &SN : *SQ) { auto Entry = createHNodes(&SN); if (EC) @@ -390,10 +391,10 @@ std::unique_ptr<Input::HNode> Input::createHNodes(Node *N) { } return std::move(SQHNode); } else if (MappingNode *Map = dyn_cast<MappingNode>(N)) { - auto mapHNode = std::make_unique<MapHNode>(N); + auto mapHNode = llvm::make_unique<MapHNode>(N); for (KeyValueNode &KVN : *Map) { Node *KeyNode = KVN.getKey(); - ScalarNode *Key = dyn_cast_or_null<ScalarNode>(KeyNode); + ScalarNode *Key = dyn_cast<ScalarNode>(KeyNode); Node *Value = KVN.getValue(); if (!Key || !Value) { if (!Key) @@ -415,7 +416,7 @@ std::unique_ptr<Input::HNode> Input::createHNodes(Node *N) { } return std::move(mapHNode); } else if (isa<NullNode>(N)) { - return std::make_unique<EmptyHNode>(N); + return llvm::make_unique<EmptyHNode>(N); } else { setError(N, "unknown node kind"); return nullptr; @@ -439,7 +440,7 @@ Output::Output(raw_ostream &yout, void *context, int WrapColumn) Output::~Output() = default; -bool Output::outputting() const { +bool Output::outputting() { return true; } |
