OSDN Git Service

Handle spaces and quotes in file names in MRI scripts.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 22 Oct 2014 03:10:56 +0000 (03:10 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 22 Oct 2014 03:10:56 +0000 (03:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220364 91177308-0d34-0410-b5e6-96231b3b80d8

test/Object/mri-addmod.test
tools/llvm-ar/llvm-ar.cpp

index 3a59a3b..0e9e679 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: echo create %t.a > %t.mri
-; RUN: echo addmod %p/Inputs/trivial-object-test.elf-x86-64 >> %t.mri
+; RUN: echo "addmod  \"%p/Inputs/trivial-object-test.elf-x86-64\" " >> %t.mri
 ; RUN: echo save >> %t.mri
 ; RUN: echo end >> %t.mri
 
index 8411a1d..6858a94 100644 (file)
@@ -961,6 +961,9 @@ static void runMRIScript() {
     StringRef Line = *I;
     StringRef CommandStr, Rest;
     std::tie(CommandStr, Rest) = Line.split(' ');
+    Rest = Rest.trim();
+    if (!Rest.empty() && Rest.front() == '"' && Rest.back() == '"')
+      Rest = Rest.drop_front().drop_back();
     auto Command = StringSwitch<MRICommand>(CommandStr.lower())
                        .Case("addlib", MRICommand::AddLib)
                        .Case("addmod", MRICommand::AddMod)