[PATCH] D19468: Disallow duplication of imported entities (improved implementation)

Aboud, Amjad via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 01:01:21 PDT 2016


You cannot simply skip a redeclaration unless it is declared at same location.

For example:

namespace X { int a; }
// some other code
namespace X { int b; }

You cannot eliminate the second namespace, can you?

void foo () { using X:a; }
void bar () { using X:a; }

Also here, you cannot eliminate the second using-decl can you?

Looking into the code, it is not simple to introduce these checks, as there is no one place that will affect all Decls, and we will need to handle each Decl separately.
Can you think on a place where we can add this in AST?

Thanks,
Amjad

From: David Blaikie [mailto:dblaikie at gmail.com]
Sent: Tuesday, April 26, 2016 03:12
To: reviews+D19468+public+d141c7248d054ca3 at reviews.llvm.org; Aboud, Amjad <amjad.aboud at intel.com>
Cc: Duncan P. N. Exon Smith <dexonsmith at apple.com>; Adrian Prantl <aprantl at apple.com>; llvm-commits <llvm-commits at lists.llvm.org>
Subject: Re: [PATCH] D19468: Disallow duplication of imported entities (improved implementation)



On Mon, Apr 25, 2016 at 2:25 PM, Amjad Aboud via llvm-commits <llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>> wrote:
aaboud added a comment.

I am not much familiar with the AST part, but I assume there is reuse of previous generated DCL, even if it has same data.

What if we filter by cases where the decl == the canonical decl, and skip any decl that's a redeclaration?


Here is a small example that leads into duplication in AST DCLs.
You may run the following command line:

  clang -cc1 -ast-dump -o - -O0 TestIM.cpp

TestIM.cpp
----------

  #include "TestIM.h"
  #include "TestIM.h"



TestIM.h
--------

  namespace X {
    typedef int MyINT_t;
  }

  namespace Y {
    using X::MyINT_t;
  }


http://reviews.llvm.org/D19468



_______________________________________________
llvm-commits mailing list
llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160426/b15bf804/attachment.html>


More information about the llvm-commits mailing list