@@ -487,7 +487,7 @@ void WasmObjectWriter::recordRelocation(const MCFragment &F,
487487 bool IsLocRel = false ;
488488
489489 if (const auto *RefB = Target.getSubSym ()) {
490- const auto &SymB = cast< MCSymbolWasm>(*RefB);
490+ auto &SymB = static_cast < const MCSymbolWasm & >(*RefB);
491491
492492 if (FixupSection.isText ()) {
493493 Ctx.reportError (Fixup.getLoc (),
@@ -515,7 +515,7 @@ void WasmObjectWriter::recordRelocation(const MCFragment &F,
515515 }
516516
517517 // We either rejected the fixup or folded B into C at this point.
518- const auto *SymA = cast< MCSymbolWasm>(Target.getAddSym ());
518+ auto *SymA = static_cast < const MCSymbolWasm * >(Target.getAddSym ());
519519
520520 // The .init_array isn't translated as data, so don't do relocations in it.
521521 if (FixupSection.getName ().starts_with (" .init_array" )) {
@@ -561,7 +561,7 @@ void WasmObjectWriter::recordRelocation(const MCFragment &F,
561561 report_fatal_error (" section symbol is required for relocation" );
562562
563563 C += Asm->getSymbolOffset (*SymA);
564- SymA = cast< MCSymbolWasm>(SectionSymbol);
564+ SymA = static_cast < const MCSymbolWasm * >(SectionSymbol);
565565 }
566566
567567 if (Type == wasm::R_WASM_TABLE_INDEX_REL_SLEB ||
@@ -573,7 +573,7 @@ void WasmObjectWriter::recordRelocation(const MCFragment &F,
573573 // TABLE_INDEX relocs implicitly use the default indirect function table.
574574 // We require the function table to have already been defined.
575575 auto TableName = " __indirect_function_table" ;
576- MCSymbolWasm *Sym = cast_or_null <MCSymbolWasm>(Ctx.lookupSymbol (TableName));
576+ auto *Sym = static_cast <MCSymbolWasm * >(Ctx.lookupSymbol (TableName));
577577 if (!Sym) {
578578 report_fatal_error (" missing indirect function table symbol" );
579579 } else {
@@ -631,8 +631,8 @@ WasmObjectWriter::getProvisionalValue(const MCAssembler &Asm,
631631 case wasm::R_WASM_TABLE_INDEX_I32:
632632 case wasm::R_WASM_TABLE_INDEX_I64: {
633633 // Provisional value is table address of the resolved symbol itself
634- const MCSymbolWasm *Base =
635- cast< MCSymbolWasm>(Asm.getBaseSymbol (*RelEntry.Symbol ));
634+ auto *Base =
635+ static_cast < const MCSymbolWasm * >(Asm.getBaseSymbol (*RelEntry.Symbol ));
636636 assert (Base->isFunction ());
637637 if (RelEntry.Type == wasm::R_WASM_TABLE_INDEX_REL_SLEB ||
638638 RelEntry.Type == wasm::R_WASM_TABLE_INDEX_REL_SLEB64)
@@ -1342,11 +1342,11 @@ void WasmObjectWriter::prepareImports(
13421342 // Register types for all functions, including those with private linkage
13431343 // (because wasm always needs a type signature).
13441344 if (WS.isFunction ()) {
1345- const auto *BS = Asm.getBaseSymbol (S);
1345+ auto *BS = static_cast < const MCSymbolWasm *>( Asm.getBaseSymbol (S) );
13461346 if (!BS)
13471347 report_fatal_error (Twine (S.getName ()) +
13481348 " : absolute addressing not supported!" );
1349- registerFunctionType (*cast<MCSymbolWasm>(BS) );
1349+ registerFunctionType (*BS );
13501350 }
13511351
13521352 if (WS.isTag ())
@@ -1516,10 +1516,10 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
15161516 // For user-defined custom sections, strip the prefix
15171517 Name.consume_front (" .custom_section." );
15181518
1519- MCSymbol *Begin = Sec.getBeginSymbol ();
1519+ auto *Begin = static_cast <MCSymbolWasm *>( Sec.getBeginSymbol () );
15201520 if (Begin) {
1521- assert (WasmIndices.count (cast<MCSymbolWasm>( Begin) ) == 0 );
1522- WasmIndices[cast<MCSymbolWasm>( Begin) ] = CustomSections.size ();
1521+ assert (WasmIndices.count (Begin) == 0 );
1522+ WasmIndices[Begin] = CustomSections.size ();
15231523 }
15241524
15251525 // Separate out the producers and target features sections
@@ -1719,7 +1719,7 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
17191719 if (!BS)
17201720 report_fatal_error (Twine (S.getName ()) +
17211721 " : absolute addressing not supported!" );
1722- const MCSymbolWasm *Base = cast< MCSymbolWasm>(BS);
1722+ const MCSymbolWasm *Base = static_cast < const MCSymbolWasm * >(BS);
17231723
17241724 // Find the target symbol of this weak alias and export that index
17251725 const auto &WS = static_cast <const MCSymbolWasm &>(S);
@@ -1829,8 +1829,8 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
18291829 Rel.Type != wasm::R_WASM_TABLE_INDEX_REL_SLEB64)
18301830 return ;
18311831 assert (Rel.Symbol ->isFunction ());
1832- const MCSymbolWasm *Base =
1833- cast< MCSymbolWasm>(Asm.getBaseSymbol (*Rel.Symbol ));
1832+ auto *Base =
1833+ static_cast < const MCSymbolWasm * >(Asm.getBaseSymbol (*Rel.Symbol ));
18341834 uint32_t FunctionIndex = WasmIndices.find (Base)->second ;
18351835 uint32_t TableIndex = TableElems.size () + InitialTableOffset;
18361836 if (TableIndices.try_emplace (Base, TableIndex).second ) {
@@ -1880,7 +1880,8 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
18801880 if (!SymRef)
18811881 report_fatal_error (
18821882 " fixups in .init_array should be symbol references" );
1883- const auto &TargetSym = cast<const MCSymbolWasm>(SymRef->getSymbol ());
1883+ auto &TargetSym =
1884+ static_cast <const MCSymbolWasm &>(SymRef->getSymbol ());
18841885 if (TargetSym.getIndex () == InvalidIndex)
18851886 report_fatal_error (" symbols in .init_array should exist in symtab" );
18861887 if (!TargetSym.isFunction ())
@@ -1905,7 +1906,7 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
19051906 writeExportSection (Exports);
19061907 const MCSymbol *IndirectFunctionTable =
19071908 getContext ().lookupSymbol (" __indirect_function_table" );
1908- writeElemSection (cast_or_null <const MCSymbolWasm>(IndirectFunctionTable),
1909+ writeElemSection (static_cast <const MCSymbolWasm * >(IndirectFunctionTable),
19091910 TableElems);
19101911 writeDataCountSection ();
19111912
0 commit comments