[PATCH] D51338: [llvm-ar] Support * as comment char in MRI scripts

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 6 11:13:49 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL341571: [llvm-ar] Support * as comment char in MRI scripts (authored by mstorsjo, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D51338?vs=163973&id=164248#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51338

Files:
  llvm/trunk/test/tools/llvm-ar/mri-delete.test
  llvm/trunk/tools/llvm-ar/llvm-ar.cpp


Index: llvm/trunk/tools/llvm-ar/llvm-ar.cpp
===================================================================
--- llvm/trunk/tools/llvm-ar/llvm-ar.cpp
+++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp
@@ -789,9 +789,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: llvm/trunk/test/tools/llvm-ar/mri-delete.test
===================================================================
--- llvm/trunk/test/tools/llvm-ar/mri-delete.test
+++ llvm/trunk/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.164248.patch
Type: text/x-patch
Size: 1657 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180906/d27bb73a/attachment.bin>


More information about the llvm-commits mailing list