Skip to content

Commit 957a468

Browse files
committed
Make options into BoolF types, remove added attribute
1 parent 6a873f5 commit 957a468

File tree

6 files changed

+22
-39
lines changed

6 files changed

+22
-39
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -417,11 +417,12 @@ New Compiler Flags
417417
will cause Clang to generate code that tries to preserve the lifetimes of
418418
source variables, meaning that variables will typically be visible in a
419419
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. Note
421-
that this flag modifies the optimizations that Clang performs, which will
422-
result in reduced performance in generated code; however, this feature will
423-
not extend the lifetime of some variables in cases where doing so would have
424-
too severe an impact on generated code performance.
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
423+
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.
425426

426427
Deprecated Compiler Flags
427428
-------------------------

clang/include/clang/Driver/Options.td

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4298,15 +4298,18 @@ 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_this_ptr : Flag <["-"], "fextend-this-ptr">, Group<f_Group>,
4302-
MarshallingInfoFlag<CodeGenOpts<"ExtendThisPtr">>,
4303-
HelpText<"Extend the lifetime of the 'this' pointer to improve visibility "
4304-
"in optimized debugging">, Visibility<[ClangOption, CC1Option]>;
4305-
def fextend_lifetimes : Flag <["-"], "fextend-lifetimes">, Group<f_Group>,
4306-
MarshallingInfoFlag<CodeGenOpts<"ExtendLifetimes">>,
4307-
HelpText<"Extend the lifetimes of local variables and parameters to improve "
4308-
"visibility in optimized debugging">,
4309-
Visibility<[ClangOption, CC1Option]>;
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>>;
43104313

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

clang/lib/CodeGen/CGCall.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2567,10 +2567,6 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
25672567
if (shouldDisableTailCalls())
25682568
FuncAttrs.addAttribute("disable-tail-calls", "true");
25692569

2570-
// Mark the function as having fake uses when -fextend-lifetimes is on.
2571-
if (CodeGenOpts.ExtendLifetimes || CodeGenOpts.ExtendThisPtr)
2572-
FuncAttrs.addAttribute(llvm::Attribute::HasFakeUses);
2573-
25742570
// CPU/feature overrides. addDefaultFunctionDefinitionAttributes
25752571
// handles these separately to set them based on the global defaults.
25762572
GetCPUAndFeaturesAttributes(CalleeInfo.getCalleeDecl(), FuncAttrs);

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7654,10 +7654,10 @@ 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-
if (Args.hasArg(options::OPT_fextend_this_ptr))
7658-
CmdArgs.push_back("-fextend-this-ptr");
7659-
if (Args.hasArg(options::OPT_fextend_lifetimes))
7660-
CmdArgs.push_back("-fextend-lifetimes");
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);
76617661

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

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2245,11 +2245,6 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
22452245
Args.getAllArgValues(OPT_fsanitize_trap_EQ), Diags,
22462246
Opts.SanitizeTrap);
22472247

2248-
Opts.ExtendThisPtr =
2249-
Opts.OptimizationLevel > 0 && Args.hasArg(OPT_fextend_this_ptr);
2250-
Opts.ExtendLifetimes =
2251-
Opts.OptimizationLevel > 0 && Args.hasArg(OPT_fextend_lifetimes);
2252-
22532248
Opts.EmitVersionIdentMetadata = Args.hasFlag(OPT_Qy, OPT_Qn, true);
22542249

22552250
if (!LangOpts->CUDAIsDevice)

clang/test/CodeGen/extend-lifetimes-hasfakeuses.c

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)