================ @@ -61,7 +61,28 @@ class ParentMapContext::ParentMap { template <typename, typename...> friend struct ::MatchParents; /// Contains parents of a node. - using ParentVector = llvm::SmallVector<DynTypedNode, 2>; + class ParentVector { + public: + ParentVector() = default; + explicit ParentVector(size_t n, const DynTypedNode &value) { + Items.reserve(n); + for (; n > 0; --n) { + push_back(value); + } + } + bool contains(const DynTypedNode &value) { + return Seen.contains(value); + } + void push_back(const DynTypedNode &value) { + if (!value.getMemoizationData() || Seen.insert(value).second) { + Items.push_back(value); + } ---------------- AaronBallman wrote:
```suggestion explicit ParentVector(size_t N, const DynTypedNode &Value) { Items.reserve(N); for (; N > 0; --N) push_back(Value); } bool contains(const DynTypedNode &Value) { return Seen.contains(Value); } void push_back(const DynTypedNode &Value) { if (!Value.getMemoizationData() || Seen.insert(Value).second) Items.push_back(Value); ``` Changes to match our coding style, NFC. Regarding: ``` for (; N > 0; --N) push_back(Value); ``` should we use `std::fill_n` instead? https://github.com/llvm/llvm-project/pull/87824 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits