diff --git a/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h b/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h --- a/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h +++ b/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h @@ -482,7 +482,7 @@ } // For actions that have to be performed before a label is emitted - virtual void doBeforeLabelEmit(MCSymbol *Symbol) {} + virtual void doBeforeLabelEmit(MCSymbol *Symbol, SMLoc IDLoc) {} virtual void onLabelParsed(MCSymbol *Symbol) {} diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -1952,7 +1952,7 @@ if (discardLTOSymbol(IDVal)) return false; - getTargetParser().doBeforeLabelEmit(Sym); + getTargetParser().doBeforeLabelEmit(Sym, IDLoc); // Emit the label. if (!getTargetParser().isParsingMSInlineAsm()) @@ -6256,7 +6256,7 @@ ? LabelVal.upper() : LabelVal); - getTargetParser().doBeforeLabelEmit(Sym); + getTargetParser().doBeforeLabelEmit(Sym, LabelLoc); // Emit the label. Out.emitLabel(Sym, LabelLoc); diff --git a/llvm/lib/MC/MCParser/MasmParser.cpp b/llvm/lib/MC/MCParser/MasmParser.cpp --- a/llvm/lib/MC/MCParser/MasmParser.cpp +++ b/llvm/lib/MC/MCParser/MasmParser.cpp @@ -2278,7 +2278,7 @@ Lex(); } - getTargetParser().doBeforeLabelEmit(Sym); + getTargetParser().doBeforeLabelEmit(Sym, IDLoc); // Emit the label. if (!getTargetParser().isParsingMSInlineAsm()) diff --git a/llvm/lib/MC/MCParser/WasmAsmParser.cpp b/llvm/lib/MC/MCParser/WasmAsmParser.cpp --- a/llvm/lib/MC/MCParser/WasmAsmParser.cpp +++ b/llvm/lib/MC/MCParser/WasmAsmParser.cpp @@ -207,7 +207,7 @@ // TODO: This function is almost the same as ELFAsmParser::ParseDirectiveSize // so maybe could be shared somehow. - bool parseDirectiveSize(StringRef, SMLoc) { + bool parseDirectiveSize(StringRef, SMLoc Loc) { StringRef Name; if (Parser->parseIdentifier(Name)) return TokError("expected identifier in directive"); diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -734,7 +734,7 @@ void ReportNearMisses(SmallVectorImpl &NearMisses, SMLoc IDLoc, OperandVector &Operands); - void doBeforeLabelEmit(MCSymbol *Symbol) override; + void doBeforeLabelEmit(MCSymbol *Symbol, SMLoc IDLoc) override; void onLabelParsed(MCSymbol *Symbol) override; }; @@ -11184,7 +11184,7 @@ return false; } -void ARMAsmParser::doBeforeLabelEmit(MCSymbol *Symbol) { +void ARMAsmParser::doBeforeLabelEmit(MCSymbol *Symbol, SMLoc IDLoc) { // We need to flush the current implicit IT block on a label, because it is // not legal to branch into an IT block. flushPendingInstructions(getStreamer()); diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp --- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp +++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp @@ -1057,7 +1057,7 @@ llvm_unreachable("Implement any new match types added!"); } - void doBeforeLabelEmit(MCSymbol *Symbol) override { + void doBeforeLabelEmit(MCSymbol *Symbol, SMLoc IDLoc) override { // Code below only applies to labels in text sections. auto CWS = cast(getStreamer().getCurrentSection().first); if (!CWS || !CWS->getKind().isText()) @@ -1067,7 +1067,7 @@ // Unlike other targets, we don't allow data in text sections (labels // declared with .type @object). if (WasmSym->getType() == wasm::WASM_SYMBOL_TYPE_DATA) { - Parser.Error(Parser.getTok().getLoc(), + Parser.Error(IDLoc, "Wasm doesn\'t support data symbols in text sections"); return; } diff --git a/llvm/test/MC/WebAssembly/basic-assembly-errors.s b/llvm/test/MC/WebAssembly/basic-assembly-errors.s --- a/llvm/test/MC/WebAssembly/basic-assembly-errors.s +++ b/llvm/test/MC/WebAssembly/basic-assembly-errors.s @@ -1,11 +1,11 @@ -# RUN: not llvm-mc -triple=wasm32-unknown-unknown -mattr=+simd128,+nontrapping-fptoint,+exception-handling < %s 2>&1 | FileCheck %s +# RUN: not llvm-mc -triple=wasm32-unknown-unknown -mattr=+simd128,+nontrapping-fptoint,+exception-handling %s 2>&1 | FileCheck %s # CHECK: invalid operand for instruction # (must be 0.0 or similar) f32.const 0 -# CHECK: Wasm doesn't support data symbols in text sections - .type objerr,@object +# CHECK: basic-assembly-errors.s:9:1: error: Wasm doesn't support data symbols in text sections +.type objerr,@object objerr: # CHECK: End of block construct with no start: end_try