When a field is optional we can use the =<none> syntax in macros.
This patch makes Value/Size fields of Symbol optional
and adds test cases for them.
Details
Diff Detail
Event Timeline
llvm/test/tools/obj2yaml/ELF/symbol.yaml | ||
---|---|---|
1 | ||
16 | That's needed or you won't be able to add more documents in the future to the test file, I've discovered. Same below. | |
llvm/test/tools/yaml2obj/ELF/symbol-value-size.yaml | ||
1 | I'm slightly concerned that this test name and purpose is a bit restrictive. Why doesn't it apply to other symbol fields, like type, other or section index? (I'm not saying those tests need adding in this change, but it feels like there's no special reason why value and size are in one test and the others aren't in the same one). | |
3 | Perhaps worth a comment saying something like "show the default size and value is 0". | |
16–17 | ||
30 | ||
36 |
- Addressed review comments.
llvm/test/tools/obj2yaml/ELF/symbol.yaml | ||
---|---|---|
16 | You actually can add documents, you just need to be sure that 2nd and other document has --- !ELF. | |
llvm/test/tools/yaml2obj/ELF/symbol-value-size.yaml | ||
1 | I did it for consistency. Currently we have the following list of tests for symbols: symbol-stother.yaml symbol-type.yaml symbol-binding.yaml symbol-index.yaml symbol-index-invalid.yaml symbol-name.yaml symbol-visibility.yaml Perhaps, we should merge them into a single test in a follow-up. | |
3 | The symbol to "show the default size and value is 0" is aaa, I have the comment for it below. |
llvm/test/tools/yaml2obj/ELF/symbol-value-size.yaml | ||
---|---|---|
1 | Note that value and size are the only llvm::yaml::Hex64 values of a symbol. |
llvm/test/tools/yaml2obj/ELF/symbol-value-size.yaml | ||
---|---|---|
1 | I think it would make sense to either have all fields tested in a single file, or all in separate files. I don't think the hex nature of these ones is sufficient reason for these two to be diffferent. If doing them all in a single file, you could do everything using decimal, and then show that hex can be used too in an additional single case at the end, I guess. | |
3 | Perhaps we don't need the header check at all actually? As it is, it looks like it's verifying something important, but the null entry and symbol count should be covered elsewhere, I reckon. | |
11 | Perhaps --- |
Looks good, with one possible set of suggestions.
llvm/test/tools/yaml2obj/ELF/symbol-size.yaml | ||
---|---|---|
15–16 ↗ | (On Diff #311847) | Up to you, but here and below, you could probably reduce the amount of stuff needed by the test by using regex wildcards/numeric expressions to skip much of the check. For example, see the inline edit. The same technique could probably be used for each of the other cases too, in both tests. |
llvm/test/tools/yaml2obj/ELF/symbol-value.yaml | ||
15–16 ↗ | (On Diff #311847) | Equivalent suggestion to above. |
llvm/test/tools/yaml2obj/ELF/symbol-size.yaml | ||
---|---|---|
15–16 ↗ | (On Diff #311847) | Thanks for the suggestion! I've applied it. |