Skip to content

Commit 984e050

Browse files
committed
Rename to -fextend-variable-liveness
1 parent 0901017 commit 984e050

File tree

5 files changed

+31
-27
lines changed

5 files changed

+31
-27
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -412,17 +412,20 @@ New Compiler Flags
412412
only for thread-local variables, and none (which corresponds to the
413413
existing ``-fno-c++-static-destructors`` flag) skips all static
414414
destructors registration.
415-
- The ``-fextend-lifetimes`` and ``-fextend-this-ptr`` flags have been added to
416-
allow for improved debugging of optimized code. Using ``-fextend-lifetimes``
417-
will cause Clang to generate code that tries to preserve the lifetimes of
418-
source variables, meaning that variables will typically be visible in a
419-
debugger more often. The ``-fextend-this-ptr`` flag has the same behaviour,
420-
but applies only to the ``this`` variable in C++ class member functions,
421-
meaning its effect is a strict subset of ``-fextend-lifetimes``. Note that
422-
this flag modifies the optimizations that Clang performs, which will result
415+
- The ``-fextend-variable-liveness`` flag has been added to allow for improved
416+
debugging of optimized code. Using ``-fextend-variable-liveness`` will cause
417+
Clang to generate code that tries to preserve the liveness of source variables
418+
through optimizations, meaning that variables will typically be visible in a
419+
debugger more often. The flag has two levels: ``-fextend-variable-liveness``,
420+
or ``-fextend-variable-liveness=all``, extendes the liveness of all user
421+
variables and the ``this`` pointer. Alternatively ``-fextend-this-ptr``, or
422+
``-fextend-variable-liveness=this``, has the same behaviour but applies only
423+
to the ``this`` variable in C++ class member functions, meaning its effect is
424+
a strict subset of ``-fextend-variable-liveness``. Note that this flag
425+
modifies the results of optimizations that Clang performs, which will result
423426
in reduced performance in generated code; however, this feature will not
424-
extend the lifetime of some variables in cases where doing so would have too
425-
severe of an impact on generated code performance.
427+
extend the liveness of some variables in cases where doing so would likely
428+
have a severe impact on generated code performance.
426429

427430
Deprecated Compiler Flags
428431
-------------------------

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ CODEGENOPT(EnableTLSDESC, 1, 0)
394394
VALUE_CODEGENOPT(TLSSize, 8, 0)
395395

396396
/// The types of variables that we will extend the live ranges of.
397-
ENUM_CODEGENOPT(ExtendLifetimes, ExtendLifetimesKind, 2, ExtendLifetimesKind::None)
397+
ENUM_CODEGENOPT(ExtendVariableLiveness, ExtendVariableLivenessKind, 2, ExtendVariableLivenessKind::None)
398398

399399
/// The default stack protector guard offset to use.
400400
VALUE_CODEGENOPT(StackProtectorGuardOffset, 32, INT_MAX)

clang/include/clang/Basic/CodeGenOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class CodeGenOptions : public CodeGenOptionsBase {
9595
Embed_Marker // Embed a marker as a placeholder for bitcode.
9696
};
9797

98-
enum class ExtendLifetimesKind {
98+
enum class ExtendVariableLivenessKind {
9999
None,
100100
This,
101101
All,

clang/include/clang/Driver/Options.td

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4298,22 +4298,23 @@ def stack_usage_file : Separate<["-"], "stack-usage-file">,
42984298
Visibility<[CC1Option]>,
42994299
HelpText<"Filename (or -) to write stack usage output to">,
43004300
MarshallingInfoString<CodeGenOpts<"StackUsageOutput">>;
4301-
def fextend_lifetimes_EQ : Joined<["-"], "fextend-lifetimes=">, Group<f_Group>,
4302-
Visibility<[ClangOption, CC1Option]>,
4303-
HelpText<"Extend the lifetimes of variables to improve visibility in "
4304-
"optimized debugging">,
4301+
def fextend_variable_liveness_EQ : Joined<["-"], "fextend-variable-liveness=">,
4302+
Group<f_Group>, Visibility<[ClangOption, CC1Option]>,
4303+
HelpText<"Extend the liveness of user variables through optimizations to "
4304+
"prevent stale or optimized-out variable values when debugging.">,
43054305
Values<"all,this,none">,
43064306
NormalizedValues<["All", "This", "None"]>,
4307-
NormalizedValuesScope<"CodeGenOptions::ExtendLifetimesKind">,
4308-
MarshallingInfoEnum<CodeGenOpts<"ExtendLifetimes">, "None">;
4309-
def fextend_this_ptr : Flag<["-"], "fextend-this-ptr">,
4310-
Alias<fextend_lifetimes_EQ>, AliasArgs<["this"]>,
4311-
HelpText<"Extend the lifetime of the 'this' pointer to improve visibility "
4312-
"in optimized debugging">;
4313-
def fextend_lifetimes : Flag<["-"], "fextend-lifetimes">,
4314-
Alias<fextend_lifetimes_EQ>, AliasArgs<["all"]>,
4315-
HelpText<"Extend the lifetimes of local variables and parameters to improve "
4316-
"visibility in optimized debugging">;
4307+
NormalizedValuesScope<"CodeGenOptions::ExtendVariableLivenessKind">,
4308+
MarshallingInfoEnum<CodeGenOpts<"ExtendVariableLiveness">, "None">;
4309+
def fextend_this_ptr_liveness : Flag<["-"], "fextend-this-ptr-liveness">,
4310+
Alias<fextend_variable_liveness_EQ>, AliasArgs<["this"]>,
4311+
HelpText<"Extend the liveness of the `this` pointer through optimizations to "
4312+
"prevent a stale or optimized-out value when debugging.">;
4313+
def fextend_variable_liveness : Flag<["-"], "fextend-variable-liveness">,
4314+
Alias<fextend_variable_liveness_EQ>, AliasArgs<["all"]>,
4315+
HelpText<"Extend the liveness of all local variables and parameters through "
4316+
"optimizations to prevent stale or optimized-out variable values "
4317+
"when debugging.">;
43174318

43184319
defm unique_basic_block_section_names : BoolFOption<"unique-basic-block-section-names",
43194320
CodeGenOpts<"UniqueBasicBlockSectionNames">, DefaultFalse,

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7654,7 +7654,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
76547654
if (Args.hasArg(options::OPT_fretain_comments_from_system_headers))
76557655
CmdArgs.push_back("-fretain-comments-from-system-headers");
76567656

7657-
Args.AddLastArg(CmdArgs, options::OPT_fextend_lifetimes_EQ);
7657+
Args.AddLastArg(CmdArgs, options::OPT_fextend_variable_liveness_EQ);
76587658

76597659
// Forward -fcomment-block-commands to -cc1.
76607660
Args.AddAllArgs(CmdArgs, options::OPT_fcomment_block_commands);

0 commit comments

Comments
 (0)