llvm.org GIT mirror llvm / 9d561f5
[llvm-ar] Support * as comment char in MRI scripts MRI scripts have two comment chars, * and ;, but only the latter was supported before. Also allow leading spaces before comment chars (and before any command string), and allow comments after a command. Differential Revision: https://reviews.llvm.org/D51338 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341571 91177308-0d34-0410-b5e6-96231b3b80d8 Martin Storsjo 11 months ago
2 changed file(s) with 15 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
0 RUN: yaml2obj %S/Inputs/elf.yaml -o %t.o
11 RUN: rm -f %t.ar
22
3 RUN: echo "create %t.ar" > %t.mri
4 RUN: echo "addmod %t.o" >> %t.mri
3 RUN: echo "create %t.ar;comment" > %t.mri
4 RUN: echo "addmod %t.o * comment" >> %t.mri
5 RUN: echo "; comment" >> %t.mri
6 RUN: echo " ;comment" >> %t.mri
7 RUN: echo "* comment" >> %t.mri
8 RUN: echo " *comment" >> %t.mri
9 RUN: echo "" >> %t.mri
10 RUN: echo " " >> %t.mri
511 RUN: echo "addmod %S/Inputs/elf.yaml" >> %t.mri
612 RUN: echo "delete %t.o" >> %t.mri
7 RUN: echo "save" >> %t.mri
13 RUN: echo " save" >> %t.mri
814 RUN: echo "end" >> %t.mri
915
1016 RUN: llvm-ar -M < %t.mri
788788 std::vector> ArchiveBuffers;
789789 std::vector> Archives;
790790
791 for (line_iterator I(Ref, /*SkipBlanks*/ true, ';'), E; I != E; ++I) {
791 for (line_iterator I(Ref, /*SkipBlanks*/ false), E; I != E; ++I) {
792792 StringRef Line = *I;
793793 StringRef CommandStr, Rest;
794 Line = Line.split(';').first;
795 Line = Line.split('*').first;
796 Line = Line.trim();
797 if (Line.empty())
798 continue;
794799 std::tie(CommandStr, Rest) = Line.split(' ');
795800 Rest = Rest.trim();
796801 if (!Rest.empty() && Rest.front() == '"' && Rest.back() == '"')