[llvm] [NFC][YAML][IR] Output CfiFunction sorted (PR #130379)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 8 08:52:23 PST 2025


https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/130379

>From 0e58030f96f40f39b209b6d6b1f858a77e92bb07 Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Fri, 7 Mar 2025 17:39:18 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 llvm/include/llvm/IR/ModuleSummaryIndexYAML.h | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h b/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h
index 14b8ce5df8536..adcd17783d6c0 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h
@@ -9,8 +9,10 @@
 #ifndef LLVM_IR_MODULESUMMARYINDEXYAML_H
 #define LLVM_IR_MODULESUMMARYINDEXYAML_H
 
+#include "llvm/ADT/StringRef.h"
 #include "llvm/IR/ModuleSummaryIndex.h"
 #include "llvm/Support/YAMLTraits.h"
+#include <algorithm>
 
 namespace llvm {
 namespace yaml {
@@ -345,11 +347,13 @@ template <> struct MappingTraits<ModuleSummaryIndex> {
                    index.WithGlobalValueDeadStripping);
 
     if (io.outputting()) {
-      std::vector<std::string> CfiFunctionDefs(index.CfiFunctionDefs.begin(),
-                                               index.CfiFunctionDefs.end());
+      std::vector<StringRef> CfiFunctionDefs(index.CfiFunctionDefs.begin(),
+                                             index.CfiFunctionDefs.end());
+      std::sort(CfiFunctionDefs.begin(), CfiFunctionDefs.end());
       io.mapOptional("CfiFunctionDefs", CfiFunctionDefs);
-      std::vector<std::string> CfiFunctionDecls(index.CfiFunctionDecls.begin(),
-                                                index.CfiFunctionDecls.end());
+      std::vector<StringRef> CfiFunctionDecls(index.CfiFunctionDecls.begin(),
+                                              index.CfiFunctionDecls.end());
+      std::sort(CfiFunctionDecls.begin(), CfiFunctionDecls.end());
       io.mapOptional("CfiFunctionDecls", CfiFunctionDecls);
     } else {
       std::vector<std::string> CfiFunctionDefs;



More information about the llvm-commits mailing list