NFC: Rename MCSafeSEHFragment to MCSymbolIdFragment

Summary:
This fragment emits a symbol ID and will be useful for more than just Safe SEH
tables (e.g., I plan to re-use it for Control Flow Guard tables).  This is
simply a rename refactor.

Reviewers: rnk

Subscribers: llvm-commits, hiraditya

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317703 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adrian McCarthy 2017-11-08 18:57:02 +00:00
parent 27b6b3117f
commit cf89e1c2fe
4 changed files with 15 additions and 14 deletions

View File

@ -42,7 +42,7 @@ public:
FT_DwarfFrame,
FT_LEB,
FT_Padding,
FT_SafeSEH,
FT_SymbolId,
FT_CVInlineLines,
FT_CVDefRange,
FT_Dummy
@ -562,12 +562,13 @@ public:
}
};
class MCSafeSEHFragment : public MCFragment {
/// Represents a symbol table index fragment.
class MCSymbolIdFragment : public MCFragment {
const MCSymbol *Sym;
public:
MCSafeSEHFragment(const MCSymbol *Sym, MCSection *Sec = nullptr)
: MCFragment(FT_SafeSEH, false, 0, Sec), Sym(Sym) {}
MCSymbolIdFragment(const MCSymbol *Sym, MCSection *Sec = nullptr)
: MCFragment(FT_SymbolId, false, 0, Sec), Sym(Sym) {}
/// \name Accessors
/// @{
@ -578,7 +579,7 @@ public:
/// @}
static bool classof(const MCFragment *F) {
return F->getKind() == MCFragment::FT_SafeSEH;
return F->getKind() == MCFragment::FT_SymbolId;
}
};

View File

@ -290,7 +290,7 @@ uint64_t MCAssembler::computeFragmentSize(const MCAsmLayout &Layout,
case MCFragment::FT_Padding:
return cast<MCPaddingFragment>(F).getSize();
case MCFragment::FT_SafeSEH:
case MCFragment::FT_SymbolId:
return 4;
case MCFragment::FT_Align: {
@ -563,8 +563,8 @@ static void writeFragment(const MCAssembler &Asm, const MCAsmLayout &Layout,
break;
}
case MCFragment::FT_SafeSEH: {
const MCSafeSEHFragment &SF = cast<MCSafeSEHFragment>(F);
case MCFragment::FT_SymbolId: {
const MCSymbolIdFragment &SF = cast<MCSymbolIdFragment>(F);
OW->write32(SF.getSymbol()->getIndex());
break;
}

View File

@ -281,8 +281,8 @@ void MCFragment::destroy() {
case FT_Padding:
delete cast<MCPaddingFragment>(this);
return;
case FT_SafeSEH:
delete cast<MCSafeSEHFragment>(this);
case FT_SymbolId:
delete cast<MCSymbolIdFragment>(this);
return;
case FT_CVInlineLines:
delete cast<MCCVInlineLineTableFragment>(this);
@ -326,7 +326,7 @@ LLVM_DUMP_METHOD void MCFragment::dump() const {
case MCFragment::FT_DwarfFrame: OS << "MCDwarfCallFrameFragment"; break;
case MCFragment::FT_LEB: OS << "MCLEBFragment"; break;
case MCFragment::FT_Padding: OS << "MCPaddingFragment"; break;
case MCFragment::FT_SafeSEH: OS << "MCSafeSEHFragment"; break;
case MCFragment::FT_SymbolId: OS << "MCSymbolIdFragment"; break;
case MCFragment::FT_CVInlineLines: OS << "MCCVInlineLineTableFragment"; break;
case MCFragment::FT_CVDefRange: OS << "MCCVDefRangeTableFragment"; break;
case MCFragment::FT_Dummy: OS << "MCDummyFragment"; break;
@ -436,8 +436,8 @@ LLVM_DUMP_METHOD void MCFragment::dump() const {
OS << "\n ";
break;
}
case MCFragment::FT_SafeSEH: {
const MCSafeSEHFragment *F = cast<MCSafeSEHFragment>(this);
case MCFragment::FT_SymbolId: {
const MCSymbolIdFragment *F = cast<MCSymbolIdFragment>(this);
OS << "\n ";
OS << " Sym:" << F->getSymbol();
break;

View File

@ -182,7 +182,7 @@ void MCWinCOFFStreamer::EmitCOFFSafeSEH(MCSymbol const *Symbol) {
if (SXData->getAlignment() < 4)
SXData->setAlignment(4);
new MCSafeSEHFragment(Symbol, SXData);
new MCSymbolIdFragment(Symbol, SXData);
getAssembler().registerSymbol(*Symbol);
CSymbol->setIsSafeSEH();