[clang-tools-extra] [clang-tidy] Prefer the faster LLVM ADT sets and maps over `std::` ones (PR #174357)

Victor Chernyakin via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 5 07:24:08 PST 2026


localspook wrote:

> have to switch to .begin()/.end()

To confirm, you're referring to changes like these?
```diff
-SuppressMacroExpansions->insert(Range);
+SuppressMacroExpansions->insert({Range.getBegin(), Range.getEnd()});
```
That's a consequence of there being no `DenseMapInfo` specialization for `SourceRange`, so the code has to "decompose" it into a `std::pair<SourceLocation, SourceLocation>`. I could go and open a PR to implement that specialization, then come back here and fix that downgrade in readability. Would you like that?

> There's also history of replacing ADT types with STL ones (e.g. std::optional).

True, but that's in cases where the LLVM alternatives were basically identical to the `std::` ones. Here there's a performance argument in favour of the LLVM types.

> Impl vs non-Impl classes

(see response under the review comment)

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


More information about the cfe-commits mailing list