[PATCH] D145098: [clang][deps] Preserve input ordering in the full output

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 1 11:37:59 PST 2023


jansvoboda11 created this revision.
jansvoboda11 added reviewers: Bigcheese, benlangmuir.
Herald added subscribers: ributzka, mgrang.
Herald added a project: All.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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 instead of appending, writes to the index corresponding to the current input. This also 
eliminates one critical section.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145098

Files:
  clang/test/ClangScanDeps/modules-full-output-tu-order.c
  clang/test/ClangScanDeps/modules-full.cpp
  clang/tools/clang-scan-deps/ClangScanDeps.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145098.501608.patch
Type: text/x-patch
Size: 7036 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230301/07f51c49/attachment.bin>


More information about the cfe-commits mailing list