[PATCH] D34116: Fix YAML traits for sequence types (NFC)

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 12 12:34:05 PDT 2017


eugenis created this revision.
Herald added a subscriber: fhahn.

The type might not have begin() and end() methods.


Repository:
  rL LLVM

https://reviews.llvm.org/D34116

Files:
  include/llvm/Support/YAMLTraits.h


Index: include/llvm/Support/YAMLTraits.h
===================================================================
--- include/llvm/Support/YAMLTraits.h
+++ include/llvm/Support/YAMLTraits.h
@@ -658,7 +658,8 @@
   typename std::enable_if<has_SequenceTraits<T>::value, void>::type
   mapOptionalWithContext(const char *Key, T &Val, Context &Ctx) {
     // omit key/value instead of outputting empty sequence
-    if (this->canElideEmptySequence() && !(Val.begin() != Val.end()))
+    if (this->canElideEmptySequence() &&
+        SequenceTraits<T>::size(*this, Val) == 0)
       return;
     this->processKey(Key, Val, false, Ctx);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34116.102229.patch
Type: text/x-patch
Size: 630 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170612/a8e19ea6/attachment.bin>


More information about the llvm-commits mailing list