mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-29 10:32:47 +00:00
llvm-mc: Make sure we exit != 0 if any errors are encountered.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113551 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
61ca48e0da
commit
93bd4d1e6b
@ -102,6 +102,9 @@ private:
|
|||||||
/// Boolean tracking whether macro substitution is enabled.
|
/// Boolean tracking whether macro substitution is enabled.
|
||||||
unsigned MacrosEnabled : 1;
|
unsigned MacrosEnabled : 1;
|
||||||
|
|
||||||
|
/// Flag tracking whether any errors have been encountered.
|
||||||
|
unsigned HadError : 1;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AsmParser(const Target &T, SourceMgr &SM, MCContext &Ctx, MCStreamer &Out,
|
AsmParser(const Target &T, SourceMgr &SM, MCContext &Ctx, MCStreamer &Out,
|
||||||
const MCAsmInfo &MAI);
|
const MCAsmInfo &MAI);
|
||||||
@ -304,6 +307,7 @@ void AsmParser::Warning(SMLoc L, const Twine &Msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool AsmParser::Error(SMLoc L, const Twine &Msg) {
|
bool AsmParser::Error(SMLoc L, const Twine &Msg) {
|
||||||
|
HadError = true;
|
||||||
PrintMessage(L, Msg.str(), "error");
|
PrintMessage(L, Msg.str(), "error");
|
||||||
PrintMacroInstantiations();
|
PrintMacroInstantiations();
|
||||||
return true;
|
return true;
|
||||||
@ -362,16 +366,16 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
|
|||||||
// Prime the lexer.
|
// Prime the lexer.
|
||||||
Lex();
|
Lex();
|
||||||
|
|
||||||
bool HadError = false;
|
HadError = false;
|
||||||
|
|
||||||
AsmCond StartingCondState = TheCondState;
|
AsmCond StartingCondState = TheCondState;
|
||||||
|
|
||||||
// While we have input, parse each statement.
|
// While we have input, parse each statement.
|
||||||
while (Lexer.isNot(AsmToken::Eof)) {
|
while (Lexer.isNot(AsmToken::Eof)) {
|
||||||
if (!ParseStatement()) continue;
|
if (!ParseStatement()) continue;
|
||||||
|
|
||||||
// We had an error, remember it and recover by skipping to the next line.
|
// We had an error, validate that one was emitted and recover by skipping to
|
||||||
HadError = true;
|
// the next line.
|
||||||
|
assert(HadError && "Parse statement returned an error, but none emitted!");
|
||||||
EatToEndOfStatement();
|
EatToEndOfStatement();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,10 +387,8 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
|
|||||||
const std::vector<MCDwarfFile *> &MCDwarfFiles =
|
const std::vector<MCDwarfFile *> &MCDwarfFiles =
|
||||||
getContext().getMCDwarfFiles();
|
getContext().getMCDwarfFiles();
|
||||||
for (unsigned i = 1; i < MCDwarfFiles.size(); i++) {
|
for (unsigned i = 1; i < MCDwarfFiles.size(); i++) {
|
||||||
if (!MCDwarfFiles[i]){
|
if (!MCDwarfFiles[i])
|
||||||
TokError("unassigned file number: " + Twine(i) + " for .file directives");
|
TokError("unassigned file number: " + Twine(i) + " for .file directives");
|
||||||
HadError = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finalize the output stream if there are no errors and if the client wants
|
// Finalize the output stream if there are no errors and if the client wants
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# RUN: llvm-mc -triple i386-unknown-unknown %s 2> %t
|
# RUN: not llvm-mc -triple i386-unknown-unknown %s 2> %t
|
||||||
# RUN: FileCheck -input-file %t %s
|
# RUN: FileCheck -input-file %t %s
|
||||||
|
|
||||||
# CHECK: error: .abort 'please stop assembing'
|
# CHECK: error: .abort 'please stop assembing'
|
||||||
|
Loading…
Reference in New Issue
Block a user