[Lldb-commits] [lldb] r246563 - When looking up types, find the first type we can import rather than just taking
Sean Callanan via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 1 11:00:35 PDT 2015
Author: spyffe
Date: Tue Sep 1 13:00:35 2015
New Revision: 246563
URL: http://llvm.org/viewvc/llvm-project?rev=246563&view=rev
Log:
When looking up types, find the first type we can import rather than just taking
the first type we find and failing if it can't be imported.
Modified:
lldb/trunk/source/Expression/ClangASTSource.cpp
Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=246563&r1=246562&r2=246563&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Tue Sep 1 13:00:35 2015
@@ -746,38 +746,42 @@ ClangASTSource::FindExternalVisibleDecls
bool found_a_type = false;
- if (types.GetSize())
+ if (size_t num_types = types.GetSize())
{
- lldb::TypeSP type_sp = types.GetTypeAtIndex(0);
-
- if (log)
- {
- const char *name_string = type_sp->GetName().GetCString();
-
- log->Printf(" CAS::FEVD[%u] Matching type found for \"%s\": %s",
- current_id,
- name.GetCString(),
- (name_string ? name_string : "<anonymous>"));
- }
-
- CompilerType full_type = type_sp->GetFullCompilerType ();
-
- CompilerType copied_clang_type (GuardedCopyType(full_type));
-
- if (!copied_clang_type)
+ for (size_t ti = 0; ti < num_types; ++ti)
{
+ lldb::TypeSP type_sp = types.GetTypeAtIndex(ti);
+
if (log)
- log->Printf(" CAS::FEVD[%u] - Couldn't export a type",
- current_id);
-
+ {
+ const char *name_string = type_sp->GetName().GetCString();
+
+ log->Printf(" CAS::FEVD[%u] Matching type found for \"%s\": %s",
+ current_id,
+ name.GetCString(),
+ (name_string ? name_string : "<anonymous>"));
+ }
+
+ CompilerType full_type = type_sp->GetFullCompilerType();
+
+ CompilerType copied_clang_type (GuardedCopyType(full_type));
+
+ if (!copied_clang_type)
+ {
+ if (log)
+ log->Printf(" CAS::FEVD[%u] - Couldn't export a type",
+ current_id);
+
+ continue;
+ }
+
+ context.AddTypeDecl(copied_clang_type);
+
+ found_a_type = true;
break;
}
-
- context.AddTypeDecl(copied_clang_type);
-
- found_a_type = true;
}
-
+
if (!found_a_type)
{
// Try the modules next.
@@ -1885,6 +1889,9 @@ ClangASTSource::AddNamespace (NameSearch
CompilerType
ClangASTSource::GuardedCopyType (const CompilerType &src_type)
{
+ if (!ClangASTContext::IsClangType(src_type))
+ return CompilerType();
+
ClangASTMetrics::RegisterLLDBImport();
ClangASTContext* src_ast = src_type.GetTypeSystem()->AsClangASTContext();
More information about the lldb-commits
mailing list