diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Driver/ToolChains/Clang.cpp | 23 | ||||
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 16 |
3 files changed, 33 insertions, 14 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index c9d07ce..7e9e867 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -27,7 +27,6 @@ #include "clang/AST/RecordLayout.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/Basic/CodeGenOptions.h" -#include "clang/Basic/DebugInfoOptions.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/Version.h" @@ -587,6 +586,7 @@ void CGDebugInfo::CreateCompileUnit() { case codegenoptions::DebugDirectivesOnly: EmissionKind = llvm::DICompileUnit::DebugDirectivesOnly; break; + case codegenoptions::DebugInfoConstructor: case codegenoptions::LimitedDebugInfo: case codegenoptions::FullDebugInfo: case codegenoptions::UnusedTypeInfo: @@ -1861,7 +1861,7 @@ llvm::DISubprogram *CGDebugInfo::CreateCXXMemberFunction( // In this debug mode, emit type info for a class when its constructor type // info is emitted. - if (DebugKind == codegenoptions::LimitedDebugInfo) + if (DebugKind == codegenoptions::DebugInfoConstructor) if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(Method)) completeUnusedClass(*CD->getParent()); @@ -2528,7 +2528,7 @@ static bool shouldOmitDefinition(codegenoptions::DebugInfoKind DebugKind, // In constructor homing mode, only emit complete debug info for a class // when its constructor is emitted. - if ((DebugKind == codegenoptions::LimitedDebugInfo) && + if ((DebugKind == codegenoptions::DebugInfoConstructor) && canUseCtorHoming(CXXDecl)) return true; @@ -3349,7 +3349,7 @@ void CGDebugInfo::completeTemplateDefinition( } void CGDebugInfo::completeUnusedClass(const CXXRecordDecl &D) { - if (DebugKind <= codegenoptions::DebugLineTablesOnly || D.isDynamicClass()) + if (DebugKind <= codegenoptions::DebugLineTablesOnly) return; completeClassData(&D); diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index bcb34d0..5142b72 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -26,7 +26,6 @@ #include "clang/Basic/CLWarnings.h" #include "clang/Basic/CharInfo.h" #include "clang/Basic/CodeGenOptions.h" -#include "clang/Basic/DebugInfoOptions.h" #include "clang/Basic/LangOptions.h" #include "clang/Basic/ObjCRuntime.h" #include "clang/Basic/Version.h" @@ -526,7 +525,7 @@ static codegenoptions::DebugInfoKind DebugLevelToInfoKind(const Arg &A) { return codegenoptions::DebugLineTablesOnly; if (A.getOption().matches(options::OPT_gline_directives_only)) return codegenoptions::DebugDirectivesOnly; - return codegenoptions::LimitedDebugInfo; + return codegenoptions::DebugInfoConstructor; } static bool mustUseNonLeafFramePointerForTarget(const llvm::Triple &Triple) { @@ -1087,6 +1086,9 @@ static void RenderDebugEnablingArgs(const ArgList &Args, ArgStringList &CmdArgs, case codegenoptions::DebugLineTablesOnly: CmdArgs.push_back("-debug-info-kind=line-tables-only"); break; + case codegenoptions::DebugInfoConstructor: + CmdArgs.push_back("-debug-info-kind=constructor"); + break; case codegenoptions::LimitedDebugInfo: CmdArgs.push_back("-debug-info-kind=limited"); break; @@ -2668,7 +2670,7 @@ static void CollectArgsForIntegratedAssembler(Compilation &C, CmdArgs.push_back(Value.data()); } else { RenderDebugEnablingArgs(Args, CmdArgs, - codegenoptions::LimitedDebugInfo, + codegenoptions::DebugInfoConstructor, DwarfVersion, llvm::DebuggerKind::Default); } } else if (Value.startswith("-mcpu") || Value.startswith("-mfpu") || @@ -4094,7 +4096,7 @@ static void renderDebugOptions(const ToolChain &TC, const Driver &D, } } if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) { - DebugInfoKind = codegenoptions::LimitedDebugInfo; + DebugInfoKind = codegenoptions::DebugInfoConstructor; // If the last option explicitly specified a debug-info level, use it. if (checkDebugInfoOption(A, Args, D, TC) && @@ -4216,7 +4218,7 @@ static void renderDebugOptions(const ToolChain &TC, const Driver &D, if (checkDebugInfoOption(A, Args, D, TC)) { if (DebugInfoKind != codegenoptions::DebugLineTablesOnly && DebugInfoKind != codegenoptions::DebugDirectivesOnly) { - DebugInfoKind = codegenoptions::LimitedDebugInfo; + DebugInfoKind = codegenoptions::DebugInfoConstructor; CmdArgs.push_back("-dwarf-ext-refs"); CmdArgs.push_back("-fmodule-format=obj"); } @@ -4237,7 +4239,8 @@ static void renderDebugOptions(const ToolChain &TC, const Driver &D, if (const Arg *A = Args.getLastArg(options::OPT_fstandalone_debug)) (void)checkDebugInfoOption(A, Args, D, TC); - if (DebugInfoKind == codegenoptions::LimitedDebugInfo) { + if (DebugInfoKind == codegenoptions::LimitedDebugInfo || + DebugInfoKind == codegenoptions::DebugInfoConstructor) { if (Args.hasFlag(options::OPT_fno_eliminate_unused_debug_types, options::OPT_feliminate_unused_debug_types, false)) DebugInfoKind = codegenoptions::UnusedTypeInfo; @@ -5435,7 +5438,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // This controls whether or not we perform JustMyCode instrumentation. if (Args.hasFlag(options::OPT_fjmc, options::OPT_fno_jmc, false)) { if (TC.getTriple().isOSBinFormatELF()) { - if (DebugInfoKind >= codegenoptions::LimitedDebugInfo) + if (DebugInfoKind >= codegenoptions::DebugInfoConstructor) CmdArgs.push_back("-fjmc"); else D.Diag(clang::diag::warn_drv_jmc_requires_debuginfo) << "-fjmc" @@ -7562,7 +7565,7 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType, options::OPT_gline_tables_only)) { *EmitCodeView = true; if (DebugInfoArg->getOption().matches(options::OPT__SLASH_Z7)) - *DebugInfoKind = codegenoptions::LimitedDebugInfo; + *DebugInfoKind = codegenoptions::DebugInfoConstructor; else *DebugInfoKind = codegenoptions::DebugLineTablesOnly; } else { @@ -7574,7 +7577,7 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType, // This controls whether or not we perform JustMyCode instrumentation. if (Args.hasFlag(options::OPT__SLASH_JMC, options::OPT__SLASH_JMC_, /*Default=*/false)) { - if (*EmitCodeView && *DebugInfoKind >= codegenoptions::LimitedDebugInfo) + if (*EmitCodeView && *DebugInfoKind >= codegenoptions::DebugInfoConstructor) CmdArgs.push_back("-fjmc"); else D.Diag(clang::diag::warn_drv_jmc_requires_debuginfo) << "/JMC" @@ -7899,7 +7902,7 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA, // the guard for source type, however there is a test which asserts // that some assembler invocation receives no -debug-info-kind, // and it's not clear whether that test is just overly restrictive. - DebugInfoKind = (WantDebug ? codegenoptions::LimitedDebugInfo + DebugInfoKind = (WantDebug ? codegenoptions::DebugInfoConstructor : codegenoptions::NoDebugInfo); addDebugPrefixMapArg(getToolChain().getDriver(), getToolChain(), Args, diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 0cf5978..c0eed3a 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1360,6 +1360,9 @@ void CompilerInvocation::GenerateCodeGenArgs( case codegenoptions::DebugDirectivesOnly: DebugInfoVal = "line-directives-only"; break; + case codegenoptions::DebugInfoConstructor: + DebugInfoVal = "constructor"; + break; case codegenoptions::LimitedDebugInfo: DebugInfoVal = "limited"; break; @@ -1634,6 +1637,7 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, llvm::StringSwitch<unsigned>(A->getValue()) .Case("line-tables-only", codegenoptions::DebugLineTablesOnly) .Case("line-directives-only", codegenoptions::DebugDirectivesOnly) + .Case("constructor", codegenoptions::DebugInfoConstructor) .Case("limited", codegenoptions::LimitedDebugInfo) .Case("standalone", codegenoptions::FullDebugInfo) .Case("unused-types", codegenoptions::UnusedTypeInfo) @@ -1645,6 +1649,18 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, Opts.setDebugInfo(static_cast<codegenoptions::DebugInfoKind>(Val)); } + // If -fuse-ctor-homing is set and limited debug info is already on, then use + // constructor homing, and vice versa for -fno-use-ctor-homing. + if (const Arg *A = + Args.getLastArg(OPT_fuse_ctor_homing, OPT_fno_use_ctor_homing)) { + if (A->getOption().matches(OPT_fuse_ctor_homing) && + Opts.getDebugInfo() == codegenoptions::LimitedDebugInfo) + Opts.setDebugInfo(codegenoptions::DebugInfoConstructor); + if (A->getOption().matches(OPT_fno_use_ctor_homing) && + Opts.getDebugInfo() == codegenoptions::DebugInfoConstructor) + Opts.setDebugInfo(codegenoptions::LimitedDebugInfo); + } + for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ)) { auto Split = StringRef(Arg).split('='); Opts.DebugPrefixMap.insert( |