summaryrefslogtreecommitdiffstats
path: root/clang/tools/driver/cc1as_main.cpp
diff options
context:
space:
mode:
authorPaul Robinson <paul.robinson@sony.com>2018-07-10 15:15:24 +0000
committerPaul Robinson <paul.robinson@sony.com>2018-07-10 15:15:24 +0000
commit9b292b45858865f754e0dbe72ec5699877adbdf9 (patch)
tree590ae3073d7ac139ceff51bcc69d4ec6cfc34f85 /clang/tools/driver/cc1as_main.cpp
parent509a1e7a9b444bccc88b57685a0e664f61c37f0e (diff)
downloadbcm5719-llvm-9b292b45858865f754e0dbe72ec5699877adbdf9.tar.gz
bcm5719-llvm-9b292b45858865f754e0dbe72ec5699877adbdf9.zip
Support -fdebug-prefix-map for assembler source (pass to cc1as). This
is useful to omit the debug compilation dir when compiling assembly files with -g. Part of PR38050. Patch by Siddhartha Bagaria! Differential Revision: https://reviews.llvm.org/D48989 llvm-svn: 336685
Diffstat (limited to 'clang/tools/driver/cc1as_main.cpp')
-rw-r--r--clang/tools/driver/cc1as_main.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp
index 05edb9f4386..09db014019b 100644
--- a/clang/tools/driver/cc1as_main.cpp
+++ b/clang/tools/driver/cc1as_main.cpp
@@ -94,6 +94,7 @@ struct AssemblerInvocation {
std::string DwarfDebugFlags;
std::string DwarfDebugProducer;
std::string DebugCompilationDir;
+ std::map<const std::string, const std::string> DebugPrefixMap;
llvm::DebugCompressionType CompressDebugSections =
llvm::DebugCompressionType::None;
std::string MainFileName;
@@ -233,6 +234,9 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
Opts.DebugCompilationDir = Args.getLastArgValue(OPT_fdebug_compilation_dir);
Opts.MainFileName = Args.getLastArgValue(OPT_main_file_name);
+ for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ))
+ Opts.DebugPrefixMap.insert(StringRef(Arg).split('='));
+
// Frontend Options
if (Args.hasArg(OPT_INPUT)) {
bool First = true;
@@ -377,6 +381,9 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts,
Ctx.setDwarfDebugProducer(StringRef(Opts.DwarfDebugProducer));
if (!Opts.DebugCompilationDir.empty())
Ctx.setCompilationDir(Opts.DebugCompilationDir);
+ if (!Opts.DebugPrefixMap.empty())
+ for (const auto &KV : Opts.DebugPrefixMap)
+ Ctx.addDebugPrefixMapEntry(KV.first, KV.second);
if (!Opts.MainFileName.empty())
Ctx.setMainFileName(StringRef(Opts.MainFileName));
Ctx.setDwarfVersion(Opts.DwarfVersion);
OpenPOWER on IntegriCloud