[clang] [Clang] Enable -fextend-lifetimes at -Og (PR #118026)
Reid Kleckner via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 4 10:45:21 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")) {
----------------
rnk wrote:
I agree, the driver's job is usually to unpack high level flags into semi-orthogonal cc1 flags. So, for example, in clang-cl, /O1 becomes a collection of things like `-Os -ffunction-sections -fdata-sections` and maybe something else I've forgotten. `clang++ -fexceptions` becomes `-fexceptions -fcxx-exceptions` in most contexts, separating destructor cleanups from try/throw language support.
cc1 flags kind of represent features that are useful to toggle on and off for testing and test case reduction, since they're one of the things we reduce in the [clang crash reducer script](https://github.com/llvm/llvm-project/blob/main/clang/utils/creduce-clang-crash.py).
https://github.com/llvm/llvm-project/pull/118026
More information about the cfe-commits
mailing list