diff options
| -rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 2 | ||||
| -rw-r--r-- | llvm/test/MC/AArch64/expr-bad-symbol.s | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index eb76dd07088..6eb7fd0d0b6 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -1103,7 +1103,7 @@ bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) { // This is a symbol reference. StringRef SymbolName = Identifier; if (SymbolName.empty()) - return true; + return Error(getLexer().getLoc(), "expected a symbol reference"); MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None; diff --git a/llvm/test/MC/AArch64/expr-bad-symbol.s b/llvm/test/MC/AArch64/expr-bad-symbol.s new file mode 100644 index 00000000000..de21babfa74 --- /dev/null +++ b/llvm/test/MC/AArch64/expr-bad-symbol.s @@ -0,0 +1,6 @@ +// RUN: not llvm-mc -triple aarch64-- %s 2>&1 | FileCheck %s + + .text +_foo: + str q28, [x0, #1*6*4*@] +// CHECK: error: expected a symbol reference |

