[Lldb-commits] [lldb] 9b24dad - [lldb][NFC] Make some checks more readable in Variable::PrivateAutoComplete

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 1 09:48:07 PST 2020


Author: Raphael Isemann
Date: 2020-01-01T18:47:44+01:00
New Revision: 9b24dad6c06bba771b805ffd9bd047af25317e52

URL: https://github.com/llvm/llvm-project/commit/9b24dad6c06bba771b805ffd9bd047af25317e52
DIFF: https://github.com/llvm/llvm-project/commit/9b24dad6c06bba771b805ffd9bd047af25317e52.diff

LOG: [lldb][NFC] Make some checks more readable in Variable::PrivateAutoComplete

Added: 
    

Modified: 
    lldb/source/Symbol/Variable.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp
index fc7d127a326f..a0496824a0a3 100644
--- a/lldb/source/Symbol/Variable.cpp
+++ b/lldb/source/Symbol/Variable.cpp
@@ -705,9 +705,9 @@ static void PrivateAutoComplete(
             if (!var_sp)
               continue;
 
-            const char *variable_name = var_sp->GetName().AsCString();
-            if (strstr(variable_name, token.c_str()) == variable_name) {
-              if (strcmp(variable_name, token.c_str()) == 0) {
+            llvm::StringRef variable_name = var_sp->GetName().GetStringRef();
+            if (variable_name.startswith(token)) {
+              if (variable_name == token) {
                 Type *variable_type = var_sp->GetType();
                 if (variable_type) {
                   CompilerType variable_compiler_type(


        


More information about the lldb-commits mailing list