diff options
Diffstat (limited to 'llvm/lib/MC/MCParser')
-rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/MC/MCParser/COFFMasmParser.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/MC/MCParser/ELFAsmParser.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/MC/MCParser/WasmAsmParser.cpp | 8 |
4 files changed, 11 insertions, 9 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index 9f64a98..7782dc1 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -1865,7 +1865,7 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info, } if (MAI.hasSubsectionsViaSymbols() && CFIStartProcLoc && - Sym->isExternal() && !cast<MCSymbolMachO>(Sym)->isAltEntry()) + Sym->isExternal() && !static_cast<MCSymbolMachO *>(Sym)->isAltEntry()) return Error(StartTokLoc, "non-private labels cannot appear between " ".cfi_startproc / .cfi_endproc pairs") && Error(*CFIStartProcLoc, "previous .cfi_startproc was here"); @@ -6273,7 +6273,8 @@ bool parseAssignmentExpression(StringRef Name, bool allow_redef, // used as a symbol, or it is an absolute symbol). Sym = Parser.getContext().lookupSymbol(Name); if (Sym) { - if (!Sym->isUnset() && (!allow_redef || !Sym->isRedefinable())) + if ((Sym->isVariable() || Sym->isDefined()) && + (!allow_redef || !Sym->isRedefinable())) return Parser.Error(EqualLoc, "redefinition of '" + Name + "'"); // If the symbol is redefinable, clone it and update the symbol table // to the new symbol. Existing references to the original symbol remain diff --git a/llvm/lib/MC/MCParser/COFFMasmParser.cpp b/llvm/lib/MC/MCParser/COFFMasmParser.cpp index 282f22f..229b0b8 100644 --- a/llvm/lib/MC/MCParser/COFFMasmParser.cpp +++ b/llvm/lib/MC/MCParser/COFFMasmParser.cpp @@ -460,7 +460,8 @@ bool COFFMasmParser::parseDirectiveProc(StringRef Directive, SMLoc Loc) { nextLoc = getTok().getLoc(); } } - MCSymbolCOFF *Sym = cast<MCSymbolCOFF>(getContext().getOrCreateSymbol(Label)); + auto *Sym = + static_cast<MCSymbolCOFF *>(getContext().getOrCreateSymbol(Label)); // Define symbol as simple external function Sym->setExternal(true); diff --git a/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/llvm/lib/MC/MCParser/ELFAsmParser.cpp index 2e251cc..6782c4b 100644 --- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp +++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp @@ -200,7 +200,7 @@ bool ELFAsmParser::parseDirectiveSize(StringRef, SMLoc) { StringRef Name; if (getParser().parseIdentifier(Name)) return TokError("expected identifier"); - MCSymbolELF *Sym = cast<MCSymbolELF>(getContext().getOrCreateSymbol(Name)); + auto *Sym = static_cast<MCSymbolELF *>(getContext().getOrCreateSymbol(Name)); if (getLexer().isNot(AsmToken::Comma)) return TokError("expected comma"); @@ -466,7 +466,7 @@ bool ELFAsmParser::parseLinkedToSym(MCSymbolELF *&LinkedToSym) { } return TokError("invalid linked-to symbol"); } - LinkedToSym = dyn_cast_or_null<MCSymbolELF>(getContext().lookupSymbol(Name)); + LinkedToSym = static_cast<MCSymbolELF *>(getContext().lookupSymbol(Name)); if (!LinkedToSym || !LinkedToSym->isInSection()) return Error(StartLoc, "linked-to symbol is not in a section: " + Name); return false; diff --git a/llvm/lib/MC/MCParser/WasmAsmParser.cpp b/llvm/lib/MC/MCParser/WasmAsmParser.cpp index d97f4f5..6c2d241 100644 --- a/llvm/lib/MC/MCParser/WasmAsmParser.cpp +++ b/llvm/lib/MC/MCParser/WasmAsmParser.cpp @@ -224,7 +224,7 @@ public: return true; if (expect(AsmToken::EndOfStatement, "eol")) return true; - auto WasmSym = cast<MCSymbolWasm>(Sym); + auto WasmSym = static_cast<const MCSymbolWasm *>(Sym); if (WasmSym->isFunction()) { // Ignore .size directives for function symbols. They get their size // set automatically based on their content. @@ -241,9 +241,9 @@ public: if (!Lexer->is(AsmToken::Identifier)) return error("Expected label after .type directive, got: ", Lexer->getTok()); - auto WasmSym = cast<MCSymbolWasm>( - getStreamer().getContext().getOrCreateSymbol( - Lexer->getTok().getString())); + auto *WasmSym = static_cast<MCSymbolWasm *>( + getStreamer().getContext().getOrCreateSymbol( + Lexer->getTok().getString())); Lex(); if (!(isNext(AsmToken::Comma) && isNext(AsmToken::At) && Lexer->is(AsmToken::Identifier))) |