mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-03 07:38:57 +00:00
[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 llvm-svn: 341571
This commit is contained in:
parent
d2c1dd5902
commit
1e8edd13ee
@ -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
|
||||
|
@ -789,9 +789,14 @@ static void runMRIScript() {
|
||||
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() == '"')
|
||||
|
Loading…
x
Reference in New Issue
Block a user