[llvm] 3922ec4 - [MCContext] Reverse order of DebugPrefixMap sort for generated assembly debug info
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 24 21:43:50 PDT 2022
Author: Dan McGregor
Date: 2022-08-24T21:43:41-07:00
New Revision: 3922ec46b84a877a9ac6ce4cfa765c4c847d097d
URL: https://github.com/llvm/llvm-project/commit/3922ec46b84a877a9ac6ce4cfa765c4c847d097d
DIFF: https://github.com/llvm/llvm-project/commit/3922ec46b84a877a9ac6ce4cfa765c4c847d097d.diff
LOG: [MCContext] Reverse order of DebugPrefixMap sort for generated assembly debug info
Match Clang's sorting, so that longer (more specific) prefix paths will match
before less specific paths.
Reviewed By: MaskRay, raj.khem, #debug-info
Differential Revision: https://reviews.llvm.org/D132390
Added:
Modified:
llvm/include/llvm/MC/MCContext.h
llvm/test/MC/ELF/debug-prefix-map.s
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCContext.h b/llvm/include/llvm/MC/MCContext.h
index 595207b277a78..c20ce79ee4d08 100644
--- a/llvm/include/llvm/MC/MCContext.h
+++ b/llvm/include/llvm/MC/MCContext.h
@@ -190,7 +190,8 @@ class MCContext {
SmallString<128> CompilationDir;
/// Prefix replacement map for source file information.
- std::map<const std::string, const std::string> DebugPrefixMap;
+ std::map<std::string, const std::string, std::greater<std::string>>
+ DebugPrefixMap;
/// The main file name if passed in explicitly.
std::string MainFileName;
diff --git a/llvm/test/MC/ELF/debug-prefix-map.s b/llvm/test/MC/ELF/debug-prefix-map.s
index 4e4041d909ee5..28a0bb03a45c7 100644
--- a/llvm/test/MC/ELF/debug-prefix-map.s
+++ b/llvm/test/MC/ELF/debug-prefix-map.s
@@ -1,5 +1,5 @@
-# RUN: rm -rf %t.foo && mkdir %t.foo && cd %t.foo
-# RUN: cp %s %t.foo/src.s
+# RUN: rm -rf %t.foo && mkdir -p %t.foo/bar && cd %t.foo
+# RUN: cp %s %t.foo/src.s && cp %s %t.foo/bar/src.s
# RUN: llvm-mc -triple=x86_64 -g -dwarf-version=4 src.s -filetype=obj -o nomap.4.o
# RUN: llvm-dwarfdump -v -debug-info -debug-line nomap.4.o | FileCheck --check-prefix=NO_MAP_V4 %s
@@ -11,9 +11,10 @@
# RUN: llvm-mc -triple=x86_64 -g -dwarf-version=5 src.s -filetype=obj -o map.5.o -fdebug-prefix-map=%t.foo=src_root
# RUN: llvm-dwarfdump -v -debug-info -debug-line map.5.o | FileCheck --check-prefix=MAP_V5 %s
-# RUN: llvm-mc -triple=x86_64 -g -dwarf-version=4 %t.foo/src.s -filetype=obj -o mapabs.4.o -fdebug-prefix-map=%t.foo=/src_root
+# RUN: cd %t.foo/bar
+# RUN: llvm-mc -triple=x86_64 -g -dwarf-version=4 %t.foo%{fs-sep}bar%{fs-sep}src.s -filetype=obj -o mapabs.4.o -fdebug-prefix-map=%t.foo=/broken_root -fdebug-prefix-map=%t.foo%{fs-sep}bar=/src_root
# RUN: llvm-dwarfdump -v -debug-info -debug-line mapabs.4.o | FileCheck --check-prefix=MAPABS_V4 %s
-# RUN: llvm-mc -triple=x86_64 -g -dwarf-version=5 %t.foo/src.s -filetype=obj -o mapabs.5.o -fdebug-prefix-map=%t.foo=/src_root
+# RUN: llvm-mc -triple=x86_64 -g -dwarf-version=5 %t.foo%{fs-sep}bar%{fs-sep}src.s -filetype=obj -o mapabs.5.o -fdebug-prefix-map=%t.foo%{fs-sep}bar=/src_root -fdebug-prefix-map=%t.foo=/broken_root
# RUN: llvm-dwarfdump -v -debug-info -debug-line mapabs.5.o | FileCheck --check-prefix=MAPABS_V5 %s
f:
More information about the llvm-commits
mailing list