- Expand the "Name" column past 13 characters when any of the section names are longer. Current behavior is a staggard output instead of a nice table if a single name is longer.
- Only print the required number of hex chars for addresses (i.e. 8 characters for 32-bit, 16 characters for 64-bit)
- Fix trailing spaces
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 39422 Build 39440: arc lint + arc unit
Event Timeline
llvm/test/tools/llvm-objdump/section-headers-address-width.test | ||
---|---|---|
10 ↗ | (On Diff #224163) | I wonder, should we be able to shrink it too? Something like: Instead of a current (if I understand it right) |
37 ↗ | (On Diff #224163) | nit: We are often reducing the identation to a single space after the longest tag. Just like you have for FileHeader |
38 ↗ | (On Diff #224163) | nit: you can remove '...' |
llvm/test/tools/llvm-objdump/section-headers-name-width.test | ||
2 ↗ | (On Diff #224163) | nit: missing empty line after comment. |
4 ↗ | (On Diff #224163) | You are not using --show-lma it seems? I.e. I am not sure why do you need this test. |
16 ↗ | (On Diff #224163) | nit: We often add a short comment for each test in addition to a file comment. |
llvm/test/tools/llvm-objdump/section-headers-spacing.test | ||
1 ↗ | (On Diff #224163) | What do you think about combining these tests you have here into one that |
llvm/tools/llvm-objdump/llvm-objdump.cpp | ||
1653 | getMaxSectionNameWidth? | |
1694 | May be I'd try to avoid using an additional vector and algorithm here and just: std::string Type = Section.isText() ? "TEXT" : ""; if (Section.isData()) Type += Type.empty() ? "DATA" : " DATA"; if (Section.isBSS()) Type += Type.empty() ? "BSS" : " BSS"; |
llvm/test/tools/llvm-objdump/section-headers-address-width.test | ||
---|---|---|
10 ↗ | (On Diff #224163) | 13 is chosen to make the output match GNU objdump. Having a cutoff (not necessarily 13, but any number around there) also makes the formatting stable for objects with regular-length section names. |
llvm/test/tools/llvm-objdump/section-headers-name-width.test | ||
4 ↗ | (On Diff #224163) | Added a comment -- the reason is just that it goes down a different code path, e.g. would catch a bad implementation like: if (ShowLMA) outs() << "Name " << ... // Oops, didn't use left_justify else outs() << left_justify("Name", NameWidth) << ... |
llvm/test/tools/llvm-objdump/section-headers-spacing.test | ||
1 ↗ | (On Diff #224163) | I started out with one test file, but found it to be a collection of somewhat unrelated things -- e.g. name column width and 32 vs 64 bit column widths are different features. So I think it's better to have more focused test files. It's a slightly personal preference though. |
llvm/tools/llvm-objdump/llvm-objdump.cpp | ||
1694 | I think the lack of using an algorithm is why there was odd trailing whitespace before, although I agree it would be great if this could be more succinct... |
- Remove yaml ... separators
- Whitespace changes
- Add more test comments
- Rename to getMaxSectionNameWidth
- Fix yaml spacing
- Remove some unnecessary yaml fields
llvm/test/tools/llvm-objdump/section-headers-spacing.test | ||
---|---|---|
1 ↗ | (On Diff #224163) | We often combine tests by a feature. I.e. test that checks the "-h" output might contain everything related to "-h" at once. Sometimes we do a split to make a test that contain only a error/warnings checks (if there are too many of them) or a particular set of tests that are very different. It is not a huge problem, but might be interesting what others think about this too though. |
llvm/tools/llvm-objdump/llvm-objdump.cpp | ||
1694 | But does my version has a trailing whitespace issue? I think no. |
- Merge tests
- Avoid llvm::join() call
llvm/test/tools/llvm-objdump/section-headers-spacing.test | ||
---|---|---|
1 ↗ | (On Diff #224163) | I don't have that strong of preference either, so merged. My only concern is now it's on the larger end of test sizes (7th of all objdump tests per find llvm/test/tools/llvm-objdump/ -name '*.test' | xargs wc -l | sort -nr | tail +2 | head -10), but it's still not excessively long. |
llvm/test/tools/llvm-objdump/section-headers.test | ||
---|---|---|
8 | No need to change this, but rather than using {{^}} and {{$}} you could have used --match-full-lines instead. Combined with --strict-whitespace, this will ensure that the line checked matches exactly the specified string. The downside is the lack of a space after the FileCheck pattern name, but you can solve that with additional spacing: # WHITESPACE:Sections: # WHITESPACE-NEXT:Idx Name or (I think, though not tested): # WHITESPACE :Sections: # WHITESPACE-NEXT:Idx Name |
No need to change this, but rather than using {{^}} and {{$}} you could have used --match-full-lines instead. Combined with --strict-whitespace, this will ensure that the line checked matches exactly the specified string. The downside is the lack of a space after the FileCheck pattern name, but you can solve that with additional spacing:
or (I think, though not tested):