mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-11 07:18:44 +00:00
[ARM,AArch64] Store source location for values in assembly files
The MCValue class can store a SMLoc to allow better error messages to be emitted if an error is detected after parsing. The ARM and AArch64 assembly parsers were not setting this, so error messages did not have source information. Differential Revision: http://reviews.llvm.org/D14645 llvm-svn: 253219
This commit is contained in:
parent
530ed23589
commit
f095df944b
@ -4131,7 +4131,7 @@ bool AArch64AsmParser::parseDirectiveWord(unsigned Size, SMLoc L) {
|
||||
if (getParser().parseExpression(Value))
|
||||
return true;
|
||||
|
||||
getParser().getStreamer().EmitValue(Value, Size);
|
||||
getParser().getStreamer().EmitValue(Value, Size, L);
|
||||
|
||||
if (getLexer().is(AsmToken::EndOfStatement))
|
||||
break;
|
||||
|
@ -130,7 +130,7 @@ public:
|
||||
/// if necessary.
|
||||
void EmitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) override {
|
||||
EmitDataMappingSymbol();
|
||||
MCELFStreamer::EmitValueImpl(Value, Size);
|
||||
MCELFStreamer::EmitValueImpl(Value, Size, Loc);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -8801,7 +8801,7 @@ bool ARMAsmParser::parseLiteralValues(unsigned Size, SMLoc L) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getParser().getStreamer().EmitValue(Value, Size);
|
||||
getParser().getStreamer().EmitValue(Value, Size, L);
|
||||
|
||||
if (getLexer().is(AsmToken::EndOfStatement))
|
||||
break;
|
||||
|
@ -513,7 +513,7 @@ public:
|
||||
getContext().reportFatalError(Loc, "relocated expression must be 32-bit");
|
||||
|
||||
EmitDataMappingSymbol();
|
||||
MCELFStreamer::EmitValueImpl(Value, Size);
|
||||
MCELFStreamer::EmitValueImpl(Value, Size, Loc);
|
||||
}
|
||||
|
||||
void EmitAssemblerFlag(MCAssemblerFlag Flag) override {
|
||||
|
5
test/MC/AArch64/error-location.s
Normal file
5
test/MC/AArch64/error-location.s
Normal file
@ -0,0 +1,5 @@
|
||||
// RUN: not llvm-mc -triple aarch64--none-eabi -filetype obj < %s -o /dev/null 2>&1 | FileCheck %s
|
||||
|
||||
.text
|
||||
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: symbol 'undef' can not be undefined in a subtraction expression
|
||||
.word (0-undef)
|
5
test/MC/ARM/error-location.s
Normal file
5
test/MC/ARM/error-location.s
Normal file
@ -0,0 +1,5 @@
|
||||
@ RUN: not llvm-mc -triple armv7a--none-eabi -filetype obj < %s -o /dev/null 2>&1 | FileCheck %s
|
||||
|
||||
.text
|
||||
@ CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: symbol 'undef' can not be undefined in a subtraction expression
|
||||
.word (0-undef)
|
Loading…
x
Reference in New Issue
Block a user