diff options
Diffstat (limited to 'llvm/lib/Support/YAMLTraits.cpp')
| -rw-r--r-- | llvm/lib/Support/YAMLTraits.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/llvm/lib/Support/YAMLTraits.cpp b/llvm/lib/Support/YAMLTraits.cpp index 99d2070cb6e..51c016b1d55 100644 --- a/llvm/lib/Support/YAMLTraits.cpp +++ b/llvm/lib/Support/YAMLTraits.cpp @@ -118,6 +118,18 @@ void Input::beginMapping() { } } +std::vector<StringRef> Input::keys() { + MapHNode *MN = dyn_cast<MapHNode>(CurrentNode); + std::vector<StringRef> Ret; + if (!MN) { + setError(CurrentNode, "not a mapping"); + return Ret; + } + for (auto &P : MN->Mapping) + Ret.push_back(P.first()); + return Ret; +} + bool Input::preflightKey(const char *Key, bool Required, bool, bool &UseDefault, void *&SaveInfo) { UseDefault = false; @@ -374,8 +386,8 @@ std::unique_ptr<Input::HNode> Input::createHNodes(Node *N) { } bool Input::MapHNode::isValidKey(StringRef Key) { - for (const char *K : ValidKeys) { - if (Key.equals(K)) + for (std::string &K : ValidKeys) { + if (Key == K) return true; } return false; @@ -451,6 +463,10 @@ void Output::endMapping() { StateStack.pop_back(); } +std::vector<StringRef> Output::keys() { + report_fatal_error("invalid call"); +} + bool Output::preflightKey(const char *Key, bool Required, bool SameAsDefault, bool &UseDefault, void *&) { UseDefault = false; |

