As per bug 40244, fixed an error where the error message was repeated.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Thanks for looking at this! Could you update the bug with a reference to this review, please? Do you plan on fixing the other message(s) in performOperation ("file not found" at least)?
llvm/test/tools/llvm-ar/invalid-binary-file.test | ||
---|---|---|
1 ↗ | (On Diff #218219) | Could you add '#' (or even '##' to be consistent with our new tests in the LLVM binutils) here, to make the comment stand out more, please? Some wording improvement suggestions: |
7 ↗ | (On Diff #218219) | If you change this to CHECK-NOT: {{.}}, FileCheck will show that there is no output remaining at all. This ensures that you don't have other garbage at the end of the message (like an extra full stop or exclamation mark). To go with this, you should probably add 'c' to the options passed to llvm-ar (i.e. make it 'llvm-ar rc') to suppress any possible archive creation message that might be printed. |
llvm/tools/llvm-ar/llvm-ar.cpp | ||
930–931 ↗ | (On Diff #218219) | While you're here, how do you feel about getting rid of the errorToErrorCode call above and just passing in Err? I think the ultimate result is the same, but it saves a line of code, and allows for richer error messages (I see that the Archive constructor actually produces quite a number of semi-complex error messages that this code loses). If you'd prefer not to do this now, or to do this and any other similar tidy-ups in a later change, that's fine with me. |
I have updated the patch after comments.
- If the file is not found, it does not have the same problem of the error repeated twice.
- Fail() calls printHelpMessage() and there seems to be no way to suppress that. I have attempted to pipe output to /dev/null (to get rid of the help message) but I am afraid that this might be Unix only.
Thank you for your time and help!
llvm/test/tools/llvm-ar/invalid-object-file.test | ||
---|---|---|
4 ↗ | (On Diff #220254) | Get rid of the -allow-empty. It's unnecessary, as an empty output is incorrect. |
9 ↗ | (On Diff #220254) | You don't need to do this here. However, at the start of the test, you should delete the file. |
llvm/tools/llvm-ar/llvm-ar.cpp | ||
930 ↗ | (On Diff #220254) | Since this ends up as "error: error loading ...", perhaps change "error loading" to "unable to load". |
llvm/test/tools/llvm-ar/invalid-object-file.test | ||
---|---|---|
7 ↗ | (On Diff #220420) | You'll have to rebase, error messages are no longer capitalized, i.e. File -> file |