Skip to content

Commit 6a52127

Browse files
committed
Add error and correct EndLoc
1 parent b59becf commit 6a52127

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,19 +2154,23 @@ ParseStatus RISCVAsmParser::parsePseudoQCJumpSymbol(OperandVector &Operands) {
21542154

21552155
if (getLexer().getKind() != AsmToken::Identifier)
21562156
return ParseStatus::NoMatch;
2157+
21572158
std::string Identifier(getTok().getIdentifier());
2159+
SMLoc E = SMLoc::getFromPointer(S.getPointer() + Identifier.size());
21582160

21592161
if (getLexer().peekTok().is(AsmToken::At)) {
21602162
Lex();
21612163
Lex();
2164+
SMLoc PLTLoc = getLoc();
21622165
StringRef PLT;
21632166
if (getParser().parseIdentifier(PLT) || PLT != "plt")
2164-
return ParseStatus::Failure;
2167+
return Error(PLTLoc,
2168+
"'@plt' is the only valid operand for this instruction");
2169+
E = SMLoc::getFromPointer(S.getPointer() + /*@plt*/ 4);
21652170
} else {
21662171
Lex();
21672172
}
21682173

2169-
SMLoc E = SMLoc::getFromPointer(S.getPointer() + Identifier.size());
21702174
RISCVMCExpr::Specifier Kind = RISCVMCExpr::VK_QC_E_JUMP_PLT;
21712175

21722176
MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);

llvm/test/MC/RISCV/xqcilb-invalid.s

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ qc.e.jal 2147483649
2222

2323
# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilb' (Qualcomm uC Long Branch Extension)
2424
qc.e.jal 2147483640
25+
26+
# CHECK: :[[@LINE+1]]:12: error: '@plt' is the only valid operand for this instruction
27+
qc.e.j foo@rlt

0 commit comments

Comments
 (0)