[all-commits] [llvm/llvm-project] 864054: [clang][deps] Preserve input ordering in the full ...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Thu Mar 2 13:42:25 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 864054500830d708cc9f7d8a53195a95488e4e0b
      https://github.com/llvm/llvm-project/commit/864054500830d708cc9f7d8a53195a95488e4e0b
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2023-03-02 (Thu, 02 Mar 2023)

  Changed paths:
    A clang/test/ClangScanDeps/modules-full-output-tu-order.c
    M clang/test/ClangScanDeps/modules-full.cpp
    M clang/tools/clang-scan-deps/ClangScanDeps.cpp

  Log Message:
  -----------
  [clang][deps] Preserve input ordering in the full output

This patch makes sure the ordering of TUs in the input CDB is preserved in the full output. Previously, the results were pushed into a global vector, potentially out-of-order and then sorted by the input file name. This is non-deterministic when the CDB contains multiple entries with the same input file. This patch fixes that by pre-allocating the output vector and writing directly to the position corresponding to the current input. This also eliminates one critical section.

Reviewed By: benlangmuir

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




More information about the All-commits mailing list