summaryrefslogtreecommitdiff
path: root/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2015-10-12 20:21:08 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2015-10-12 20:21:08 +0000
commitcc4221bf161ae46738eb71778fedd36e3271ea4c (patch)
treeec789639c178c29fe4d6c1101e32a158853d98be /lib/Frontend/CompilerInvocation.cpp
parentef378def97da93bae9e3e76eead6f81b3bfb1806 (diff)
downloadclang-cc4221bf161ae46738eb71778fedd36e3271ea4c.tar.gz
Support Debug Info path remapping
Add support for the `-fdebug-prefix-map=` option as in GCC. The syntax is `-fdebug-prefix-map=OLD=NEW`. When compiling files from a path beginning with OLD, change the debug info to indicate the path as start with NEW. This is particularly helpful if you are preprocessing in one path and compiling in another (e.g. for a build cluster with distcc). Note that the linearity of the implementation is not as terrible as it may seem. This is normally done once per file with an expectation that the map will be small (1-2) entries, making this roughly linear in the number of input paths. Addresses PR24619. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250094 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--lib/Frontend/CompilerInvocation.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 7667c10955..4220487e4d 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -406,6 +406,9 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Opts.SplitDwarfFile = Args.getLastArgValue(OPT_split_dwarf_file);
Opts.DebugTypeExtRefs = Args.hasArg(OPT_dwarf_ext_refs);
+ for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ))
+ Opts.DebugPrefixMap.insert(StringRef(Arg).split('='));
+
if (const Arg *A =
Args.getLastArg(OPT_emit_llvm_uselists, OPT_no_emit_llvm_uselists))
Opts.EmitLLVMUseLists = A->getOption().getID() == OPT_emit_llvm_uselists;