[PATCH] D41204: Inline a small function.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 15:54:58 PST 2017


On Wed, Dec 13, 2017 at 3:42 PM, Sam Clegg via Phabricator <
reviews at reviews.llvm.org> wrote:

> sbc100 added inline comments.
>
>
> ================
> Comment at: lld/trunk/ELF/InputFiles.cpp:609
> +
> +  InputSectionBase *Sec = this->Sections[SecIdx];
>    uint8_t StOther = Sym->st_other;
> ----------------
> Why is inlining this better?  Isn't it generally considered better for
> comprehension to have smaller, well-named functions?
>

It depends. getSection was originally defined to be a public accessor to
get a section, but later it was converted to a private function. In other
member functions we don't use that function but directly access
this->Sections, so keeping the function seemed odd to me.


> Also, out of curiosity, why all use of  `this->` in this file?   Just a
> local coding style or some kind of ambiguity resolution?


This code won't compile without `this->`.
https://isocpp.org/wiki/faq/templates#nondependent-name-lookup-members


>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D41204
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171213/690f6206/attachment.html>


More information about the llvm-commits mailing list