summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2017-01-04 20:10:43 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2017-01-04 20:10:43 +0000
commitefdff71b05828054040b7de51c90454b7615134c (patch)
tree83cef2b54f660653bf7a6208aeb33548d121fafb
parent568c113ac0c53a480ca71acbefebcc92973d92d0 (diff)
downloadbcm5719-llvm-efdff71b05828054040b7de51c90454b7615134c.tar.gz
bcm5719-llvm-efdff71b05828054040b7de51c90454b7615134c.zip
YAML: Remove Input::MapHNode::isValidKey(), use llvm::is_contained() instead. NFC.
llvm-svn: 290999
-rw-r--r--llvm/include/llvm/Support/YAMLTraits.h2
-rw-r--r--llvm/lib/Support/YAMLTraits.cpp10
2 files changed, 1 insertions, 11 deletions
diff --git a/llvm/include/llvm/Support/YAMLTraits.h b/llvm/include/llvm/Support/YAMLTraits.h
index 6860eef9a22..cbba9c08275 100644
--- a/llvm/include/llvm/Support/YAMLTraits.h
+++ b/llvm/include/llvm/Support/YAMLTraits.h
@@ -1198,8 +1198,6 @@ private:
typedef llvm::StringMap<std::unique_ptr<HNode>> NameToNode;
- bool isValidKey(StringRef key);
-
NameToNode Mapping;
llvm::SmallVector<std::string, 6> ValidKeys;
};
diff --git a/llvm/lib/Support/YAMLTraits.cpp b/llvm/lib/Support/YAMLTraits.cpp
index 51c016b1d55..9849b3aa1ce 100644
--- a/llvm/lib/Support/YAMLTraits.cpp
+++ b/llvm/lib/Support/YAMLTraits.cpp
@@ -175,7 +175,7 @@ void Input::endMapping() {
if (!MN)
return;
for (const auto &NN : MN->Mapping) {
- if (!MN->isValidKey(NN.first())) {
+ if (!is_contained(MN->ValidKeys, NN.first())) {
setError(NN.second.get(), Twine("unknown key '") + NN.first() + "'");
break;
}
@@ -385,14 +385,6 @@ std::unique_ptr<Input::HNode> Input::createHNodes(Node *N) {
}
}
-bool Input::MapHNode::isValidKey(StringRef Key) {
- for (std::string &K : ValidKeys) {
- if (Key == K)
- return true;
- }
- return false;
-}
-
void Input::setError(const Twine &Message) {
this->setError(CurrentNode, Message);
}
OpenPOWER on IntegriCloud