Add support for passing the main file name down to the assembler
for location information.
Part of PR14624
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170391 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/driver/cc1as_main.cpp b/tools/driver/cc1as_main.cpp
index 73be56c..f01d97d 100644
--- a/tools/driver/cc1as_main.cpp
+++ b/tools/driver/cc1as_main.cpp
@@ -84,6 +84,7 @@
unsigned GenDwarfForAssembly : 1;
std::string DwarfDebugFlags;
std::string DebugCompilationDir;
+ std::string MainFileName;
/// @}
/// @name Frontend Options
@@ -183,6 +184,7 @@
Opts.GenDwarfForAssembly = Args->hasArg(OPT_g);
Opts.DwarfDebugFlags = Args->getLastArgValue(OPT_dwarf_debug_flags);
Opts.DebugCompilationDir = Args->getLastArgValue(OPT_fdebug_compilation_dir);
+ Opts.MainFileName = Args->getLastArgValue(OPT_main_file_name);
// Frontend Options
if (Args->hasArg(OPT_INPUT)) {
@@ -309,6 +311,8 @@
Ctx.setDwarfDebugFlags(StringRef(Opts.DwarfDebugFlags));
if (!Opts.DebugCompilationDir.empty())
Ctx.setCompilationDir(Opts.DebugCompilationDir);
+ if (!Opts.MainFileName.empty())
+ Ctx.setMainFileName(StringRef(Opts.MainFileName));
// Build up the feature string from the target feature list.
std::string FS;