From e6a9b06dc0b974eb16186a71099b88a631afdf52 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 22 Jul 2023 15:29:37 -0700 Subject: [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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index bb5d1800b30c..e2beb77d196f 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -497,7 +497,7 @@ void CodeGenModule::addReplacement(StringRef Name, llvm::Constant *C) { void CodeGenModule::applyReplacements() { for (auto &I : Replacements) { - StringRef MangledName = I.first(); + StringRef MangledName = I.first; llvm::Constant *Replacement = I.second; llvm::GlobalValue *Entry = GetGlobalValue(MangledName); if (!Entry) -- cgit v1.2.3