[PATCH] D38036: [yaml2obj] - Don't crash on invalid document.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 20 02:58:58 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL313746: [yaml2obj] - Don't crash on invalid document. (authored by grimar).
Changed prior to commit:
https://reviews.llvm.org/D38036?vs=115836&id=115978#toc
Repository:
rL LLVM
https://reviews.llvm.org/D38036
Files:
llvm/trunk/include/llvm/Support/YAMLTraits.h
llvm/trunk/test/Object/yaml2obj-invalid.yaml
Index: llvm/trunk/include/llvm/Support/YAMLTraits.h
===================================================================
--- llvm/trunk/include/llvm/Support/YAMLTraits.h
+++ llvm/trunk/include/llvm/Support/YAMLTraits.h
@@ -1418,8 +1418,8 @@
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;
}
Index: llvm/trunk/test/Object/yaml2obj-invalid.yaml
===================================================================
--- llvm/trunk/test/Object/yaml2obj-invalid.yaml
+++ llvm/trunk/test/Object/yaml2obj-invalid.yaml
@@ -0,0 +1,2 @@
+# RUN: not yaml2obj %s 2>&1 | FileCheck %s
+# CHECK: Unknown document type!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38036.115978.patch
Type: text/x-patch
Size: 812 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170920/1af25891/attachment.bin>
More information about the llvm-commits
mailing list