From: Rafael Espindola Date: Wed, 22 Dec 2010 16:11:57 +0000 (+0000) Subject: Use references and simplify. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=33a38a1b5a35acd15c867193bc2175f3d4e7b83d;p=oota-llvm.git Use references and simplify. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122405 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/MC/MCExpr.h b/include/llvm/MC/MCExpr.h index da3cebe414e..49bdfd96cc7 100644 --- a/include/llvm/MC/MCExpr.h +++ b/include/llvm/MC/MCExpr.h @@ -90,7 +90,7 @@ public: /// @param Res - The relocatable value, if evaluation succeeds. /// @param Layout - The assembler layout object to use for evaluating values. /// @result - True on success. - bool EvaluateAsRelocatable(MCValue &Res, const MCAsmLayout *Layout = 0) const; + bool EvaluateAsRelocatable(MCValue &Res, const MCAsmLayout &Layout) const; /// @} diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp index 4ecedcb9bcc..bff883672d3 100644 --- a/lib/MC/MCAssembler.cpp +++ b/lib/MC/MCAssembler.cpp @@ -215,7 +215,7 @@ bool MCAssembler::EvaluateFixup(const MCAsmLayout &Layout, MCValue &Target, uint64_t &Value) const { ++stats::EvaluateFixup; - if (!Fixup.getValue()->EvaluateAsRelocatable(Target, &Layout)) + if (!Fixup.getValue()->EvaluateAsRelocatable(Target, Layout)) report_fatal_error("expected relocatable expression"); // FIXME: How do non-scattered symbols work in ELF? I presume the linker diff --git a/lib/MC/MCExpr.cpp b/lib/MC/MCExpr.cpp index e487416fe0b..58f2e94dd62 100644 --- a/lib/MC/MCExpr.cpp +++ b/lib/MC/MCExpr.cpp @@ -409,12 +409,9 @@ static bool EvaluateSymbolicAdd(const MCAssembler *Asm, } bool MCExpr::EvaluateAsRelocatable(MCValue &Res, - const MCAsmLayout *Layout) const { - if (Layout) - return EvaluateAsRelocatableImpl(Res, &Layout->getAssembler(), Layout, - 0, false); - else - return EvaluateAsRelocatableImpl(Res, 0, 0, 0, false); + const MCAsmLayout &Layout) const { + return EvaluateAsRelocatableImpl(Res, &Layout.getAssembler(), &Layout, + 0, false); } bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res,