@@ -396,7 +396,7 @@ bool X86MachObjectWriter::recordScatteredRelocation(MachObjectWriter *Writer,
396
396
if (!SB->getFragment ()) {
397
397
Asm.getContext ().reportError (
398
398
Fixup.getLoc (),
399
- " symbol '" + B-> getSymbol (). getName () +
399
+ " symbol '" + SB-> getName () +
400
400
" ' can not be undefined in a subtraction expression" );
401
401
return false ;
402
402
}
@@ -408,7 +408,7 @@ bool X86MachObjectWriter::recordScatteredRelocation(MachObjectWriter *Writer,
408
408
// pedantic compatibility with 'as'.
409
409
Type = A->isExternal () ? (unsigned )MachO::GENERIC_RELOC_SECTDIFF
410
410
: (unsigned )MachO::GENERIC_RELOC_LOCAL_SECTDIFF;
411
- Value2 = Writer->getSymbolAddress (B-> getSymbol () , Layout);
411
+ Value2 = Writer->getSymbolAddress (*SB , Layout);
412
412
FixedValue -= Writer->getSectionAddress (SB->getFragment ()->getParent ());
413
413
}
414
414
@@ -468,8 +468,8 @@ void X86MachObjectWriter::recordTLVPRelocation(MachObjectWriter *Writer,
468
468
const MCFixup &Fixup,
469
469
MCValue Target,
470
470
uint64_t &FixedValue) {
471
- assert ( Target.getSymA ()-> getKind () == MCSymbolRefExpr::VK_TLVP &&
472
- !is64Bit () &&
471
+ const MCSymbolRefExpr *SymA = Target.getSymA ();
472
+ assert (SymA-> getKind () == MCSymbolRefExpr::VK_TLVP && !is64Bit () &&
473
473
" Should only be called with a 32-bit TLVP relocation!" );
474
474
475
475
unsigned Log2Size = getFixupKindLog2Size (Fixup.getKind ());
@@ -480,15 +480,14 @@ void X86MachObjectWriter::recordTLVPRelocation(MachObjectWriter *Writer,
480
480
// subtraction from the picbase. For 32-bit pic the addend is the difference
481
481
// between the picbase and the next address. For 32-bit static the addend is
482
482
// zero.
483
- if (Target.getSymB ()) {
483
+ if (auto *SymB = Target.getSymB ()) {
484
484
// If this is a subtraction then we're pcrel.
485
485
uint32_t FixupAddress =
486
486
Writer->getFragmentAddress (Fragment, Layout) + Fixup.getOffset ();
487
487
IsPCRel = 1 ;
488
- FixedValue =
489
- FixupAddress -
490
- Writer->getSymbolAddress (Target.getSymB ()->getSymbol (), Layout) +
491
- Target.getConstant ();
488
+ FixedValue = FixupAddress -
489
+ Writer->getSymbolAddress (SymB->getSymbol (), Layout) +
490
+ Target.getConstant ();
492
491
FixedValue += 1ULL << Log2Size;
493
492
} else {
494
493
FixedValue = 0 ;
@@ -499,8 +498,7 @@ void X86MachObjectWriter::recordTLVPRelocation(MachObjectWriter *Writer,
499
498
MRE.r_word0 = Value;
500
499
MRE.r_word1 =
501
500
(IsPCRel << 24 ) | (Log2Size << 25 ) | (MachO::GENERIC_RELOC_TLV << 28 );
502
- Writer->addRelocation (&Target.getSymA ()->getSymbol (), Fragment->getParent (),
503
- MRE);
501
+ Writer->addRelocation (&SymA->getSymbol (), Fragment->getParent (), MRE);
504
502
}
505
503
506
504
void X86MachObjectWriter::RecordX86Relocation (MachObjectWriter *Writer,
0 commit comments