[PATCH] D17884: Disallow duplication of imported entities

Amjad Aboud via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 4 04:42:06 PST 2016


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;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17884.49815.patch
Type: text/x-patch
Size: 597 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160304/3de6b2df/attachment.bin>


More information about the llvm-commits mailing list