[all-commits] [llvm/llvm-project] daad48: -fdebug-prefix-map=: make the last win when multip...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Apr 25 15:12:31 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: daad48d6b236d74c6b29daebba46289b98104241
      https://github.com/llvm/llvm-project/commit/daad48d6b236d74c6b29daebba46289b98104241
  Author: Fangrui Song <i at maskray.me>
  Date:   2023-04-25 (Tue, 25 Apr 2023)

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

  Log Message:
  -----------
  -fdebug-prefix-map=: make the last win when multiple prefixes match

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, Clang appeared to apply the shortest prefix substitution,
which likely made the least sense.

Reviewed By: #debug-info, scott.linder

Differential Revision: https://reviews.llvm.org/D148975




More information about the All-commits mailing list