Skip to content

Commit 04a3dd5

Browse files
committed
MCSymbol: Avoid isExported/setExported
The next change will move it to MCSymbol{COFF,MachO,Wasm} to make it clear that other object file formats (e.g. ELF) do not use this field.
1 parent 1def457 commit 04a3dd5

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

llvm/lib/MC/MCParser/AsmParser.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1864,11 +1864,13 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info,
18641864
Lex();
18651865
}
18661866

1867-
if (MAI.hasSubsectionsViaSymbols() && CFIStartProcLoc &&
1868-
Sym->isExternal() && !static_cast<MCSymbolMachO *>(Sym)->isAltEntry())
1869-
return Error(StartTokLoc, "non-private labels cannot appear between "
1870-
".cfi_startproc / .cfi_endproc pairs") &&
1871-
Error(*CFIStartProcLoc, "previous .cfi_startproc was here");
1867+
if (MAI.isMachO() && CFIStartProcLoc) {
1868+
auto *SymM = static_cast<MCSymbolMachO *>(Sym);
1869+
if (SymM->isExternal() && !SymM->isAltEntry())
1870+
return Error(StartTokLoc, "non-private labels cannot appear between "
1871+
".cfi_startproc / .cfi_endproc pairs") &&
1872+
Error(*CFIStartProcLoc, "previous .cfi_startproc was here");
1873+
}
18721874

18731875
if (discardLTOSymbol(IDVal))
18741876
return false;

llvm/lib/MC/MCParser/MasmParser.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include "llvm/MC/MCSection.h"
4040
#include "llvm/MC/MCStreamer.h"
4141
#include "llvm/MC/MCSubtargetInfo.h"
42-
#include "llvm/MC/MCSymbol.h"
42+
#include "llvm/MC/MCSymbolCOFF.h"
4343
#include "llvm/MC/MCTargetOptions.h"
4444
#include "llvm/Support/Casting.h"
4545
#include "llvm/Support/CommandLine.h"
@@ -3009,8 +3009,8 @@ bool MasmParser::parseDirectiveEquate(StringRef IDVal, StringRef Name,
30093009
return false;
30103010
}
30113011

3012-
MCSymbol *Sym = getContext().getOrCreateSymbol(Var.Name);
3013-
3012+
auto *Sym =
3013+
static_cast<MCSymbolCOFF *>(getContext().getOrCreateSymbol(Var.Name));
30143014
const MCConstantExpr *PrevValue =
30153015
Sym->isVariable()
30163016
? dyn_cast_or_null<MCConstantExpr>(Sym->getVariableValue())
@@ -4521,7 +4521,8 @@ bool MasmParser::parseDirectiveExtern() {
45214521
KnownType[Name.lower()] = Type;
45224522
}
45234523

4524-
MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
4524+
auto *Sym =
4525+
static_cast<MCSymbolCOFF *>(getContext().getOrCreateSymbol(Name));
45254526
Sym->setExternal(true);
45264527
getStreamer().emitSymbolAttribute(Sym, MCSA_Extern);
45274528

llvm/lib/MC/WasmObjectWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,7 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
15611561
<< toString(WS.getType().value_or(wasm::WASM_SYMBOL_TYPE_DATA))
15621562
<< " '" << S << "'"
15631563
<< " isDefined=" << S.isDefined() << " isExternal="
1564-
<< S.isExternal() << " isTemporary=" << S.isTemporary()
1564+
<< WS.isExternal() << " isTemporary=" << S.isTemporary()
15651565
<< " isWeak=" << WS.isWeak() << " isHidden=" << WS.isHidden()
15661566
<< " isVariable=" << WS.isVariable() << "\n");
15671567

0 commit comments

Comments
 (0)