diff options
| author | Nick Kledzik <kledzik@apple.com> | 2013-11-14 00:59:59 +0000 |
|---|---|---|
| committer | Nick Kledzik <kledzik@apple.com> | 2013-11-14 00:59:59 +0000 |
| commit | 1e6033ca33c74a305457d5df87a738ee1b43fe79 (patch) | |
| tree | 99ddfb80ca4df43f66f8d7f3c1c074f9e29f7b1e /llvm/lib/Support | |
| parent | 7a2080793e8f45ae69dcd3c191401d43b27eb26b (diff) | |
| download | bcm5719-llvm-1e6033ca33c74a305457d5df87a738ee1b43fe79.tar.gz bcm5719-llvm-1e6033ca33c74a305457d5df87a738ee1b43fe79.zip | |
Add simple support for tags in YAML I/O
llvm-svn: 194644
Diffstat (limited to 'llvm/lib/Support')
| -rw-r--r-- | llvm/lib/Support/YAMLTraits.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/Support/YAMLTraits.cpp b/llvm/lib/Support/YAMLTraits.cpp index 19eaed1ac7a..415424ebed2 100644 --- a/llvm/lib/Support/YAMLTraits.cpp +++ b/llvm/lib/Support/YAMLTraits.cpp @@ -81,6 +81,16 @@ bool Input::setCurrentDocument() { void Input::nextDocument() { ++DocIterator; } + +bool Input::mapTag(StringRef Tag, bool Default) { + StringRef foundTag = CurrentNode->_node->getVerbatimTag(); + if (foundTag.empty()) { + // If no tag found and 'Tag' is the default, say it was found. + return Default; + } + // Return true iff found tag matches supplied tag. + return Tag.equals(foundTag); +} void Input::beginMapping() { if (EC) @@ -381,6 +391,14 @@ void Output::beginMapping() { NeedsNewLine = true; } +bool Output::mapTag(StringRef Tag, bool Use) { + if (Use) { + this->output(" "); + this->output(Tag); + } + return Use; +} + void Output::endMapping() { StateStack.pop_back(); } |

