[lld] r210081 - Remove unusual use of using.

David Blaikie dblaikie at gmail.com
Tue Jun 3 07:57:31 PDT 2014


This was actually, probably, the right way to write this code. This is a
common idiom when making generic calla to std::swap. The using declaration
brings in the std form, but he unqualified call allows a more fitting
function to be found via adl if one exists. A test case to demonstrate why
this is necessary would've been nice of course (by whoever wrote this code
initially)

But perhaps this isn't an issue for begin/end. Maybe they should just be
called unqualified, and the standard containers will have their begin/end
found by normal adl. Its not like swap where theres a generic fallback
implementation.
On Jun 3, 2014 12:35 AM, "Rui Ueyama" <ruiu at google.com> wrote:

> Author: ruiu
> Date: Tue Jun  3 02:24:46 2014
> New Revision: 210081
>
> URL: http://llvm.org/viewvc/llvm-project?rev=210081&view=rev
> Log:
> Remove unusual use of using.
>
> Modified:
>     lld/trunk/include/lld/ReaderWriter/LinkerScript.h
>
> Modified: lld/trunk/include/lld/ReaderWriter/LinkerScript.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/LinkerScript.h?rev=210081&r1=210080&r2=210081&view=diff
>
> ==============================================================================
> --- lld/trunk/include/lld/ReaderWriter/LinkerScript.h (original)
> +++ lld/trunk/include/lld/ReaderWriter/LinkerScript.h Tue Jun  3 02:24:46
> 2014
> @@ -155,9 +155,7 @@ class Group : public Command {
>  public:
>    template <class RangeT>
>    explicit Group(RangeT range) : Command(Kind::Group) {
> -    using std::begin;
> -    using std::end;
> -    std::copy(begin(range), end(range), std::back_inserter(_paths));
> +    std::copy(std::begin(range), std::end(range),
> std::back_inserter(_paths));
>    }
>
>    static bool classof(const Command *c) { return c->getKind() ==
> Kind::Group; }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140603/3176194a/attachment.html>


More information about the llvm-commits mailing list