Skip to content
Permalink
Browse files

Revert [llvm-ar] Include a line number when failing to parse an MRI s…

…cript

Revert r372309 due to buildbot failures

Differential Revision: https://reviews.llvm.org/D67449

llvm-svn: 372311
  • Loading branch information
Owen Reynolds
Owen Reynolds committed Sep 19, 2019
1 parent cce2342 commit aa03c14827fab3caba6306fc2e5d7f1757230f73
@@ -22,10 +22,10 @@
# RUN: not llvm-ar -M < %t/badlib.mri 2>&1 | FileCheck --check-prefix=PARSE %s
# RUN: not ls %t/badlib.a

# PARSE: error: script line 2: could not parse library
# PARSE: error: could not parse library

## No create command.
# RUN: echo "ADDLIB %t/f.a" > %t/nocreate.mri
# RUN: echo "ADDLIB %t/f.a" > %t/nocreate.mri
# RUN: echo "SAVE" >> %t/nocreate.mri
# RUN: not llvm-ar -M < %t/nocreate.mri

This file was deleted.

@@ -116,19 +116,10 @@ void printHelpMessage() {
outs() << ArHelp;
}

static unsigned MRILineNumber;
static bool ParsingMRIScript;

// Show the error message and exit.
LLVM_ATTRIBUTE_NORETURN static void fail(Twine Error) {
if (ParsingMRIScript) {
WithColor::error(errs(), ToolName)
<< "script line " << MRILineNumber << ": " << Error << "\n";
} else {
WithColor::error(errs(), ToolName) << Error << "\n";
printHelpMessage();
}

WithColor::error(errs(), ToolName) << Error << "\n";
printHelpMessage();
exit(1);
}

@@ -968,10 +959,8 @@ static void runMRIScript() {
const MemoryBuffer &Ref = *Buf.get();
bool Saved = false;
std::vector<NewArchiveMember> NewMembers;
ParsingMRIScript = true;

for (line_iterator I(Ref, /*SkipBlanks*/ false), E; I != E; ++I) {
++MRILineNumber;
StringRef Line = *I;
Line = Line.split(';').first;
Line = Line.split('*').first;
@@ -1033,9 +1022,7 @@ static void runMRIScript() {
fail("unknown command: " + CommandStr);
}
}

ParsingMRIScript = false;


// Nothing to do if not saved.
if (Saved)
performOperation(ReplaceOrInsert, &NewMembers);

0 comments on commit aa03c14

Please sign in to comment.
You can’t perform that action at this time.