aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectThread.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-09-19 17:54:06 +0000
committerZachary Turner <zturner@google.com>2016-09-19 17:54:06 +0000
commitecbb0bb1690cd59da0224d7b906f968356b1265c (patch)
tree90951f44a7abb40b355e849a2e64cb09ec3ac900 /lldb/source/Commands/CommandObjectThread.cpp
parent495b211a6c775e6fbc00a1e3a91786f6a880b82e (diff)
downloadllvm-ecbb0bb1690cd59da0224d7b906f968356b1265c.zip
llvm-ecbb0bb1690cd59da0224d7b906f968356b1265c.tar.gz
llvm-ecbb0bb1690cd59da0224d7b906f968356b1265c.tar.bz2
Fix more functions in Args to use StringRef.
This patch also marks the const char* versions as =delete to prevent their use. This has the potential to cause build breakages on some platforms which I can't compile. I have tested on Windows, Linux, and OSX. Best practices for fixing broken callsites are outlined in Args.h in a comment above the deleted function declarations. Eventually we can remove these =delete declarations, but for now they are important to make sure that all implicit conversions from const char * are manually audited to make sure that they do not invoke a conversion from nullptr. llvm-svn: 281919
Diffstat (limited to 'lldb/source/Commands/CommandObjectThread.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectThread.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index f2f7cdc..6cefa6e 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -157,6 +157,7 @@ public:
ExecutionContext *execution_context) override {
Error error;
const int short_option = m_getopt_table[option_idx].val;
+ auto option_strref = llvm::StringRef::withNullAsEmpty(option_arg);
switch (short_option) {
case 'c': {
@@ -181,7 +182,7 @@ public:
case 'e': {
bool success;
m_extended_backtrace =
- Args::StringToBoolean(option_arg, false, &success);
+ Args::StringToBoolean(option_strref, false, &success);
if (!success)
error.SetErrorStringWithFormat(
"invalid boolean value for option '%c'", short_option);
@@ -315,11 +316,13 @@ public:
ExecutionContext *execution_context) override {
Error error;
const int short_option = m_getopt_table[option_idx].val;
+ auto option_strref = llvm::StringRef::withNullAsEmpty(option_arg);
switch (short_option) {
case 'a': {
bool success;
- bool avoid_no_debug = Args::StringToBoolean(option_arg, true, &success);
+ bool avoid_no_debug =
+ Args::StringToBoolean(option_strref, true, &success);
if (!success)
error.SetErrorStringWithFormat(
"invalid boolean value for option '%c'", short_option);
@@ -331,7 +334,8 @@ public:
case 'A': {
bool success;
- bool avoid_no_debug = Args::StringToBoolean(option_arg, true, &success);
+ bool avoid_no_debug =
+ Args::StringToBoolean(option_strref, true, &success);
if (!success)
error.SetErrorStringWithFormat(
"invalid boolean value for option '%c'", short_option);
@@ -1441,11 +1445,12 @@ public:
ExecutionContext *execution_context) override {
Error error;
const int short_option = m_getopt_table[option_idx].val;
+ auto option_strref = llvm::StringRef::withNullAsEmpty(option_arg);
switch (short_option) {
case 'x': {
bool success;
- bool tmp_value = Args::StringToBoolean(option_arg, false, &success);
+ bool tmp_value = Args::StringToBoolean(option_strref, false, &success);
if (success)
m_from_expression = tmp_value;
else {