[all-commits] [llvm/llvm-project] 048074: [DeclContext] Sort the Decls before adding into De...

Steven Wu via All-commits all-commits at lists.llvm.org
Thu Feb 2 15:16:37 PST 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0480748ea6728392886931b8470969ae17aaa91f
  Author: Steven Wu <stevenwu at apple.com>
  Date:   2023-02-02 (Thu, 02 Feb 2023)

  Changed paths:
    M clang/lib/Parse/ParseDecl.cpp
    A clang/test/Modules/decl-params-determinisim.m

  Log Message:
  [DeclContext] Sort the Decls before adding into DeclContext

Fix a non-deterministic issue in clang module generation, which the
anonymous declaration number from a function context is not
deterministic. This is due to the unstable iteration order for decls in
scope so the order after moving the decls into function decl context is
not deterministic.

>From https://reviews.llvm.org/D135118, we can't use a set that preserves
the order without the performance penalty. Fix the issue by sorting the
decls based on raw encoding of their source location.


Reviewed By: akyrtzi, vsapsai

Differential Revision: https://reviews.llvm.org/D141625

More information about the All-commits mailing list