Add r122359 back now that the bug in MCDwarfLineAddrFragment fragment has been
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 22 Dec 2010 22:16:24 +0000 (22:16 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 22 Dec 2010 22:16:24 +0000 (22:16 +0000)
fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122448 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCExpr.cpp

index 8fdf8378333f09221c6356dc540fca60672b4c07..58f2e94dd6263b687dac9df66fc2d40a76cbdd13 100644 (file)
@@ -269,27 +269,13 @@ bool MCExpr::EvaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
   // FIXME: The use if InSet = Addrs is a hack. Setting InSet causes us
   // absolutize differences across sections and that is what the MachO writer
   // uses Addrs for.
-  if (!EvaluateAsRelocatableImpl(Value, Asm, Layout, Addrs, /*InSet*/ Addrs) ||
-      !Value.isAbsolute()) {
-    // EvaluateAsAbsolute is defined to return the "current value" of
-    // the expression if we are given a Layout object, even in cases
-    // when the value is not fixed.
-    if (Layout) {
-      Res = Value.getConstant();
-      if (Value.getSymA()) {
-       Res += Layout->getSymbolOffset(
-          &Layout->getAssembler().getSymbolData(Value.getSymA()->getSymbol()));
-      }
-      if (Value.getSymB()) {
-       Res -= Layout->getSymbolOffset(
-          &Layout->getAssembler().getSymbolData(Value.getSymB()->getSymbol()));
-      }
-    }
-    return false;
-  }
+  bool IsRelocatable =
+    EvaluateAsRelocatableImpl(Value, Asm, Layout, Addrs, /*InSet*/ Addrs);
 
+  // Record the current value.
   Res = Value.getConstant();
-  return true;
+
+  return IsRelocatable && Value.isAbsolute();
 }
 
 /// \brief Helper method for \see EvaluateSymbolAdd().