From 3e2ad26b08a23e786e64e8e47547d25a1b5a7f28 Mon Sep 17 00:00:00 2001 From: Amy Huang Date: Thu, 22 Jul 2021 11:26:03 -0700 Subject: [DebugInfo] Add -fno-ctor-homing for as counterpart to -fuse-ctor-homing Add an opt out flag for constructor homing. Differential Revision: https://reviews.llvm.org/D106582 --- clang/lib/Frontend/CompilerInvocation.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 2c696b5..a8f25fa 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1369,9 +1369,6 @@ void CompilerInvocation::GenerateCodeGenArgs( if (DebugInfoVal) GenerateArg(Args, OPT_debug_info_kind_EQ, *DebugInfoVal, SA); - if (Opts.DebugInfo == codegenoptions::DebugInfoConstructor) - GenerateArg(Args, OPT_fuse_ctor_homing, SA); - for (const auto &Prefix : Opts.DebugPrefixMap) GenerateArg(Args, OPT_fdebug_prefix_map_EQ, Prefix.first + "=" + Prefix.second, SA); @@ -1627,10 +1624,16 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, } // If -fuse-ctor-homing is set and limited debug info is already on, then use - // constructor homing. - if (Args.getLastArg(OPT_fuse_ctor_homing)) - if (Opts.getDebugInfo() == codegenoptions::LimitedDebugInfo) + // 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('='); -- cgit v1.1