This patch is related to https://bugs.llvm.org/show_bug.cgi?id=42967 and it fixes llvm-size's sysv format output by adding a blank line between archieve members
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
The testcases tools/llvm-size/archive.test, tools/llvm-size/multiple-inputs.test and tools/llvm-size/radix.test
fail due to this patch. Could you update this testcases? You can try to execute command "ninja check-all -j32".
llvm/tools/llvm-size/llvm-size.cpp | ||
---|---|---|
449–450 | Put "<< "\n"" in the new line look better. outs() << format... << "\n"; |
Hi, thanks for the reivew and I have updated it with a new patch. However, I'm new to LLVM's review system, I wonder where can I check the status of the testcases, it will be grateful if you can point it out to me.
llvm/tools/llvm-size/llvm-size.cpp | ||
---|---|---|
449 | It should be origin one before any of your changes. |
There shows "Context not available."
Please follow https://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface to upload patch.
LGTM.
But I have tried gnu size, and I found that has two blank lines between archive members.
Here only one blank line.
What's your opinion?
If strictly following to the issue's(recall from https://bugs.llvm.org/show_bug.cgi?id=42967) description, adding one blank line would be enough. But indeed this looks inconsistent with GNU's size in sysv format:
- GNU's size print two blank lines between archive members, this PR prints one
- At end of the file, GNU's size prints no newline(but since last archive member prints two blank lines), llvm-size prints an additional newline at end of file(see line 843-845).
Thus, I think it is better to adjust this PR so llvm-size's behavior is identical with GNU's
I update the patch, now llvm-size's behavior is more(if not 100%) similar to GNU's size:
- two newlines after archive member
- no newline when the archive is empty
llvm/tools/llvm-size/llvm-size.cpp | ||
---|---|---|
579 | Delete else and add a new line as you added return above. |
llvm/test/tools/llvm-size/archive.test | ||
---|---|---|
51 | GNU size prints 2 blank lines. |
llvm/test/tools/llvm-size/archive.test | ||
---|---|---|
51 | I believe this is necessary, see radix.test's case 4-6 |
@MaskRay Hi, could you please review the newest update and commit it if you feel OK about it since looks like I have no commit access
llvm/test/tools/llvm-size/archive.test | ||
---|---|---|
51 | --format=sysv prints exactly two blank lines between two blocks. Your patch currently prints 3. After you fix this, you may need to provide git commit --amend --author "what-is-your-name <what-is@your-email>" |
llvm/test/tools/llvm-size/archive.test | ||
---|---|---|
51 | As you can tell from the patch, there was a SYSV-3-EMPTY in the testcase before this patch. The original code prints no new lines between blocks and to match the newly added 2 newlines, 2 corresponding SYSV-3-EMPTY is needed here. If we remove a SYSV-3-EMPTY here, error will be generated: bash /home/yxd/llvm-project/llvm/test/tools/llvm-size/archive.test:52:16: error: SYSV-3-NEXT: is not on the line after the previous match # SYSV-3-NEXT: archive.test.tmp1 (ex [[ARCHIVE2]]): ^ <stdin>:10:1: note: 'next' match was here archive.test.tmp1 (ex /home/yxd/llvm-project/build/test/tools/llvm-size/Output/archive.test.tmp2.a): ^ <stdin>:8:1: note: previous match ended here ^ <stdin>:9:1: note: non-matching line after previous match is here Although I'm not sure about why there was a SYSV-3-EMPTY here before adding any newlines, it is required here to add the two SYSV-3-EMPTY to pass the test. BTW, I have also verified with custom testcases. |
llvm/test/tools/llvm-size/archive.test | ||
---|---|---|
51 | This is non-archives (single object file). | |
llvm/tools/llvm-size/llvm-size.cpp | ||
826 | Fix here. It prints 3 blank lines. 2 blank lines is from printObjectSectionSizes and 1 blank line from // System V adds an extra newline at the end of each file. if (OutputFormat == sysv) outs() << "\n"; |
The extra newline originally printed is now removed since GNU size print two newlines for single object files
LGTM. Please make sure @Jim is happy with this too.
llvm/tools/llvm-size/llvm-size.cpp | ||
---|---|---|
449–450 | I think this is correct, but to be sure if you haven't already, run git-clang-format on the modified part to verify your formatting choices match the official style (see https://llvm.org/docs/GettingStarted.html#sending-patches). |
llvm/tools/llvm-size/llvm-size.cpp | ||
---|---|---|
579 | I think this change is not needed. If you delete line 842-844. |
llvm/tools/llvm-size/llvm-size.cpp | ||
---|---|---|
449–450 | Thanks for the heads up and I've run the clang-format which put the "\n\n" into a newline |
@Jim Thanks for the review! I wonder is there anything else I have to do before committing the patch? I've used git commit --amend to add author and e-mail and what should I do next. And seems like I have no commit access according to https://llvm.org/docs/Phabricator.html#committing-a-change
@TH3CHARLie
I can commit this for you.
git commit --amend --author="What-is-your-name <What-is-your-email-address>" ?
If you are interested in obtaining commit right. please refer to https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access
Please commit this for me
git commit --amend --author="TH3CHARLie <th3charlie@gmail.com>"
And I am interested in obtaining commit right for future revisions, thank you and I will definitely take a look
GNU size prints 2 blank lines.