diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 5 | ||||
-rw-r--r-- | clang/lib/Driver/ToolChains/Clang.cpp | 17 | ||||
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 8 |
3 files changed, 21 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index dbf6ae5dc8a..02d716abd6f 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -581,9 +581,8 @@ void CGDebugInfo::CreateCompileUnit() { 0 /* DWOid */, CGOpts.SplitDwarfInlining, CGOpts.DebugInfoForProfiling, CGM.getTarget().getTriple().isNVPTX() ? llvm::DICompileUnit::DebugNameTableKind::None - : CGOpts.GnuPubnames - ? llvm::DICompileUnit::DebugNameTableKind::GNU - : llvm::DICompileUnit::DebugNameTableKind::Default); + : static_cast<llvm::DICompileUnit::DebugNameTableKind>( + CGOpts.DebugNameTable)); } llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) { diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 66b9082b2a0..68ad03d7ef1 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -3060,11 +3060,18 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D, CmdArgs.push_back("-debug-info-macro"); // -ggnu-pubnames turns on gnu style pubnames in the backend. - if (Args.hasFlag(options::OPT_ggnu_pubnames, options::OPT_gno_gnu_pubnames, - false)) - if (checkDebugInfoOption(Args.getLastArg(options::OPT_ggnu_pubnames), Args, - D, TC)) - CmdArgs.push_back("-ggnu-pubnames"); + const auto *PubnamesArg = + Args.getLastArg(options::OPT_ggnu_pubnames, options::OPT_gno_gnu_pubnames, + options::OPT_gpubnames, options::OPT_gno_pubnames); + if (SplitDWARFArg || + (PubnamesArg && checkDebugInfoOption(PubnamesArg, Args, D, TC))) + if (!PubnamesArg || + (!PubnamesArg->getOption().matches(options::OPT_gno_gnu_pubnames) && + !PubnamesArg->getOption().matches(options::OPT_gno_pubnames))) + CmdArgs.push_back(PubnamesArg && PubnamesArg->getOption().matches( + options::OPT_gpubnames) + ? "-gpubnames" + : "-ggnu-pubnames"); // -gdwarf-aranges turns on the emission of the aranges section in the // backend. diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index a4beeabdaef..ded2d421995 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -55,6 +55,7 @@ #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Triple.h" #include "llvm/ADT/Twine.h" +#include "llvm/IR/DebugInfoMetadata.h" #include "llvm/Linker/Linker.h" #include "llvm/MC/MCTargetOptions.h" #include "llvm/Option/Arg.h" @@ -643,7 +644,12 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, 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); - Opts.GnuPubnames = Args.hasArg(OPT_ggnu_pubnames); + Opts.DebugNameTable = static_cast<unsigned>( + Args.hasArg(OPT_ggnu_pubnames) + ? llvm::DICompileUnit::DebugNameTableKind::GNU + : Args.hasArg(OPT_gpubnames) + ? llvm::DICompileUnit::DebugNameTableKind::Default + : llvm::DICompileUnit::DebugNameTableKind::None); setPGOInstrumentor(Opts, Args, Diags); Opts.InstrProfileOutput = |