[llvm] [NFC][YAML][IR] Output CfiFunction sorted (PR #130379)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 7 17:40:06 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Vitaly Buka (vitalybuka)
<details>
<summary>Changes</summary>
We are changing internals of `CfiFunctionDefs` and
`CfiFunctionDecls` so they will be ordered by GUID.
Sorting by name is unnecessary but good for
readability and tests.
---
Full diff: https://github.com/llvm/llvm-project/pull/130379.diff
1 Files Affected:
- (modified) llvm/include/llvm/IR/ModuleSummaryIndexYAML.h (+8-4)
``````````diff
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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/130379
More information about the llvm-commits
mailing list