[PATCH] D141625: [DeclContext] Sort the Decls before adding into DeclContext

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 13 14:48:04 PST 2023


rsmith added a comment.

In D141625#4052820 <https://reviews.llvm.org/D141625#4052820>, @dblaikie wrote:

> Yeah, might be nice to document where the instability comes from - if it comes from a DenseMap or similar, then a test that fails either in forward or reverse iteration mode would be nice to have.

`Scope::decls` is iterating over a `SmallPtrSet`. This might be a little annoying to create a test for, because it'll only be unstable if we have two decls in the same prototype scope that get allocated into different slabs by the bump ptr allocator, but maybe something like:

  void f(struct A *p, sizeof(0 + 0 + 0 + 0 + ... + 0), struct B *q);

... would be enough (with sufficient subexpressions to fill a whole slab). Then we can build a .pch for that twice and check that it comes out identical.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141625/new/

https://reviews.llvm.org/D141625



More information about the cfe-commits mailing list