Author: majnemer Date: Sat Jul 9 16:49:16 2016 New Revision: 274991 URL: http://llvm.org/viewvc/llvm-project?rev=274991&view=rev Log: [clang-cl] Add support for /Zd
MASM (ML.exe and ML64.exe) and older versions of MSVC (CL.exe) support a flag called /Zd which is more-or-less -gline-tables-only. It seems nicer to support this flag instead of exposing -gline-tables-only. Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/Driver/cl-options.c Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=274991&r1=274990&r2=274991&view=diff ============================================================================== --- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original) +++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Sat Jul 9 16:49:16 2016 @@ -166,6 +166,8 @@ def _SLASH_Zc_trigraphs_off : CLFlag<"Zc HelpText<"Disable trigraphs (default)">, Alias<fno_trigraphs>; def _SLASH_Z7 : CLFlag<"Z7">, HelpText<"Enable CodeView debug information in object files">; +def _SLASH_Zd : CLFlag<"Zd">, + HelpText<"Emit debug line number tables only">; def _SLASH_Zi : CLFlag<"Zi">, Alias<_SLASH_Z7>, HelpText<"Alias for /Z7. Does not produce PDBs.">; def _SLASH_Zp : CLJoined<"Zp">, Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=274991&r1=274990&r2=274991&view=diff ============================================================================== --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Sat Jul 9 16:49:16 2016 @@ -1229,7 +1229,7 @@ def fdebug_prefix_map_EQ def g_Flag : Flag<["-"], "g">, Group<g_Group>, HelpText<"Generate source-level debug information">; def gline_tables_only : Flag<["-"], "gline-tables-only">, Group<gN_Group>, - Flags<[CoreOption]>, HelpText<"Emit debug line number tables only">; + HelpText<"Emit debug line number tables only">; def gmlt : Flag<["-"], "gmlt">, Alias<gline_tables_only>; def g0 : Flag<["-"], "g0">, Group<gN_Group>; def g1 : Flag<["-"], "g1">, Group<gN_Group>, Alias<gline_tables_only>; Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=274991&r1=274990&r2=274991&view=diff ============================================================================== --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Sat Jul 9 16:49:16 2016 @@ -6269,12 +6269,18 @@ void Clang::AddClangCLArgs(const ArgList CmdArgs.push_back(Args.MakeArgString(Twine(LangOptions::SSPStrong))); } - // Emit CodeView if -Z7 is present. - *EmitCodeView = Args.hasArg(options::OPT__SLASH_Z7); - if (*EmitCodeView) - *DebugInfoKind = codegenoptions::LimitedDebugInfo; - if (*EmitCodeView) + // Emit CodeView if -Z7 or -Zd are present. + if (Arg *DebugInfoArg = + Args.getLastArg(options::OPT__SLASH_Z7, options::OPT__SLASH_Zd)) { + *EmitCodeView = true; + if (DebugInfoArg->getOption().matches(options::OPT__SLASH_Z7)) + *DebugInfoKind = codegenoptions::LimitedDebugInfo; + else + *DebugInfoKind = codegenoptions::DebugLineTablesOnly; CmdArgs.push_back("-gcodeview"); + } else { + *EmitCodeView = false; + } const Driver &D = getToolChain().getDriver(); EHFlags EH = parseClangCLEHFlags(D, Args); @@ -9964,7 +9970,8 @@ void visualstudio::Linker::ConstructJob( CmdArgs.push_back("-nologo"); - if (Args.hasArg(options::OPT_g_Group, options::OPT__SLASH_Z7)) + if (Args.hasArg(options::OPT_g_Group, options::OPT__SLASH_Z7, + options::OPT__SLASH_Zd)) CmdArgs.push_back("-debug"); bool DLL = Args.hasArg(options::OPT__SLASH_LD, options::OPT__SLASH_LDd, Modified: cfe/trunk/test/Driver/cl-options.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=274991&r1=274990&r2=274991&view=diff ============================================================================== --- cfe/trunk/test/Driver/cl-options.c (original) +++ cfe/trunk/test/Driver/cl-options.c Sat Jul 9 16:49:16 2016 @@ -420,7 +420,7 @@ // Z7: "-gcodeview" // Z7: "-debug-info-kind=limited" -// RUN: %clang_cl -gline-tables-only /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7GMLT %s +// RUN: %clang_cl /Zd /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7GMLT %s // Z7GMLT: "-gcodeview" // Z7GMLT: "-debug-info-kind=line-tables-only" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits