When using the L option to quick append a full archive to a thin archive, the thin archive was being wrongly converted to a full archive. I've fixed the issue and added a check for it in thin-to-full-archive.test and expanded some tests.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
The following tests have been modified:
- flatten-thin-archive.test now explicitly checks that %t.a is thin after the other archives have been added.
- full-to-thin-archive.test uses Inputs/a.txt as an input rather than itself as spurious passes could have occurred when looking for strings contained in the archive file. Corrected a comment, added a test case for an existing archive and a case attempting to convert an existing archive.
- thin-to-full-archive.test now tests the contents to ensure the thin archives member have been added and not the archive itself. Added a test case for an existing archive and a case attempting to convert an existing archive.
llvm/test/tools/llvm-ar/full-to-thin-archive.test | ||
---|---|---|
11 ↗ | (On Diff #420553) | |
15 ↗ | (On Diff #420553) | You've used the term "full archive" here and in the comment above, but simply "archive" in other places. Be consistent, use one version. FWIW, the error message is "regular archive". |
24 ↗ | (On Diff #420553) | I recommend checking the error message here. |
llvm/test/tools/llvm-ar/thin-to-full-archive.test | ||
28 ↗ | (On Diff #420553) | This isn't used anywhere. Did you mean FULL-NOT? If so, I'd recommend instead adding --implicit-check-not=thin.a to the FileCheck command, since NOT matches are order-sensitive. |
32 ↗ | (On Diff #420553) | Also elsewhere with other comments. |
llvm/tools/llvm-ar/llvm-ar.cpp | ||
1031–1032 | I've not looked at the full code paths, but at an educated guess, moving this code here will cause this error to occur in other cases which don't add new members, such as t operations? Is that desirable (I'm inclined to say so, but at least want to flag up the possibility of an issue)? |
Corrected comments including replacing use of "full archive" with "regular archive" as suggested. To remain consistent two tests have been renamed to use the term "regular". The checks for "thinness" in llvm-ar.cpp now only applies for write commands.
Good idea @MaskRay, I've split that into https://reviews.llvm.org/D123778 and will update this one when D123778 is complete.
There is no particular reason to wait - you could rebase this patch on top of that one, so that this patch doesn't include the other changes that will have already landed. To indicate that this patch isn't intended as a standalone patch, you then use the "Edit Related Revisions" UI option to the right of hte patch description.
Holding off approving until that's happen, as it would be easier for me to review exactly what this patch is finally doing.
llvm/tools/llvm-ar/llvm-ar.cpp | ||
---|---|---|
1031–1032 | Is there a test case you could add that would have failed with the previous version of this patch? |
llvm/tools/llvm-ar/llvm-ar.cpp | ||
---|---|---|
1031–1032 | Added to regular-to-thin-archive.test. |
llvm/test/tools/llvm-ar/regular-to-thin-archive.test | ||
---|---|---|
28 | Nit: I'd delete this blank line, since the line before is strongly tied to the lines immediately after. | |
llvm/test/tools/llvm-ar/thin-to-regular-archive.test | ||
34 | This test is failing the premerge checks, presumably because of the out-of-date %tfull2.a name. | |
36 | Nit: consistency between singular versus plural. |
Nit: I'd delete this blank line, since the line before is strongly tied to the lines immediately after.