[PATCH] D17884: Disallow duplication of imported entities
Amjad Aboud via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 6 04:59:12 PST 2016
aaboud added a comment.
In http://reviews.llvm.org/D17884#368482, @hintonda wrote:
> It's actually a DenseSet, which makes it even easier. Here's a partial diff -- the rest is just removing references to AllImportedModules.
>
> diff --git a/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp
> index b7841fe..9288207 100644
> --- a/lib/IR/DIBuilder.cpp
> +++ b/lib/IR/DIBuilder.cpp
> @@ -19,6 +19,7 @@
> #include "llvm/IR/Module.h"
> #include "llvm/Support/Debug.h"
> #include "llvm/Support/Dwarf.h"
> +#include "LLVMContextImpl.h"
>
> using namespace llvm;
> using namespace llvm::dwarf;
> @@ -110,10 +111,10 @@ void DIBuilder::finalize() {
> if (!AllGVs.empty())
> CUNode->replaceGlobalVariables(MDTuple::get(VMContext, AllGVs));
>
> - if (!AllImportedModules.empty())
> + if (!VMContext.pImpl->DIImportedEntitys.empty())
> CUNode->replaceImportedEntities(MDTuple::get(
> - VMContext, SmallVector<Metadata *, 16>(AllImportedModules.begin(),
> - AllImportedModules.end())));
> + VMContext, SmallVector<Metadata *, 16>(VMContext.pImpl->DIImportedEntitys.begin(),
> + VMContext.pImpl->DIImportedEntitys.end())));
>
>
It is still a set that has non-deterministic order, i.e. the order of the metadata will be different from one run to another...impossible for testing and might add more unwanted results...
The only solution is to have a VectorSet, or a vector + a Set.
http://reviews.llvm.org/D17884
More information about the llvm-commits
mailing list