higher-performance wrote: So, this is going to sound very silly, but it seems I may have missed the obvious, and the solution may have been extremely simple: `llvm::SmallPtrSet`, on the return value of `clang::DynTypedNode::getMemoizationData()`.
The reason is that the original code only ever inserts into the vector whenever `getMemoizationData()` returned non-NULL: https://github.com/llvm/llvm-project/blob/a3c248db87ebe88084386950846678c9a52dd7c0/clang/lib/AST/ParentMapContext.cpp#L388-L391 Specifically, `llvm::is_contained(*Vector, node)` (and thus `Vector->contains(node)`) is only ever called when `node.getMemoizationData()` returns non-NULL. There was no containment check in the case where memoization data was absent, so we can just use pointer identity on `getMemoizationData()`. This drastically simplifies everything - please take another look and let me know if you see any issues! 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