[clang] [Clang] Enable -fextend-lifetimes at -Og (PR #118026)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 29 19:34:14 PST 2024


================
@@ -1834,6 +1834,14 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
     Opts.setInlining(CodeGenOptions::NormalInlining);
   }
 
+  // If we have specified -Og and have not explicitly set -fno-extend-lifetimes,
+  // then default to -fextend-lifetimes.
+  if (Arg *A = Args.getLastArg(options::OPT_O_Group);
+      A && A->containsValue("g")) {
----------------
MaskRay wrote:

`A->getValue() == "g"`

Perhaps move the code around ToolChains/Clang.cpp:9198 and let the driver pass -fextend-lifetimes to frontend.

https://github.com/llvm/llvm-project/pull/118026


More information about the cfe-commits mailing list