[PATCH] ELF: Move relocation predicates out of the context class.

Rui Ueyama ruiu at google.com
Tue Feb 17 14:58:53 PST 2015


As the same reason they don't belong to the linking context, they don't
belong to the target handler too. The predicates for relocations don't need
any knowledge on a target and will never be overridden depending on
architecture. They are just independent predicates on references.

I think I read about this in Effective C++ and that's a good practice -- if
your functionality uses only public interface of other classes, making it a
non-member function is preferred. By doing that it cuts dependencies and it
also make it obvious that the function doesn't depend on any hidden
information. I believe this is exactly what I'm trying to do in this patch.


On Tue, Feb 17, 2015 at 2:40 PM, Shankar Kalpathi Easwaran <
shankarke at gmail.com> wrote:

> I do agree that LinkingContext is not the place to have these functions
> defined. Moving this to lld::Reference is not the right thing to do IMO as
> its a base class for all references. We do have TargetHandler for this
> purpose where each target would override this functionality.
>
>
> http://reviews.llvm.org/D7605
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150217/41f12f09/attachment.html>


More information about the llvm-commits mailing list