[yaml2obj] Fixing opening empty yaml files.
authorPuyan Lotfi <puyan@puyan.org>
Thu, 28 Mar 2019 22:55:08 +0000 (22:55 +0000)
committerPuyan Lotfi <puyan@puyan.org>
Thu, 28 Mar 2019 22:55:08 +0000 (22:55 +0000)
commit6c826957532816b4c7d69306aa184372a1c9c698
tree509c4f3026a61a06c7d7bb3b2fc7695dbc520d18
parentda063e64ebc9b1590aaabd80c8b4c4913fab350e
[yaml2obj] Fixing opening empty yaml files.

Essentially echo "" | yaml2obj crashes. This patch attempts to trim whitespace
and determine if the yaml string in the file is empty or not. If the input is
empty then it will not properly print out an error message and return an error
code.

Differential Revision: https://reviews.llvm.org/D59964

A    test/tools/yaml2obj/empty.yaml
M    tools/yaml2obj/yaml2obj.cpp

llvm-svn: 357219
llvm/test/tools/yaml2obj/empty.yaml [new file with mode: 0644]
llvm/tools/yaml2obj/yaml2obj.cpp