diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2016-02-02 11:06:51 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2016-02-02 11:06:51 +0000 |
commit | 8c30592e184874b1c75789d879b9ddb85f0932d6 (patch) | |
tree | 18cab755cb14db93a8632ec57b9ce3600a1ea416 /clang/lib/Driver/Tools.cpp | |
parent | efd04a6c755af24e0909f42f60ea1cc671840310 (diff) | |
download | bcm5719-llvm-8c30592e184874b1c75789d879b9ddb85f0932d6.tar.gz bcm5719-llvm-8c30592e184874b1c75789d879b9ddb85f0932d6.zip |
Move DebugInfoKind into its own header to cut the cyclic dependency edge from Driver to Frontend.
llvm-svn: 259489
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 2819ab39885..29bdbfc088b 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -2507,16 +2507,16 @@ static bool UseRelaxAll(Compilation &C, const ArgList &Args) { // Convert an arg of the form "-gN" or "-ggdbN" or one of their aliases // to the corresponding DebugInfoKind. -static CodeGenOptions::DebugInfoKind DebugLevelToInfoKind(const Arg &A) { +static codegenoptions::DebugInfoKind DebugLevelToInfoKind(const Arg &A) { assert(A.getOption().matches(options::OPT_gN_Group) && "Not a -g option that specifies a debug-info level"); if (A.getOption().matches(options::OPT_g0) || A.getOption().matches(options::OPT_ggdb0)) - return CodeGenOptions::NoDebugInfo; + return codegenoptions::NoDebugInfo; if (A.getOption().matches(options::OPT_gline_tables_only) || A.getOption().matches(options::OPT_ggdb1)) - return CodeGenOptions::DebugLineTablesOnly; - return CodeGenOptions::LimitedDebugInfo; + return codegenoptions::DebugLineTablesOnly; + return codegenoptions::LimitedDebugInfo; } // Extract the integer N from a string spelled "-dwarf-N", returning 0 @@ -2532,17 +2532,17 @@ static unsigned DwarfVersionNum(StringRef ArgValue) { } static void RenderDebugEnablingArgs(const ArgList &Args, ArgStringList &CmdArgs, - CodeGenOptions::DebugInfoKind DebugInfoKind, + codegenoptions::DebugInfoKind DebugInfoKind, unsigned DwarfVersion, llvm::DebuggerKind DebuggerTuning) { switch (DebugInfoKind) { - case CodeGenOptions::DebugLineTablesOnly: + case codegenoptions::DebugLineTablesOnly: CmdArgs.push_back("-debug-info-kind=line-tables-only"); break; - case CodeGenOptions::LimitedDebugInfo: + case codegenoptions::LimitedDebugInfo: CmdArgs.push_back("-debug-info-kind=limited"); break; - case CodeGenOptions::FullDebugInfo: + case codegenoptions::FullDebugInfo: CmdArgs.push_back("-debug-info-kind=standalone"); break; default: @@ -2679,9 +2679,9 @@ static void CollectArgsForIntegratedAssembler(Compilation &C, if (DwarfVersion == 0) { // Send it onward, and let cc1as complain. CmdArgs.push_back(Value.data()); } else { - RenderDebugEnablingArgs( - Args, CmdArgs, CodeGenOptions::LimitedDebugInfo, DwarfVersion, - llvm::DebuggerKind::Default); + RenderDebugEnablingArgs(Args, CmdArgs, + codegenoptions::LimitedDebugInfo, + DwarfVersion, llvm::DebuggerKind::Default); } } else if (Value.startswith("-mcpu") || Value.startswith("-mfpu") || Value.startswith("-mhwdiv") || Value.startswith("-march")) { @@ -4113,8 +4113,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, unsigned DwarfVersion = 0; llvm::DebuggerKind DebuggerTuning = getToolChain().getDefaultDebuggerTuning(); // These two are potentially updated by AddClangCLArgs. - enum CodeGenOptions::DebugInfoKind DebugInfoKind = - CodeGenOptions::NoDebugInfo; + codegenoptions::DebugInfoKind DebugInfoKind = codegenoptions::NoDebugInfo; bool EmitCodeView = false; // Add clang-cl arguments. @@ -4169,12 +4168,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // If you say "-gsplit-dwarf -gline-tables-only", -gsplit-dwarf loses. // But -gsplit-dwarf is not a g_group option, hence we have to check the // order explicitly. (If -gsplit-dwarf wins, we fix DebugInfoKind later.) - if (SplitDwarfArg && DebugInfoKind < CodeGenOptions::LimitedDebugInfo && + if (SplitDwarfArg && DebugInfoKind < codegenoptions::LimitedDebugInfo && A->getIndex() > SplitDwarfArg->getIndex()) SplitDwarfArg = nullptr; } else // For any other 'g' option, use Limited. - DebugInfoKind = CodeGenOptions::LimitedDebugInfo; + DebugInfoKind = codegenoptions::LimitedDebugInfo; } // If a debugger tuning argument appeared, remember it. @@ -4199,7 +4198,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // DwarfVersion remains at 0 if no explicit choice was made. CmdArgs.push_back("-gcodeview"); } else if (DwarfVersion == 0 && - DebugInfoKind != CodeGenOptions::NoDebugInfo) { + DebugInfoKind != codegenoptions::NoDebugInfo) { DwarfVersion = getToolChain().GetDefaultDwarfVersion(); } @@ -4213,7 +4212,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // FIXME: Move backend command line options to the module. if (Args.hasArg(options::OPT_gmodules)) { - DebugInfoKind = CodeGenOptions::LimitedDebugInfo; + DebugInfoKind = codegenoptions::LimitedDebugInfo; CmdArgs.push_back("-dwarf-ext-refs"); CmdArgs.push_back("-fmodule-format=obj"); } @@ -4222,7 +4221,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // splitting and extraction. // FIXME: Currently only works on Linux. if (getToolChain().getTriple().isOSLinux() && SplitDwarfArg) { - DebugInfoKind = CodeGenOptions::LimitedDebugInfo; + DebugInfoKind = codegenoptions::LimitedDebugInfo; CmdArgs.push_back("-backend-option"); CmdArgs.push_back("-split-dwarf=Enable"); } @@ -4235,8 +4234,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, bool NeedFullDebug = Args.hasFlag(options::OPT_fstandalone_debug, options::OPT_fno_standalone_debug, getToolChain().GetDefaultStandaloneDebug()); - if (DebugInfoKind == CodeGenOptions::LimitedDebugInfo && NeedFullDebug) - DebugInfoKind = CodeGenOptions::FullDebugInfo; + if (DebugInfoKind == codegenoptions::LimitedDebugInfo && NeedFullDebug) + DebugInfoKind = codegenoptions::FullDebugInfo; RenderDebugEnablingArgs(Args, CmdArgs, DebugInfoKind, DwarfVersion, DebuggerTuning); @@ -5823,7 +5822,7 @@ static EHFlags parseClangCLEHFlags(const Driver &D, const ArgList &Args) { } void Clang::AddClangCLArgs(const ArgList &Args, ArgStringList &CmdArgs, - enum CodeGenOptions::DebugInfoKind *DebugInfoKind, + codegenoptions::DebugInfoKind *DebugInfoKind, bool *EmitCodeView) const { unsigned RTOptionID = options::OPT__SLASH_MT; @@ -5893,7 +5892,7 @@ void Clang::AddClangCLArgs(const ArgList &Args, ArgStringList &CmdArgs, // If we are emitting CV but not DWARF, don't build information that LLVM // can't yet process. if (*EmitCodeView && !EmitDwarf) - *DebugInfoKind = CodeGenOptions::DebugLineTablesOnly; + *DebugInfoKind = codegenoptions::DebugLineTablesOnly; if (*EmitCodeView) CmdArgs.push_back("-gcodeview"); @@ -6057,8 +6056,8 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA, if (DwarfVersion == 0) DwarfVersion = getToolChain().GetDefaultDwarfVersion(); RenderDebugEnablingArgs(Args, CmdArgs, - (WantDebug ? CodeGenOptions::LimitedDebugInfo - : CodeGenOptions::NoDebugInfo), + (WantDebug ? codegenoptions::LimitedDebugInfo + : codegenoptions::NoDebugInfo), DwarfVersion, llvm::DebuggerKind::Default); // Add the -fdebug-compilation-dir flag if needed. |