[PATCH] D51338: [llvm-ar] Support * as comment char in MRI scripts
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 4 22:16:13 PDT 2018
mstorsjo updated this revision to Diff 163973.
mstorsjo added a comment.
Avoided needless use of `std::tie`, passing `SkipBlanks = false` as we handle that skipping locally anyway now.
https://reviews.llvm.org/D51338
Files:
test/tools/llvm-ar/mri-delete.test
tools/llvm-ar/llvm-ar.cpp
Index: tools/llvm-ar/llvm-ar.cpp
===================================================================
--- tools/llvm-ar/llvm-ar.cpp
+++ tools/llvm-ar/llvm-ar.cpp
@@ -804,9 +804,14 @@
std::vector<std::unique_ptr<MemoryBuffer>> ArchiveBuffers;
std::vector<std::unique_ptr<object::Archive>> Archives;
- for (line_iterator I(Ref, /*SkipBlanks*/ true, ';'), E; I != E; ++I) {
+ for (line_iterator I(Ref, /*SkipBlanks*/ false), E; I != E; ++I) {
StringRef Line = *I;
StringRef CommandStr, Rest;
+ Line = Line.split(';').first;
+ Line = Line.split('*').first;
+ Line = Line.trim();
+ if (Line.empty())
+ continue;
std::tie(CommandStr, Rest) = Line.split(' ');
Rest = Rest.trim();
if (!Rest.empty() && Rest.front() == '"' && Rest.back() == '"')
Index: test/tools/llvm-ar/mri-delete.test
===================================================================
--- test/tools/llvm-ar/mri-delete.test
+++ test/tools/llvm-ar/mri-delete.test
@@ -1,11 +1,17 @@
RUN: yaml2obj %S/Inputs/elf.yaml -o %t.o
RUN: rm -f %t.ar
-RUN: echo "create %t.ar" > %t.mri
-RUN: echo "addmod %t.o" >> %t.mri
+RUN: echo "create %t.ar;comment" > %t.mri
+RUN: echo "addmod %t.o * comment" >> %t.mri
+RUN: echo "; comment" >> %t.mri
+RUN: echo " ;comment" >> %t.mri
+RUN: echo "* comment" >> %t.mri
+RUN: echo " *comment" >> %t.mri
+RUN: echo "" >> %t.mri
+RUN: echo " " >> %t.mri
RUN: echo "addmod %S/Inputs/elf.yaml" >> %t.mri
RUN: echo "delete %t.o" >> %t.mri
-RUN: echo "save" >> %t.mri
+RUN: echo " save" >> %t.mri
RUN: echo "end" >> %t.mri
RUN: llvm-ar -M < %t.mri
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51338.163973.patch
Type: text/x-patch
Size: 1591 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180905/17b5e83e/attachment.bin>
More information about the llvm-commits
mailing list