summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-ar/llvm-ar.cpp
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2018-09-06 18:10:45 +0000
committerMartin Storsjo <martin@martin.st>2018-09-06 18:10:45 +0000
commit1e8edd13ee60d59a3b9c578f6be0d9a3cf6e1bd2 (patch)
treea5c57b8b7e10f4b04fc2f664fcd6fee03555eb1d /llvm/tools/llvm-ar/llvm-ar.cpp
parentd2c1dd5902782fb773c64dbf4e0b529aa4044b05 (diff)
downloadbcm5719-llvm-1e8edd13ee60d59a3b9c578f6be0d9a3cf6e1bd2.tar.gz
bcm5719-llvm-1e8edd13ee60d59a3b9c578f6be0d9a3cf6e1bd2.zip
[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
Diffstat (limited to 'llvm/tools/llvm-ar/llvm-ar.cpp')
-rw-r--r--llvm/tools/llvm-ar/llvm-ar.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/tools/llvm-ar/llvm-ar.cpp b/llvm/tools/llvm-ar/llvm-ar.cpp
index 16fee89d89d..1751bad5119 100644
--- a/llvm/tools/llvm-ar/llvm-ar.cpp
+++ b/llvm/tools/llvm-ar/llvm-ar.cpp
@@ -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() == '"')
OpenPOWER on IntegriCloud