[clang] [Clang] Enable -fextend-lifetimes at -Og (PR #118026)
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 4 10:32:32 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")) {
----------------
dwblaikie wrote:
I'm not sure if we have a fundamental principle about how flags should work in the driver V the frontend, but yeah - in some ways the driver acts as a lowering/canonicalizer - representing flag defaults, etc. So I think the expectation that `clang -cc1 -Og` does the same thing as `clang -Og` isn't valid/not something we're striving for (& in some sense counter to what we are striving for: that all the defaults/grouping is handled by the driver, and the frontend can just think about whether a flag is enabled or disabled)
https://github.com/llvm/llvm-project/pull/118026
More information about the cfe-commits
mailing list