[clang-tools-extra] [clang-tools-extra] Use llvm::unique (NFC) (PR #136514)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 21 23:59:46 PDT 2025


kazutakahirata wrote:

> May I ask what is the reason for this change? What problem does std::unique have that llvm::unique solves?

- `llvm::unique(Foo)` is shorter than `std::unique(Foo.begin(), and Foo.end())`.
- `llvm::unique(Foo)` prevents us from mistakenly specifying two unrelated iterators like `std::unique(This.begin(), That.end())`.

https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/ADT/STLExtras.h has a collection of similar functions.



https://github.com/llvm/llvm-project/pull/136514


More information about the cfe-commits mailing list