diff options
author | Greg Clayton <gclayton@apple.com> | 2012-10-22 16:19:56 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2012-10-22 16:19:56 +0000 |
commit | 7bc31332b8350e297e08477e39f7ca28f5f6de80 (patch) | |
tree | c98252325424c04297b21e4afa37a768b24c47c5 /lldb/source/Core/Module.cpp | |
parent | f17cd27362f85d8ed6955e626960e9f390c13983 (diff) | |
download | bcm5719-llvm-7bc31332b8350e297e08477e39f7ca28f5f6de80.tar.gz bcm5719-llvm-7bc31332b8350e297e08477e39f7ca28f5f6de80.zip |
<rdar://problem/12473003>
Allow type searches to specify a type keyword when searching for type. Currently supported type keywords are: struct, class, union, enum, and typedef.
So now you can search for types with a string like "struct foo".
llvm-svn: 166420
Diffstat (limited to 'lldb/source/Core/Module.cpp')
-rw-r--r-- | lldb/source/Core/Module.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 14d2e42ac50..08f826ee42b 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -696,7 +696,8 @@ Module::FindTypes (const SymbolContext& sc, std::string type_scope; std::string type_basename; const bool append = true; - if (Type::GetTypeScopeAndBasename (type_name_cstr, type_scope, type_basename)) + TypeClass type_class = eTypeClassAny; + if (Type::GetTypeScopeAndBasename (type_name_cstr, type_scope, type_basename, type_class)) { // Check if "name" starts with "::" which means the qualified type starts // from the root namespace and implies and exact match. The typenames we @@ -711,14 +712,25 @@ Module::FindTypes (const SymbolContext& sc, ConstString type_basename_const_str (type_basename.c_str()); if (FindTypes_Impl(sc, type_basename_const_str, NULL, append, max_matches, types)) { - types.RemoveMismatchedTypes (type_scope, type_basename, exact_match); + types.RemoveMismatchedTypes (type_scope, type_basename, type_class, exact_match); num_matches = types.GetSize(); } } else { // The type is not in a namespace/class scope, just search for it by basename - num_matches = FindTypes_Impl(sc, name, NULL, append, max_matches, types); + if (type_class != eTypeClassAny) + { + // The "type_name_cstr" will have been modified if we have a valid type class + // prefix (like "struct", "class", "union", "typedef" etc). + num_matches = FindTypes_Impl(sc, ConstString(type_name_cstr), NULL, append, max_matches, types); + types.RemoveMismatchedTypes (type_class); + num_matches = types.GetSize(); + } + else + { + num_matches = FindTypes_Impl(sc, name, NULL, append, max_matches, types); + } } return num_matches; |