[clang] [clang][AST] Add 'IgnoreTemplateParmDepth' to structural equivalence cache (PR #115518)
Michael Buch via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 11 13:04:01 PST 2024
Michael137 wrote:
> > Another possible solution: Use two `NonEquivalentDecls` sets, one for `IgnoreTemplateParmDepth = true` and one for `false`. This may use less memory (no rarely used third value in the key) but requires more code changes.
>
> I like this idea, and I think it can be implemented without significant code changes -- see my inline comments for details.
>
> (Disclaimer: I didn't check my change so there might be other locations where you didn't need to change between the old "set of pairs" and your "set of 3-tuples", but the suggested "two sets of pairs in an array" would behave differently -- but it would be a simplification even if you needed one or two lines of additional logic.)
>
> However the current "set of 3-tuples" approach is also OK if you prefer it.
One thing I don't like about having two separate caches is the prospect of what this looks like if we add another parameter affecting the equivalence. For example, we already have another parameter `StrictTypeSpelling`, which by the looks of it could affect the result of an equivalence check. That just doesn't feel like a future-proof solution. Encoding the flag that affects that hash of the cache entry in the entry itself (like @balazske did in the first iteration of this PR) would be my preferred approach.
https://github.com/llvm/llvm-project/pull/115518
More information about the cfe-commits
mailing list