aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCParser
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/MC/MCParser')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp15
-rw-r--r--llvm/lib/MC/MCParser/COFFMasmParser.cpp1
-rw-r--r--llvm/lib/MC/MCParser/ELFAsmParser.cpp1
-rw-r--r--llvm/lib/MC/MCParser/MasmParser.cpp9
-rw-r--r--llvm/lib/MC/MCParser/WasmAsmParser.cpp1
5 files changed, 14 insertions, 13 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index c5611a38..fb183a1 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -1864,11 +1864,13 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info,
Lex();
}
- if (MAI.hasSubsectionsViaSymbols() && CFIStartProcLoc &&
- 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");
+ if (MAI.isMachO() && CFIStartProcLoc) {
+ auto *SymM = static_cast<MCSymbolMachO *>(Sym);
+ if (SymM->isExternal() && !SymM->isAltEntry())
+ return Error(StartTokLoc, "non-private labels cannot appear between "
+ ".cfi_startproc / .cfi_endproc pairs") &&
+ Error(*CFIStartProcLoc, "previous .cfi_startproc was here");
+ }
if (discardLTOSymbol(IDVal))
return false;
@@ -6273,7 +6275,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 229b0b8..1bb617b 100644
--- a/llvm/lib/MC/MCParser/COFFMasmParser.cpp
+++ b/llvm/lib/MC/MCParser/COFFMasmParser.cpp
@@ -18,7 +18,6 @@
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbolCOFF.h"
#include "llvm/MC/SectionKind.h"
-#include "llvm/Support/Casting.h"
#include "llvm/Support/SMLoc.h"
#include <cstdint>
#include <utility>
diff --git a/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
index 6782c4b..513f3b3 100644
--- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
@@ -22,7 +22,6 @@
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/MC/SectionKind.h"
-#include "llvm/Support/Casting.h"
#include "llvm/Support/SMLoc.h"
#include <cassert>
#include <cstdint>
diff --git a/llvm/lib/MC/MCParser/MasmParser.cpp b/llvm/lib/MC/MCParser/MasmParser.cpp
index 780289e..2dcfe0f 100644
--- a/llvm/lib/MC/MCParser/MasmParser.cpp
+++ b/llvm/lib/MC/MCParser/MasmParser.cpp
@@ -39,7 +39,7 @@
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSubtargetInfo.h"
-#include "llvm/MC/MCSymbol.h"
+#include "llvm/MC/MCSymbolCOFF.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
@@ -3009,8 +3009,8 @@ bool MasmParser::parseDirectiveEquate(StringRef IDVal, StringRef Name,
return false;
}
- MCSymbol *Sym = getContext().getOrCreateSymbol(Var.Name);
-
+ auto *Sym =
+ static_cast<MCSymbolCOFF *>(getContext().getOrCreateSymbol(Var.Name));
const MCConstantExpr *PrevValue =
Sym->isVariable()
? dyn_cast_or_null<MCConstantExpr>(Sym->getVariableValue())
@@ -4521,7 +4521,8 @@ bool MasmParser::parseDirectiveExtern() {
KnownType[Name.lower()] = Type;
}
- MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
+ auto *Sym =
+ static_cast<MCSymbolCOFF *>(getContext().getOrCreateSymbol(Name));
Sym->setExternal(true);
getStreamer().emitSymbolAttribute(Sym, MCSA_Extern);
diff --git a/llvm/lib/MC/MCParser/WasmAsmParser.cpp b/llvm/lib/MC/MCParser/WasmAsmParser.cpp
index 6c2d241..ddfe1e1 100644
--- a/llvm/lib/MC/MCParser/WasmAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/WasmAsmParser.cpp
@@ -26,7 +26,6 @@
#include "llvm/MC/MCSectionWasm.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbolWasm.h"
-#include "llvm/Support/Casting.h"
#include <optional>
using namespace llvm;