Skip to content

Commit e12689e

Browse files
committed
MCSymbol: Move isExported/setExported to MCSymbol{COFF,MachO,Wasm}
Make it clear that other object file formats (e.g. ELF) do not use this field.
1 parent 63f1008 commit e12689e

File tree

7 files changed

+9
-6
lines changed

7 files changed

+9
-6
lines changed

llvm/include/llvm/MC/MCSymbol.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,6 @@ class MCSymbol {
352352
return Fragment;
353353
}
354354

355-
// For ELF, use MCSymbolELF::setBinding instead.
356-
bool isExternal() const { return IsExternal; }
357-
void setExternal(bool Value) const { IsExternal = Value; }
358-
359355
// COFF-specific
360356
bool isWeakExternal() const { return IsWeakExternal; }
361357

llvm/include/llvm/MC/MCSymbolCOFF.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ class MCSymbolCOFF : public MCSymbol {
3333
MCSymbolCOFF(const MCSymbolTableEntry *Name, bool isTemporary)
3434
: MCSymbol(Name, isTemporary) {}
3535

36+
bool isExternal() const { return IsExternal; }
37+
void setExternal(bool Value) const { IsExternal = Value; }
38+
3639
uint16_t getType() const {
3740
return Type;
3841
}

llvm/include/llvm/MC/MCSymbolMachO.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ class MCSymbolMachO : public MCSymbol {
4646
MCSymbolMachO(const MCSymbolTableEntry *Name, bool isTemporary)
4747
: MCSymbol(Name, isTemporary) {}
4848

49+
bool isExternal() const { return IsExternal; }
50+
void setExternal(bool Value) const { IsExternal = Value; }
4951
bool isPrivateExtern() const { return IsPrivateExtern; }
5052
void setPrivateExtern(bool Value) { IsPrivateExtern = Value; }
5153

llvm/include/llvm/MC/MCSymbolWasm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ class MCSymbolWasm : public MCSymbol {
3737
MCSymbolWasm(const MCSymbolTableEntry *Name, bool isTemporary)
3838
: MCSymbol(Name, isTemporary) {}
3939

40+
bool isExternal() const { return IsExternal; }
41+
void setExternal(bool Value) const { IsExternal = Value; }
4042
const MCExpr *getSize() const { return SymbolSize; }
4143
void setSize(const MCExpr *SS) { SymbolSize = SS; }
4244

llvm/include/llvm/MC/MCSymbolXCOFF.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ class MCSymbolXCOFF : public MCSymbol {
3737
return Name;
3838
}
3939

40+
bool isExternal() const { return IsExternal; }
41+
void setExternal(bool Value) const { IsExternal = Value; }
4042
void setStorageClass(XCOFF::StorageClass SC) {
4143
StorageClass = SC;
4244
};

llvm/lib/MC/MCContext.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ MCSymbol *MCContext::cloneSymbol(MCSymbol &Sym) {
326326

327327
// Ensure the original symbol is not emitted to the symbol table.
328328
Sym.IsTemporary = true;
329-
Sym.setExternal(false);
330329
return NewSym;
331330
}
332331

llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ void HexagonMCELFStreamer::HexagonMCEmitLocalCommonSymbol(MCSymbol *Symbol,
144144
getAssembler().registerSymbol(*Symbol);
145145
auto ELFSymbol = static_cast<const MCSymbolELF *>(Symbol);
146146
ELFSymbol->setBinding(ELF::STB_LOCAL);
147-
ELFSymbol->setExternal(false);
148147
HexagonMCEmitCommonSymbol(Symbol, Size, ByteAlignment, AccessSize);
149148
}
150149

0 commit comments

Comments
 (0)