summaryrefslogtreecommitdiffstats
path: root/llvm/tools/yaml2obj/yaml2macho.cpp
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2016-05-19 23:26:31 +0000
committerChris Bieneman <beanz@apple.com>2016-05-19 23:26:31 +0000
commit1abf005fe60649acbbbc46363bcd30e3395561eb (patch)
treed13f95a421b9d57245beb00b9d22c3983cf8f7e1 /llvm/tools/yaml2obj/yaml2macho.cpp
parent45bd7ca7fc5e70daf8da46d85a58a9272380f8ec (diff)
downloadbcm5719-llvm-1abf005fe60649acbbbc46363bcd30e3395561eb.tar.gz
bcm5719-llvm-1abf005fe60649acbbbc46363bcd30e3395561eb.zip
[yaml2obj] Removing debug code that scribbled 0xDEADBEEF
Now that MachO load command fields are fully covered we can fill unaccounted for bytes with 0. That allows us to sparsely specify YAML to simplify tests. Simplifying load_commands test accordingly. llvm-svn: 270158
Diffstat (limited to 'llvm/tools/yaml2obj/yaml2macho.cpp')
-rw-r--r--llvm/tools/yaml2obj/yaml2macho.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/tools/yaml2obj/yaml2macho.cpp b/llvm/tools/yaml2obj/yaml2macho.cpp
index 2a1c6a7e9d2..6d71eef67bc 100644
--- a/llvm/tools/yaml2obj/yaml2macho.cpp
+++ b/llvm/tools/yaml2obj/yaml2macho.cpp
@@ -182,13 +182,12 @@ Error MachOWriter::writeLoadCommands(raw_ostream &OS) {
BytesWritten += LC.ZeroPadBytes;
}
+ // Fill remaining bytes with 0. This will only get hit in partially
+ // specified test cases.
auto BytesRemaining = LC.Data.load_command_data.cmdsize - BytesWritten;
if (BytesRemaining > 0) {
- // TODO: Replace all this once the load command data is present in yaml.
- // For now I fill with 0xDEADBEEF because it is easy to spot on a hex
- // viewer.
std::vector<uint32_t> FillData;
- FillData.insert(FillData.begin(), BytesRemaining / 4 + 1, 0xDEADBEEFu);
+ FillData.insert(FillData.begin(), BytesRemaining, 0);
OS.write(reinterpret_cast<char *>(FillData.data()), BytesRemaining);
}
}
OpenPOWER on IntegriCloud