From: Rafael Espindola Date: Wed, 22 Oct 2014 03:10:56 +0000 (+0000) Subject: Handle spaces and quotes in file names in MRI scripts. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=230b53fd1bab3b4667e85f6c22817bdd3cb87a2a Handle spaces and quotes in file names in MRI scripts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220364 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Object/mri-addmod.test b/test/Object/mri-addmod.test index 3a59a3bbd96..0e9e67924ff 100644 --- a/test/Object/mri-addmod.test +++ b/test/Object/mri-addmod.test @@ -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 diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp index 8411a1dad47..6858a94b36b 100644 --- a/tools/llvm-ar/llvm-ar.cpp +++ b/tools/llvm-ar/llvm-ar.cpp @@ -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(CommandStr.lower()) .Case("addlib", MRICommand::AddLib) .Case("addmod", MRICommand::AddMod)