Skip to content

Commit 0901017

Browse files
committed
Make extend lifetimes an = option
1 parent 957a468 commit 0901017

File tree

4 files changed

+25
-21
lines changed

4 files changed

+25
-21
lines changed

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,11 +393,8 @@ CODEGENOPT(EnableTLSDESC, 1, 0)
393393
/// Bit size of immediate TLS offsets (0 == use the default).
394394
VALUE_CODEGENOPT(TLSSize, 8, 0)
395395

396-
/// Whether to extend the live range of the `this` pointer.
397-
CODEGENOPT(ExtendThisPtr, 1, 0)
398-
399-
/// Whether to extend the live ranges of all local variables.
400-
CODEGENOPT(ExtendLifetimes, 1, 0)
396+
/// The types of variables that we will extend the live ranges of.
397+
ENUM_CODEGENOPT(ExtendLifetimes, ExtendLifetimesKind, 2, ExtendLifetimesKind::None)
401398

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

clang/include/clang/Basic/CodeGenOptions.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ class CodeGenOptions : public CodeGenOptionsBase {
9595
Embed_Marker // Embed a marker as a placeholder for bitcode.
9696
};
9797

98+
enum class ExtendLifetimesKind {
99+
None,
100+
This,
101+
All,
102+
};
103+
98104
enum InlineAsmDialectKind {
99105
IAD_ATT,
100106
IAD_Intel,

clang/include/clang/Driver/Options.td

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4298,18 +4298,22 @@ 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-
defm extend_this_ptr : BoolFOption<"extend-this-ptr",
4302-
CodeGenOpts<"ExtendThisPtr">, DefaultFalse,
4303-
PosFlag<SetTrue, [], [ClangOption, CC1Option],
4304-
"Extend the lifetime of the 'this' pointer to improve visibility "
4305-
"in optimized debugging">,
4306-
NegFlag<SetFalse>>;
4307-
defm extend_lifetimes : BoolFOption<"extend-lifetimes",
4308-
CodeGenOpts<"ExtendLifetimes">, DefaultFalse,
4309-
PosFlag<SetTrue, [], [ClangOption, CC1Option],
4310-
"Extend the lifetimes of local variables and parameters to improve "
4311-
"visibility in optimized debugging">,
4312-
NegFlag<SetFalse>>;
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">,
4305+
Values<"all,this,none">,
4306+
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">;
43134317

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

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7654,10 +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.addOptInFlag(CmdArgs, options::OPT_fextend_this_ptr,
7658-
options::OPT_fno_extend_this_ptr);
7659-
Args.addOptInFlag(CmdArgs, options::OPT_fextend_lifetimes,
7660-
options::OPT_fno_extend_lifetimes);
7657+
Args.AddLastArg(CmdArgs, options::OPT_fextend_lifetimes_EQ);
76617658

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

0 commit comments

Comments
 (0)