From ae6523cd62a44642390f4f9d9ba9ce17d5bbbc58 Mon Sep 17 00:00:00 2001 From: Amy Huang Date: Thu, 13 Aug 2020 15:48:55 -0700 Subject: [DebugInfo] Add -fuse-ctor-homing cc1 flag so we can turn on constructor homing only if limited debug info is already on. This adds a cc1 flag to enable constructor homing but doesn't turn on debug info if it wasn't enabled already (which is what using -debug-info-kind=constructor does). This will be used for testing, and won't be needed anymore once ctor homing is used as default / merged into =limited. Bug to enable ctor homing: https://bugs.llvm.org/show_bug.cgi?id=46537 Differential Revision: https://reviews.llvm.org/D85799 --- clang/lib/Frontend/CompilerInvocation.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 17c43ec..86504ed 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -775,6 +775,12 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, else Opts.setDebugInfo(static_cast(Val)); } + // If -fuse-ctor-homing is set and limited debug info is already on, then use + // constructor homing. + if (Arg *A = Args.getLastArg(OPT_fuse_ctor_homing)) + if (Opts.getDebugInfo() == codegenoptions::LimitedDebugInfo) + Opts.setDebugInfo(codegenoptions::DebugInfoConstructor); + if (Arg *A = Args.getLastArg(OPT_debugger_tuning_EQ)) { unsigned Val = llvm::StringSwitch(A->getValue()) .Case("gdb", unsigned(llvm::DebuggerKind::GDB)) -- cgit v1.1