aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2013-08-15 23:17:53 +0000
committerAaron Ballman <aaron@aaronballman.com>2013-08-15 23:17:53 +0000
commitd5f33aa33fbf865e15a3dced11b847e88f6a8239 (patch)
tree65d3258017f450661a509f07c4553aa4609aff93 /include
parenta630cb032cc09aaec92fa4ce26891abfa7fa1348 (diff)
downloadexternal_llvm-d5f33aa33fbf865e15a3dced11b847e88f6a8239.zip
external_llvm-d5f33aa33fbf865e15a3dced11b847e88f6a8239.tar.gz
external_llvm-d5f33aa33fbf865e15a3dced11b847e88f6a8239.tar.bz2
Tighten up the yamilizer so it stops eliding empty sequences if the embedded empty sequence is the first key/value in a map which is itself in a sequence.
Patch with help from Nick Kledzik. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188508 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Support/YAMLTraits.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/llvm/Support/YAMLTraits.h b/include/llvm/Support/YAMLTraits.h
index 0f57f44..98964fc 100644
--- a/include/llvm/Support/YAMLTraits.h
+++ b/include/llvm/Support/YAMLTraits.h
@@ -323,6 +323,7 @@ public:
virtual bool preflightElement(unsigned, void *&) = 0;
virtual void postflightElement(void*) = 0;
virtual void endSequence() = 0;
+ virtual bool canElideEmptySequence() = 0;
virtual unsigned beginFlowSequence() = 0;
virtual bool preflightFlowElement(unsigned, void *&) = 0;
@@ -388,7 +389,7 @@ public:
typename llvm::enable_if_c<has_SequenceTraits<T>::value,void>::type
mapOptional(const char* Key, T& Val) {
// omit key/value instead of outputting empty sequence
- if ( this->outputting() && !(Val.begin() != Val.end()) )
+ if ( this->canElideEmptySequence() && !(Val.begin() != Val.end()) )
return;
this->processKey(Key, Val, false);
}
@@ -715,6 +716,7 @@ private:
virtual void endBitSetScalar();
virtual void scalarString(StringRef &);
virtual void setError(const Twine &message);
+ virtual bool canElideEmptySequence();
class HNode {
public:
@@ -837,7 +839,7 @@ public:
virtual void endBitSetScalar();
virtual void scalarString(StringRef &);
virtual void setError(const Twine &message);
-
+ virtual bool canElideEmptySequence();
public:
// These are only used by operator<<. They could be private
// if that templated operator could be made a friend.