Currently, yaml2macho doesn't support error handling. This patch helps improve it.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/ObjectYAML/MachOEmitter.cpp | ||
---|---|---|
31 | Perhaps invalid_argument instead of inconvertibleErrorCode()? | |
291 | Here and elsewhere, I don't think you need an assertion if you are reporting an error too. | |
llvm/test/ObjectYAML/MachO/errors.yaml | ||
1 ↗ | (On Diff #266105) | I think these two test cases should each be in their own file, rather than a generic "errors" test file. |
15 ↗ | (On Diff #266105) | Perhaps worth having one entry here, to show that zero entries is not specifically the issue here. |
llvm/lib/ObjectYAML/MachOEmitter.cpp | ||
---|---|---|
31 | nit: not sure if this function is really that necessary, it feels like createStringError is already concise enough. | |
291 | + 1 |
Addressed comments.
- Use errc::invalid_argument instead of inconvertibleErrorCode()
- Remove assertions
- Move test cases to their own test files.
- Modify the Fat MachO test case according to the comment.
Some comment nits, otherwise LGTM. Please wait for @alexshap to confirm too.
llvm/test/ObjectYAML/MachO/fat_macho_i386_x86_64.yaml | ||
---|---|---|
1–6 | generating the -> generating I think canonically it should be "Mach-O" rather than "MachO" here and elsewhere in comments. | |
93 | '##' for comments. | |
llvm/test/ObjectYAML/MachO/sections.yaml | ||
1–5 | "in the MachO object file" -> "in Mach-O object files" I think reads better. | |
335 | "##" |
Perhaps invalid_argument instead of inconvertibleErrorCode()?