aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2023-04-25 15:12:17 -0700
committerFangrui Song <i@maskray.me>2023-04-25 15:12:17 -0700
commitdaad48d6b236d74c6b29daebba46289b98104241 (patch)
treeab1e8214d46ecacfb69c6241a6a9a6085f14d793 /clang/lib/Frontend/CompilerInvocation.cpp
parenta79e9096ca7659dd2d3b0a297ef0be3e5725530c (diff)
downloadllvm-daad48d6b236d74c6b29daebba46289b98104241.zip
llvm-daad48d6b236d74c6b29daebba46289b98104241.tar.gz
llvm-daad48d6b236d74c6b29daebba46289b98104241.tar.bz2
-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
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 71204de..a148136 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1696,8 +1696,7 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ)) {
auto Split = StringRef(Arg).split('=');
- Opts.DebugPrefixMap.insert(
- {std::string(Split.first), std::string(Split.second)});
+ Opts.DebugPrefixMap.emplace_back(Split.first, Split.second);
}
for (const auto &Arg : Args.getAllArgValues(OPT_fcoverage_prefix_map_EQ)) {