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 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> ArchiveBuffers; std::vector> 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() == '"')