[PATCH] D51338: [llvm-ar] Support * as comment char in MIR scripts
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 28 00:40:24 PDT 2018
mstorsjo created this revision.
mstorsjo added reviewers: pcc, dmikulin, davide.
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).
Repository:
rL LLVM
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
@@ -807,10 +807,13 @@
for (line_iterator I(Ref, /*SkipBlanks*/ true, ';'), E; I != E; ++I) {
StringRef Line = *I;
StringRef CommandStr, Rest;
+ Line = Line.trim();
std::tie(CommandStr, Rest) = Line.split(' ');
Rest = Rest.trim();
if (!Rest.empty() && Rest.front() == '"' && Rest.back() == '"')
Rest = Rest.drop_front().drop_back();
+ if (CommandStr.startswith(";") || CommandStr.startswith("*"))
+ continue;
auto Command = StringSwitch<MRICommand>(CommandStr.lower())
.Case("addlib", MRICommand::AddLib)
.Case("addmod", MRICommand::AddMod)
Index: test/tools/llvm-ar/mri-delete.test
===================================================================
--- test/tools/llvm-ar/mri-delete.test
+++ test/tools/llvm-ar/mri-delete.test
@@ -3,6 +3,10 @@
RUN: echo "create %t.ar" > %t.mri
RUN: echo "addmod %t.o" >> %t.mri
+RUN: echo "; comment" >> %t.mri
+RUN: echo " ;comment" >> %t.mri
+RUN: echo "* comment" >> %t.mri
+RUN: echo " *comment" >> %t.mri
RUN: echo "addmod %S/Inputs/elf.yaml" >> %t.mri
RUN: echo "delete %t.o" >> %t.mri
RUN: echo "save" >> %t.mri
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51338.162797.patch
Type: text/x-patch
Size: 1321 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180828/4959c76c/attachment.bin>
More information about the llvm-commits
mailing list