summaryrefslogtreecommitdiff
path: root/tools/yaml2obj/yaml2coff.cpp
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2016-06-27 19:53:53 +0000
committerChris Bieneman <beanz@apple.com>2016-06-27 19:53:53 +0000
commit9cf90e65d1f24d5151576d5e522f150fd3b3c56a (patch)
treee9c00a3f8fe71f87c048379bae69944472499469 /tools/yaml2obj/yaml2coff.cpp
parent1d88d3b08d331bc09e61697fa4d8c80402cd15e6 (diff)
[yaml2obj] Remove --format option in favor of YAML tags
Summary: Our YAML library's handling of tags isn't perfect, but it is good enough to get rid of the need for the --format argument to yaml2obj. This patch does exactly that. Instead of requiring --format, it infers the format based on the tags found in the object file. The supported tags are: !ELF !COFF !mach-o !fat-mach-o I have a corresponding patch that is quite large that fixes up all the in-tree test cases. Reviewers: rafael, Bigcheese, compnerd, silvas Subscribers: compnerd, llvm-commits Differential Revision: http://reviews.llvm.org/D21711 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273915 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/yaml2obj/yaml2coff.cpp')
-rw-r--r--tools/yaml2obj/yaml2coff.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/tools/yaml2obj/yaml2coff.cpp b/tools/yaml2obj/yaml2coff.cpp
index 1a1d07d7944..8f3f5217952 100644
--- a/tools/yaml2obj/yaml2coff.cpp
+++ b/tools/yaml2obj/yaml2coff.cpp
@@ -18,7 +18,7 @@
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Object/COFF.h"
-#include "llvm/ObjectYAML/COFFYAML.h"
+#include "llvm/ObjectYAML/ObjectYAML.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
@@ -532,14 +532,7 @@ static bool writeCOFF(COFFParser &CP, raw_ostream &OS) {
return true;
}
-int yaml2coff(yaml::Input &YIn, raw_ostream &Out) {
- COFFYAML::Object Doc;
- YIn >> Doc;
- if (YIn.error()) {
- errs() << "yaml2obj: Failed to parse YAML file!\n";
- return 1;
- }
-
+int yaml2coff(llvm::COFFYAML::Object &Doc, raw_ostream &Out) {
COFFParser CP(Doc);
if (!CP.parse()) {
errs() << "yaml2obj: Failed to parse YAML file!\n";