diff options
author | Amy Huang <akhuang@google.com> | 2021-07-22 11:26:03 -0700 |
---|---|---|
committer | Amy Huang <akhuang@google.com> | 2021-07-22 14:52:36 -0700 |
commit | 3e2ad26b08a23e786e64e8e47547d25a1b5a7f28 (patch) | |
tree | 4b4be2266db96f80e10e0e1a326d9d39de90659d /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 83225936af317e6bdd7103a8a039c51a29ce9f57 (diff) | |
download | llvm-3e2ad26b08a23e786e64e8e47547d25a1b5a7f28.zip llvm-3e2ad26b08a23e786e64e8e47547d25a1b5a7f28.tar.gz llvm-3e2ad26b08a23e786e64e8e47547d25a1b5a7f28.tar.bz2 |
[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
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
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('='); |