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,15 @@ 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 "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 Index: tools/llvm-ar/llvm-ar.cpp =================================================================== --- tools/llvm-ar/llvm-ar.cpp +++ tools/llvm-ar/llvm-ar.cpp @@ -807,6 +807,11 @@ for (line_iterator I(Ref, /*SkipBlanks*/ true, ';'), E; I != E; ++I) { StringRef Line = *I; StringRef CommandStr, Rest; + std::tie(Line, Rest) = Line.split(';'); + std::tie(Line, Rest) = Line.split('*'); + Line = Line.trim(); + if (Line.empty()) + continue; std::tie(CommandStr, Rest) = Line.split(' '); Rest = Rest.trim(); if (!Rest.empty() && Rest.front() == '"' && Rest.back() == '"')