forked from OSchip/llvm-project
Use StringRef to avoid unnecessary copies into std::strings
This commit is contained in:
parent
534a2bf99e
commit
65cac0ed92
|
@ -49,10 +49,11 @@ public:
|
|||
|
||||
void ForEach(std::function<bool(lldb::TypeSP &type_sp)> const &callback);
|
||||
|
||||
void RemoveMismatchedTypes(const char *qualified_typename, bool exact_match);
|
||||
void RemoveMismatchedTypes(llvm::StringRef qualified_typename,
|
||||
bool exact_match);
|
||||
|
||||
void RemoveMismatchedTypes(const std::string &type_scope,
|
||||
const std::string &type_basename,
|
||||
void RemoveMismatchedTypes(llvm::StringRef type_scope,
|
||||
llvm::StringRef type_basename,
|
||||
lldb::TypeClass type_class, bool exact_match);
|
||||
|
||||
void RemoveMismatchedTypes(lldb::TypeClass type_class);
|
||||
|
|
|
@ -53,10 +53,11 @@ public:
|
|||
|
||||
bool Remove(const lldb::TypeSP &type_sp);
|
||||
|
||||
void RemoveMismatchedTypes(const char *qualified_typename, bool exact_match);
|
||||
void RemoveMismatchedTypes(llvm::StringRef qualified_typename,
|
||||
bool exact_match);
|
||||
|
||||
void RemoveMismatchedTypes(const std::string &type_scope,
|
||||
const std::string &type_basename,
|
||||
void RemoveMismatchedTypes(llvm::StringRef type_scope,
|
||||
llvm::StringRef type_basename,
|
||||
lldb::TypeClass type_class, bool exact_match);
|
||||
|
||||
void RemoveMismatchedTypes(lldb::TypeClass type_class);
|
||||
|
|
|
@ -1000,8 +1000,7 @@ void Module::FindTypes(
|
|||
FindTypes_Impl(type_basename_const_str, CompilerDeclContext(), max_matches,
|
||||
searched_symbol_files, typesmap);
|
||||
if (typesmap.GetSize())
|
||||
typesmap.RemoveMismatchedTypes(std::string(type_scope),
|
||||
std::string(type_basename), type_class,
|
||||
typesmap.RemoveMismatchedTypes(type_scope, type_basename, type_class,
|
||||
exact_match);
|
||||
} else {
|
||||
// The type is not in a namespace/class scope, just search for it by
|
||||
|
@ -1011,15 +1010,13 @@ void Module::FindTypes(
|
|||
// class prefix (like "struct", "class", "union", "typedef" etc).
|
||||
FindTypes_Impl(ConstString(type_basename), CompilerDeclContext(),
|
||||
UINT_MAX, searched_symbol_files, typesmap);
|
||||
typesmap.RemoveMismatchedTypes(std::string(type_scope),
|
||||
std::string(type_basename), type_class,
|
||||
typesmap.RemoveMismatchedTypes(type_scope, type_basename, type_class,
|
||||
exact_match);
|
||||
} else {
|
||||
FindTypes_Impl(name, CompilerDeclContext(), UINT_MAX,
|
||||
searched_symbol_files, typesmap);
|
||||
if (exact_match) {
|
||||
std::string name_str(name.AsCString(""));
|
||||
typesmap.RemoveMismatchedTypes(std::string(type_scope), name_str,
|
||||
typesmap.RemoveMismatchedTypes(type_scope, name.AsCString(""),
|
||||
type_class, exact_match);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ void TypeList::Dump(Stream *s, bool show_context) {
|
|||
}
|
||||
}
|
||||
|
||||
void TypeList::RemoveMismatchedTypes(const char *qualified_typename,
|
||||
void TypeList::RemoveMismatchedTypes(llvm::StringRef qualified_typename,
|
||||
bool exact_match) {
|
||||
llvm::StringRef type_scope;
|
||||
llvm::StringRef type_basename;
|
||||
|
@ -107,13 +107,12 @@ void TypeList::RemoveMismatchedTypes(const char *qualified_typename,
|
|||
type_basename = qualified_typename;
|
||||
type_scope = "";
|
||||
}
|
||||
return RemoveMismatchedTypes(std::string(type_scope),
|
||||
std::string(type_basename), type_class,
|
||||
return RemoveMismatchedTypes(type_scope, type_basename, type_class,
|
||||
exact_match);
|
||||
}
|
||||
|
||||
void TypeList::RemoveMismatchedTypes(const std::string &type_scope,
|
||||
const std::string &type_basename,
|
||||
void TypeList::RemoveMismatchedTypes(llvm::StringRef type_scope,
|
||||
llvm::StringRef type_basename,
|
||||
TypeClass type_class, bool exact_match) {
|
||||
// Our "collection" type currently is a std::map which doesn't have any good
|
||||
// way to iterate and remove items from the map so we currently just make a
|
||||
|
|
|
@ -127,7 +127,7 @@ void TypeMap::Dump(Stream *s, bool show_context, lldb::DescriptionLevel level) {
|
|||
}
|
||||
}
|
||||
|
||||
void TypeMap::RemoveMismatchedTypes(const char *qualified_typename,
|
||||
void TypeMap::RemoveMismatchedTypes(llvm::StringRef qualified_typename,
|
||||
bool exact_match) {
|
||||
llvm::StringRef type_scope;
|
||||
llvm::StringRef type_basename;
|
||||
|
@ -137,13 +137,12 @@ void TypeMap::RemoveMismatchedTypes(const char *qualified_typename,
|
|||
type_basename = qualified_typename;
|
||||
type_scope = "";
|
||||
}
|
||||
return RemoveMismatchedTypes(std::string(type_scope),
|
||||
std::string(type_basename), type_class,
|
||||
return RemoveMismatchedTypes(type_scope, type_basename, type_class,
|
||||
exact_match);
|
||||
}
|
||||
|
||||
void TypeMap::RemoveMismatchedTypes(const std::string &type_scope,
|
||||
const std::string &type_basename,
|
||||
void TypeMap::RemoveMismatchedTypes(llvm::StringRef type_scope,
|
||||
llvm::StringRef type_basename,
|
||||
TypeClass type_class, bool exact_match) {
|
||||
// Our "collection" type currently is a std::map which doesn't have any good
|
||||
// way to iterate and remove items from the map so we currently just make a
|
||||
|
|
Loading…
Reference in New Issue