[llvm] 8da7abb - [dsymutil] Sort entries in YamlDMO to stabilize print order

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 19 21:02:05 PDT 2023


Author: Fangrui Song
Date: 2023-07-19T21:02:01-07:00
New Revision: 8da7abb1f847a30df808630dedaab9a2b5e63e63

URL: https://github.com/llvm/llvm-project/commit/8da7abb1f847a30df808630dedaab9a2b5e63e63
DIFF: https://github.com/llvm/llvm-project/commit/8da7abb1f847a30df808630dedaab9a2b5e63e63.diff

LOG: [dsymutil] Sort entries in YamlDMO to stabilize print order

Similar to the llvm::sort call in DebugMapObject::print.

Added: 
    

Modified: 
    llvm/test/tools/dsymutil/absolute_symbol.test
    llvm/tools/dsymutil/DebugMap.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/dsymutil/absolute_symbol.test b/llvm/test/tools/dsymutil/absolute_symbol.test
index d813d970139a9f..1724cb74366222 100644
--- a/llvm/test/tools/dsymutil/absolute_symbol.test
+++ b/llvm/test/tools/dsymutil/absolute_symbol.test
@@ -15,3 +15,4 @@ might conflict with other real symbols in the same file.
 
 CHECK: objc_class_name_Foo
 CHECK-NOT: objAddr
+CHECK: }

diff  --git a/llvm/tools/dsymutil/DebugMap.cpp b/llvm/tools/dsymutil/DebugMap.cpp
index b56784412aa3f7..5ae7217711d6d1 100644
--- a/llvm/tools/dsymutil/DebugMap.cpp
+++ b/llvm/tools/dsymutil/DebugMap.cpp
@@ -229,6 +229,7 @@ MappingTraits<dsymutil::DebugMapObject>::YamlDMO::YamlDMO(
   for (auto &Entry : Obj.Symbols)
     Entries.push_back(
         std::make_pair(std::string(Entry.getKey()), Entry.getValue()));
+  llvm::sort(Entries, llvm::less_first());
 }
 
 dsymutil::DebugMapObject


        


More information about the llvm-commits mailing list