Previously jaml2obj would segfault on empty document.
(without yaml description).
Patch fixes the issue.
Differential revision: https://reviews.llvm.org/D38036
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313746
91177308-0d34-0410-b5e6-
96231b3b80d8
Input &>::type
operator>>(Input &yin, T &docMap) {
EmptyContext Ctx;
- yin.setCurrentDocument();
- yamlize(yin, docMap, true, Ctx);
+ if (yin.setCurrentDocument())
+ yamlize(yin, docMap, true, Ctx);
return yin;
}
--- /dev/null
+# RUN: not yaml2obj %s 2>&1 | FileCheck %s
+# CHECK: Unknown document type!