diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/BackendUtil.cpp | 1 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 3 | ||||
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 2 |
4 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 765c403fd15..bac1e89820a 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -573,6 +573,7 @@ void EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) { Options.DisableIntegratedAS = CodeGenOpts.DisableIntegratedAS; Options.CompressDebugSections = CodeGenOpts.CompressDebugSections; Options.RelaxELFRelocations = CodeGenOpts.RelaxELFRelocations; + Options.DebugInfoForProfiling = CodeGenOpts.DebugInfoForProfiling; // Set EABI version. Options.EABIVersion = llvm::StringSwitch<llvm::EABI>(TargetOpts.EABIVersion) diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 12a68036b09..c3dd53f12e2 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -2774,9 +2774,10 @@ void CGDebugInfo::collectFunctionDeclProps(GlobalDecl GD, llvm::DIFile *Unit, } // No need to replicate the linkage name if it isn't different from the // subprogram name, no need to have it at all unless coverage is enabled or - // debug is set to more than just line tables. + // debug is set to more than just line tables or extra debug info is needed. if (LinkageName == Name || (!CGM.getCodeGenOpts().EmitGcovArcs && !CGM.getCodeGenOpts().EmitGcovNotes && + !CGM.getCodeGenOpts().DebugInfoForProfiling && DebugKind <= codegenoptions::DebugLineTablesOnly)) LinkageName = StringRef(); diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index e7c6f22c95d..cb11f5d6f59 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -5615,6 +5615,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, A->render(Args, CmdArgs); } + if (Args.hasFlag(options::OPT_fdebug_info_for_profiling, + options::OPT_fno_debug_info_for_profiling, false)) + CmdArgs.push_back("-fdebug-info-for-profiling"); + // -fbuiltin is default unless -mkernel is used. bool UseBuiltins = Args.hasFlag(options::OPT_fbuiltin, options::OPT_fno_builtin, diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 8256edd988e..7576d6d4e5e 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -544,6 +544,8 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, Opts.DisableIntegratedAS = Args.hasArg(OPT_fno_integrated_as); Opts.Autolink = !Args.hasArg(OPT_fno_autolink); Opts.SampleProfileFile = Args.getLastArgValue(OPT_fprofile_sample_use_EQ); + Opts.DebugInfoForProfiling = Args.hasFlag( + OPT_fdebug_info_for_profiling, OPT_fno_debug_info_for_profiling, false); setPGOInstrumentor(Opts, Args, Diags); Opts.InstrProfileOutput = |