davezarzycki created this revision. davezarzycki added a reviewer: chandlerc. davezarzycki added a project: clang.
This fixes a regression introduced (over three years ago!) by fcd33149b48885ab8e4ca4ffb6977bce5be2e623. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D74298 Files: clang/lib/Frontend/CompilerInvocation.cpp Index: clang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -694,19 +694,23 @@ Opts.setInlining((Opts.OptimizationLevel == 0) ? CodeGenOptions::OnlyAlwaysInlining : CodeGenOptions::NormalInlining); - // Explicit inlining flags can disable some or all inlining even at - // optimization levels above zero. + // Handle inlining overrides if (Arg *InlineArg = Args.getLastArg( options::OPT_finline_functions, options::OPT_finline_hint_functions, options::OPT_fno_inline_functions, options::OPT_fno_inline)) { - if (Opts.OptimizationLevel > 0) { - const Option &InlineOpt = InlineArg->getOption(); - if (InlineOpt.matches(options::OPT_finline_functions)) - Opts.setInlining(CodeGenOptions::NormalInlining); - else if (InlineOpt.matches(options::OPT_finline_hint_functions)) - Opts.setInlining(CodeGenOptions::OnlyHintInlining); - else - Opts.setInlining(CodeGenOptions::OnlyAlwaysInlining); + const Option &InlineOpt = InlineArg->getOption(); + if (InlineOpt.matches(options::OPT_fno_inline)) { + Opts.setInlining(CodeGenOptions::OnlyAlwaysInlining); + } else if (InlineOpt.matches(options::OPT_fno_inline_functions)) { + Opts.setInlining(CodeGenOptions::OnlyAlwaysInlining); + } else if (InlineOpt.matches(options::OPT_finline_functions)) { + Opts.setInlining(CodeGenOptions::NormalInlining); + } else { + assert(InlineOpt.matches(options::OPT_finline_hint_functions) && + "Option parsing bug"); + Opts.setInlining(Args.hasArg(OPT_finline_functions) + ? CodeGenOptions::NormalInlining + : CodeGenOptions::OnlyHintInlining); } }
Index: clang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -694,19 +694,23 @@ Opts.setInlining((Opts.OptimizationLevel == 0) ? CodeGenOptions::OnlyAlwaysInlining : CodeGenOptions::NormalInlining); - // Explicit inlining flags can disable some or all inlining even at - // optimization levels above zero. + // Handle inlining overrides if (Arg *InlineArg = Args.getLastArg( options::OPT_finline_functions, options::OPT_finline_hint_functions, options::OPT_fno_inline_functions, options::OPT_fno_inline)) { - if (Opts.OptimizationLevel > 0) { - const Option &InlineOpt = InlineArg->getOption(); - if (InlineOpt.matches(options::OPT_finline_functions)) - Opts.setInlining(CodeGenOptions::NormalInlining); - else if (InlineOpt.matches(options::OPT_finline_hint_functions)) - Opts.setInlining(CodeGenOptions::OnlyHintInlining); - else - Opts.setInlining(CodeGenOptions::OnlyAlwaysInlining); + const Option &InlineOpt = InlineArg->getOption(); + if (InlineOpt.matches(options::OPT_fno_inline)) { + Opts.setInlining(CodeGenOptions::OnlyAlwaysInlining); + } else if (InlineOpt.matches(options::OPT_fno_inline_functions)) { + Opts.setInlining(CodeGenOptions::OnlyAlwaysInlining); + } else if (InlineOpt.matches(options::OPT_finline_functions)) { + Opts.setInlining(CodeGenOptions::NormalInlining); + } else { + assert(InlineOpt.matches(options::OPT_finline_hint_functions) && + "Option parsing bug"); + Opts.setInlining(Args.hasArg(OPT_finline_functions) + ? CodeGenOptions::NormalInlining + : CodeGenOptions::OnlyHintInlining); } }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits