[clang-cl] Make -gline-tables-only imply -gcodeview

It's surprising that you have to pass /Z7 in addition to -gcodeview to
get debug info. The sanitizer runtime, for example, expects that if the
compiler supports the -gline-tables-only flag, then it will emit debug
info.

llvm-svn: 278139
This commit is contained in:
Reid Kleckner 2016-08-09 17:23:56 +00:00
parent 037e540f08
commit bab5a5d704
2 changed files with 9 additions and 4 deletions

View File

@ -4611,8 +4611,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
options::OPT_gdwarf_4, options::OPT_gdwarf_5))
DwarfVersion = DwarfVersionNum(A->getSpelling());
// Forward -gcodeview.
// 'EmitCodeView might have been set by CL-compatibility argument parsing.
// Forward -gcodeview. EmitCodeView might have been set by CL-compatibility
// argument parsing.
if (Args.hasArg(options::OPT_gcodeview) || EmitCodeView) {
// DwarfVersion remains at 0 if no explicit choice was made.
CmdArgs.push_back("-gcodeview");
@ -6402,9 +6402,10 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType,
CmdArgs.push_back(Args.MakeArgString(Twine(LangOptions::SSPStrong)));
}
// Emit CodeView if -Z7 or -Zd are present.
// Emit CodeView if -Z7, -Zd, or -gline-tables-only are present.
if (Arg *DebugInfoArg =
Args.getLastArg(options::OPT__SLASH_Z7, options::OPT__SLASH_Zd)) {
Args.getLastArg(options::OPT__SLASH_Z7, options::OPT__SLASH_Zd,
options::OPT_gline_tables_only)) {
*EmitCodeView = true;
if (DebugInfoArg->getOption().matches(options::OPT__SLASH_Z7))
*DebugInfoKind = codegenoptions::LimitedDebugInfo;

View File

@ -424,6 +424,10 @@
// Z7GMLT: "-gcodeview"
// Z7GMLT: "-debug-info-kind=line-tables-only"
// RUN: %clang_cl -gline-tables-only /c -### -- %s 2>&1 | FileCheck -check-prefix=ZGMLT %s
// ZGMLT: "-gcodeview"
// ZGMLT: "-debug-info-kind=line-tables-only"
// RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=BreproDefault %s
// BreproDefault: "-mincremental-linker-compatible"