[AsmParser] Diagnose empty symbol for .set directive

Summary: Diagnose empty symbol to avoid hitting assertion in MCContext::getOrCreateSymbol

Reviewers: eli.friedman, rengolin

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D26728

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288390 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Weiming Zhao 2016-12-01 18:00:36 +00:00
parent d0c8980196
commit b76e6a781e
2 changed files with 5 additions and 1 deletions

View File

@ -973,6 +973,9 @@ bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
// This is a symbol reference.
StringRef SymbolName = Identifier;
if (SymbolName.empty())
return true;
MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None;
// Lookup the symbol variant if used.

View File

@ -5,5 +5,6 @@
.set a, 1
.equ a, 2
.equiv a, 3
.set b, ""
// CHECK: error: redefinition of 'a'
// CHECK: error: missing expression in '.set' directive