[Lldb-commits] [PATCH] D76569: Convert CommandObjectCommands functions to return StringRefs
Jan Kratochvil via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Sun Mar 22 15:34:06 PDT 2020
jankratochvil added a comment.
Have you run the build with address sanitizer?
================
Comment at: lldb/source/Commands/CommandObjectCommands.cpp:530
OptionsWithRaw args_with_suffix(raw_command_line);
- const char *remainder = args_with_suffix.GetRawPart().c_str();
+ llvm::StringRef raw_command_string = args_with_suffix.GetRawPart();
----------------
The `raw_command_string` definition does not need to be moved above the `ParseOptionsAndNotify` call, it could stay in place lower.
================
Comment at: lldb/source/Commands/CommandObjectCommands.cpp:1173
- // TODO: Convert these functions to return StringRefs.
- const char *GetHelp() {
- return (m_help.empty() ? nullptr : m_help.c_str());
- }
+ llvm::StringRef GetHelp() { return (m_help.empty() ? "" : m_help); }
----------------
I see no need for the conditional there.
================
Comment at: lldb/source/Commands/CommandObjectCommands.cpp:1175
- const char *GetSyntax() {
- return (m_syntax.empty() ? nullptr : m_syntax.c_str());
- }
+ llvm::StringRef GetSyntax() { return (m_syntax.empty() ? "" : m_syntax); }
----------------
I see no need for the conditional there.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76569/new/
https://reviews.llvm.org/D76569
More information about the lldb-commits
mailing list