diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-12-21 22:46:10 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-12-21 22:46:10 +0000 |
commit | 8bb1c06ab3b46b1f95d5a946789b8edac8007403 (patch) | |
tree | 115249f4eef87bfbbfe45e40599538fe379fecf8 /lldb/source/Symbol | |
parent | b61673d63b5e0e6bbe3f8463c33286f17f7d85b8 (diff) |
[NFC] Replace `compare` with (in)equality operator where applicable.
Using compare is verbose, bug prone and potentially inefficient (because
of early termination). Replace relevant call sites with the (in)equality
operator.
Diffstat (limited to 'lldb/source/Symbol')
-rw-r--r-- | lldb/source/Symbol/ClangASTContext.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Symbol/TypeList.cpp | 3 | ||||
-rw-r--r-- | lldb/source/Symbol/TypeMap.cpp | 3 |
3 files changed, 3 insertions, 5 deletions
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index 0fb4699ac35..5052f3c2a44 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -7452,7 +7452,7 @@ ClangASTContext::GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, base_class->getType()); std::string base_class_type_name( base_class_clang_type.GetTypeName().AsCString("")); - if (base_class_type_name.compare(name) == 0) + if (base_class_type_name == name) return child_idx; ++child_idx; } diff --git a/lldb/source/Symbol/TypeList.cpp b/lldb/source/Symbol/TypeList.cpp index f70982fd0d2..26a646e6469 100644 --- a/lldb/source/Symbol/TypeList.cpp +++ b/lldb/source/Symbol/TypeList.cpp @@ -180,8 +180,7 @@ void TypeList::RemoveMismatchedTypes(const std::string &type_scope, } else { // The type we are currently looking at doesn't exists in a namespace // or class, so it only matches if there is no type scope... - keep_match = - type_scope.empty() && type_basename.compare(match_type_name) == 0; + keep_match = type_scope.empty() && type_basename == match_type_name; } } diff --git a/lldb/source/Symbol/TypeMap.cpp b/lldb/source/Symbol/TypeMap.cpp index 5bbf6d6908c..337278c202e 100644 --- a/lldb/source/Symbol/TypeMap.cpp +++ b/lldb/source/Symbol/TypeMap.cpp @@ -223,8 +223,7 @@ void TypeMap::RemoveMismatchedTypes(const std::string &type_scope, } else { // The type we are currently looking at doesn't exists in a namespace // or class, so it only matches if there is no type scope... - keep_match = - type_scope.empty() && type_basename.compare(match_type_name) == 0; + keep_match = type_scope.empty() && type_basename == match_type_name; } } |