[CodeGen] Stabilize C2/D2 to C1/D1 replacement order
authorFangrui Song <i@maskray.me>
Sat, 22 Jul 2023 22:29:37 +0000 (15:29 -0700)
committerFangrui Song <i@maskray.me>
Sat, 22 Jul 2023 22:29:38 +0000 (15:29 -0700)
commite6a9b06dc0b974eb16186a71099b88a631afdf52
tree5cf05da8deedbc85edc016826f75843f7e0477c1
parent2b0f5df7b4e01d5b9b380fd72a19df021b9a3b98
[CodeGen] Stabilize C2/D2 to C1/D1 replacement order

The conversion iterates over CodeGenModule::Replacements (a StringMap)
and replaces C2/D2 and moves C1/D1 (
commit 0196a1d98f8a206259a4b5ce93c21807243af92f in 2013, to make the
output look nicer). The iteration order is not guaranteed to be
deterministic, and may cause destructors.cpp to exhibit different
function orders. Use a MapVector instead.

While here, fix an IWYU issue by adding an explicit include, though
MapVector is already used in CodeGenModule.h.
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/test/CodeGenCXX/destructors.cpp