[PATCH] D17884: Disallow duplication of imported entities

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 4 13:47:15 PST 2016


(please include the fix in the patch for review)

I think the fix could probably happen at a higher level to avoid the linear
search. Perhaps we could get the canonical decl for a using decl - that way
a redecl wouldn't be a 'new' thing? I suppose we'd still need a map of
them, that perhaps we don't have already.

On Fri, Mar 4, 2016 at 4:42 AM, Amjad Aboud via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> aaboud created this revision.
> aaboud added reviewers: aprantl, dblaikie.
> aaboud added a subscriber: llvm-commits.
>
> Fixed DIBuilder to verify that same imported entity will not be added
> twice to the "imports" list of the DICompileUnit.
>
> http://reviews.llvm.org/D17884
>
> Files:
>   lib/IR/DIBuilder.cpp
>
> Index: lib/IR/DIBuilder.cpp
> ===================================================================
> --- lib/IR/DIBuilder.cpp
> +++ lib/IR/DIBuilder.cpp
> @@ -169,6 +169,11 @@
>                       Metadata *NS, unsigned Line, StringRef Name,
>                       SmallVectorImpl<TrackingMDNodeRef>
> &AllImportedModules) {
>    auto *M = DIImportedEntity::get(C, Tag, Context, DINodeRef(NS), Line,
> Name);
> +  // Assure no duplications in AllImportedModules list.
> +  for (auto IM : AllImportedModules) {
> +    if (IM == M)
> +      return M;
> +  }
>    AllImportedModules.emplace_back(M);
>    return M;
>  }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160304/8cd36396/attachment.html>


More information about the llvm-commits mailing list