diff options
| author | Sean Callanan <scallanan@apple.com> | 2011-12-01 21:04:37 +0000 |
|---|---|---|
| committer | Sean Callanan <scallanan@apple.com> | 2011-12-01 21:04:37 +0000 |
| commit | e0a64f7302fc115c19b4df46ad5b5cb72ffd5a15 (patch) | |
| tree | cbccf152af78c2731ed49505104730a5547805f9 /lldb/source/Expression/ClangASTSource.cpp | |
| parent | 54c9462c7797e3ff9358d33151fcd319a03d21af (diff) | |
| download | bcm5719-llvm-e0a64f7302fc115c19b4df46ad5b5cb72ffd5a15.tar.gz bcm5719-llvm-e0a64f7302fc115c19b4df46ad5b5cb72ffd5a15.zip | |
Modified clients of ClangASTImporter to be more robust
in the face of failures to import types, since blithely
passing on NULL types can sometimes lead to trouble.
Also eliminated a use of getAs and replaced it with
dyn_cast, which is more robust.
llvm-svn: 145628
Diffstat (limited to 'lldb/source/Expression/ClangASTSource.cpp')
| -rw-r--r-- | lldb/source/Expression/ClangASTSource.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp index ca97fc19d34..0eca0a455f8 100644 --- a/lldb/source/Expression/ClangASTSource.cpp +++ b/lldb/source/Expression/ClangASTSource.cpp @@ -503,6 +503,14 @@ ClangASTSource::FindExternalVisibleDecls (NameSearchContext &context, void *copied_type = GuardedCopyType(m_ast_context, type_sp->GetClangAST(), type_sp->GetClangFullType()); + if (!copied_type) + { + if (log) + log->Printf("ClangExpressionDeclMap::BuildIntegerVariable - Couldn't export the type for a constant integer result"); + + break; + } + context.AddTypeDecl(copied_type); } @@ -845,7 +853,7 @@ NameSearchContext::AddFunDecl (void *type) // this, we raid the function's FunctionProtoType for types. QualType qual_type (QualType::getFromOpaquePtr(type)); - const FunctionProtoType *func_proto_type = qual_type->getAs<FunctionProtoType>(); + const FunctionProtoType *func_proto_type = dyn_cast<FunctionProtoType>(qual_type.getTypePtr()); if (func_proto_type) { @@ -872,6 +880,12 @@ NameSearchContext::AddFunDecl (void *type) func_decl->setParams(ArrayRef<ParmVarDecl*>(parm_var_decls)); } + else + { + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); + + log->Printf("Function type wasn't a FunctionProtoType"); + } m_decls.push_back(func_decl); |

