[PATCH] D148975: -fdebug-prefix-map=: make the last win when multiple prefixes match

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 21 17:47:42 PDT 2023


MaskRay created this revision.
MaskRay added reviewers: debug-info, dankm, gulfem, phosek.
Herald added subscribers: hiraditya, emaste.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, cfe-commits, jplehr, sstefan1.
Herald added projects: clang, LLVM.

For
`clang -c -g -fdebug-prefix-map=a/b=y -fdebug-prefix-map=a=x a/b/c.c`,
we apply the longest prefix substitution, but
GCC has always been picking the last applicable option (`a=x`, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109591).

I feel that GCC's behavior is reasonable given the convention that the last
value wins for the same option.

Before D49466 <https://reviews.llvm.org/D49466>, Clang appeared to apply the shortest prefix substitution,
which likely made the least sense.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148975

Files:
  clang/include/clang/Basic/CodeGenOptions.h
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/debug-prefix-map.c
  clang/tools/driver/cc1as_main.cpp
  llvm/include/llvm/MC/MCContext.h
  llvm/lib/MC/MCContext.cpp
  llvm/test/MC/ELF/debug-prefix-map.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148975.515967.patch
Type: text/x-patch
Size: 7955 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230422/dfb780e0/attachment-0001.bin>


More information about the cfe-commits mailing list