[PATCH] D18123: Fix implicit copy ctor and copy assignment operator warnings when -Wdeprecated passed.

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 13 12:30:26 PDT 2016


On Sat, Mar 12, 2016 at 3:42 PM, don hinton via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> hintonda created this revision.
> hintonda added a reviewer: rjmccall.
> hintonda added a subscriber: cfe-commits.
>
> Fix implicit copy ctor and copy assignment operator warnings
> when -Wdeprecated passed.
>
> http://reviews.llvm.org/D18123
>
> Files:
>   include/clang/AST/UnresolvedSet.h
>   include/clang/Sema/Lookup.h
>
> Index: include/clang/Sema/Lookup.h
> ===================================================================
> --- include/clang/Sema/Lookup.h
> +++ include/clang/Sema/Lookup.h
> @@ -185,6 +185,9 @@
>        Shadowed(false)
>    {}
>
> +  LookupResult(const LookupResult &) = default;
> +  LookupResult & operator=(const LookupResult &) = default;
>

Pretty sure LookupResult should not be copyable - I've been meaning to get
around to fixing this -Wdeprecated regression introduced by copinig
LookupResult

(if you look at LookupResult's dtor, you can see that it's not really
copyable - if it has paths, you'll cause double deletion if you copy it -
or double diagnosis, etc - in the one other place where I came across a
LookupResult copy, I just pulled uot all the lookup query parameters and
passed those into a new LookupResult - probably better off splitting it
into the query portion and the result portion and keeping the query portion
copyable)

If you check my commits related to this warning, you should find a change I
made to delayed typo correction that fixed a similar LookupResult copy
using the mechanism I described.

Thanks,
- Dave


> +
>    ~LookupResult() {
>      if (Diagnose) diagnose();
>      if (Paths) deletePaths(Paths);
> Index: include/clang/AST/UnresolvedSet.h
> ===================================================================
> --- include/clang/AST/UnresolvedSet.h
> +++ include/clang/AST/UnresolvedSet.h
> @@ -59,8 +59,9 @@
>    // UnresolvedSet.
>  private:
>    template <unsigned N> friend class UnresolvedSet;
> -  UnresolvedSetImpl() {}
> -  UnresolvedSetImpl(const UnresolvedSetImpl &) {}
> +  UnresolvedSetImpl() = default;
> +  UnresolvedSetImpl(const UnresolvedSetImpl &) = default;
> +  UnresolvedSetImpl& operator=(const UnresolvedSetImpl &) = default;
>
>  public:
>    // We don't currently support assignment through this iterator, so we
> might
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160313/7a4600f2/attachment.html>


More information about the cfe-commits mailing list