[all-commits] [llvm/llvm-project] cf1bde: [clang] Fix sorting module headers (#73146)

Tulio Magno Quites Machado Filho via All-commits all-commits at lists.llvm.org
Fri Nov 24 04:17:43 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cf1bde33423da5eb9b7dc95daac4aada3167de3c
      https://github.com/llvm/llvm-project/commit/cf1bde33423da5eb9b7dc95daac4aada3167de3c
  Author: Tulio Magno Quites Machado Filho <tuliom at redhat.com>
  Date:   2023-11-24 (Fri, 24 Nov 2023)

  Changed paths:
    M clang/lib/Lex/ModuleMap.cpp

  Log Message:
  -----------
  [clang] Fix sorting module headers (#73146)

Struct Module::Header is not a POD type. As such, qsort() and
llvm::array_pod_sort() must not be used to sort it. This became an issue
with the new implementation of qsort() in glibc 2.39 that is not
guaranteed to be a stable sort, causing Headers to be re-ordered and
corrupted.

Replace the usage of llvm::array_pod_sort() with std::stable_sort() in
order to fix this issue. The signature of compareModuleHeaders() has to
be modified.

Fixes #73145.




More information about the All-commits mailing list