[llvm] r257689 - Simplify. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 14:23:36 PST 2016


Author: rafael
Date: Wed Jan 13 16:23:36 2016
New Revision: 257689

URL: http://llvm.org/viewvc/llvm-project?rev=257689&view=rev
Log:
Simplify. NFC.

Modified:
    llvm/trunk/lib/MC/ELFObjectWriter.cpp

Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=257689&r1=257688&r2=257689&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Wed Jan 13 16:23:36 2016
@@ -618,6 +618,7 @@ void ELFObjectWriter::recordRelocation(M
   const MCSectionELF &FixupSection = cast<MCSectionELF>(*Fragment->getParent());
   uint64_t C = Target.getConstant();
   uint64_t FixupOffset = Layout.getFragmentOffset(Fragment) + Fixup.getOffset();
+  MCContext &Ctx = Asm.getContext();
 
   if (const MCSymbolRefExpr *RefB = Target.getSymB()) {
     assert(RefB->getKind() == MCSymbolRefExpr::VK_None &&
@@ -631,7 +632,7 @@ void ELFObjectWriter::recordRelocation(M
     // or (A + C - R). If B = R + K and the relocation is not pcrel, we can
     // replace B to implement it: (A - R - K + C)
     if (IsPCRel) {
-      Asm.getContext().reportError(
+      Ctx.reportError(
           Fixup.getLoc(),
           "No relocation available to represent this relative expression");
       return;
@@ -640,24 +641,23 @@ void ELFObjectWriter::recordRelocation(M
     const auto &SymB = cast<MCSymbolELF>(RefB->getSymbol());
 
     if (SymB.isUndefined()) {
-      Asm.getContext().reportError(
-          Fixup.getLoc(),
-          Twine("symbol '") + SymB.getName() +
-              "' can not be undefined in a subtraction expression");
+      Ctx.reportError(Fixup.getLoc(),
+                      Twine("symbol '") + SymB.getName() +
+                          "' can not be undefined in a subtraction expression");
       return;
     }
 
     assert(!SymB.isAbsolute() && "Should have been folded");
     const MCSection &SecB = SymB.getSection();
     if (&SecB != &FixupSection) {
-      Asm.getContext().reportError(
-          Fixup.getLoc(), "Cannot represent a difference across sections");
+      Ctx.reportError(Fixup.getLoc(),
+                      "Cannot represent a difference across sections");
       return;
     }
 
     if (::isWeak(SymB)) {
-      Asm.getContext().reportError(
-          Fixup.getLoc(), "Cannot represent a subtraction with a weak symbol");
+      Ctx.reportError(Fixup.getLoc(),
+                      "Cannot represent a subtraction with a weak symbol");
       return;
     }
 




More information about the llvm-commits mailing list