Revert "Revert "Make the DWARF version emitted by the Swift compiler configurable.""

This commit is contained in:
Adrian Prantl
2023-10-26 12:29:18 -07:00
committed by GitHub
parent 7afa4cfdc6
commit 5d978b44ca
19 changed files with 104 additions and 69 deletions

View File

@@ -2472,7 +2472,6 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
Opts.DebugCompilationDir = std::string(cwd.str());
}
}
if (const Arg *A = Args.getLastArg(options::OPT_debug_info_format)) {
if (A->containsValue("dwarf"))
Opts.DebugInfoFormat = IRGenDebugInfoFormat::DWARF;
@@ -2502,6 +2501,16 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
: "-gdwarf_types");
}
if (auto A = Args.getLastArg(OPT_dwarf_version)) {
unsigned vers;
if (!StringRef(A->getValue()).getAsInteger(10, vers) && vers >= 2 &&
vers <= 5)
Opts.DWARFVersion = vers;
else
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
A->getAsString(Args), A->getValue());
}
for (auto A : Args.getAllArgValues(options::OPT_file_prefix_map)) {
auto SplitMap = StringRef(A).split('=');
Opts.FilePrefixMap.addMapping(SplitMap.first, SplitMap.second);