================ @@ -69,17 +70,22 @@ class ParentMapContext::ParentMap { for (; N > 0; --N) push_back(Value); } - bool contains(const DynTypedNode &Value) { - return Seen.contains(Value); + bool contains(const DynTypedNode &Value) const { + const void *Identity = Value.getMemoizationData(); + assert(Identity); + return Dedup.contains(Identity); } void push_back(const DynTypedNode &Value) { - if (!Value.getMemoizationData() || Seen.insert(Value).second) + const void *Identity = Value.getMemoizationData(); + if (!Identity || Dedup.insert(Identity).second) { Items.push_back(Value); + } } llvm::ArrayRef<DynTypedNode> view() const { return Items; } + private: - llvm::SmallVector<DynTypedNode, 2> Items; - llvm::SmallDenseSet<DynTypedNode, 2> Seen; + std::vector<DynTypedNode> Items; ---------------- cor3ntin wrote:
I think it would be better (std::vector _always_ allocate) https://github.com/llvm/llvm-project/pull/129934 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits