Made LLDB compile with LLVM top-of-tree again.

The results from Clang name lookups changed to
be ArrayRefs, so I had to change the way we
check for the presence of a result and the way
we iterate across results.

llvm-svn: 170927
This commit is contained in:
Sean Callanan 2012-12-21 21:34:42 +00:00
parent bab7cc405d
commit 5deaa4c902
5 changed files with 14 additions and 21 deletions

View File

@ -854,13 +854,13 @@ FindObjCMethodDeclsWithOrigin (unsigned int current_id,
ObjCInterfaceDecl::lookup_result result = original_interface_decl->lookup(original_decl_name);
if (result.first == result.second)
if (result.empty())
return false;
if (!*result.first)
if (!result[0])
return false;
ObjCMethodDecl *result_method = dyn_cast<ObjCMethodDecl>(*result.first);
ObjCMethodDecl *result_method = dyn_cast<ObjCMethodDecl>(result[0]);
if (!result_method)
return false;
@ -1806,10 +1806,8 @@ NameSearchContext::AddTypeDecl(void *type)
void
NameSearchContext::AddLookupResult (clang::DeclContextLookupConstResult result)
{
for (clang::NamedDecl * const *decl_iterator = result.first;
decl_iterator != result.second;
++decl_iterator)
m_decls.push_back (*decl_iterator);
for (clang::NamedDecl *decl : result)
m_decls.push_back (decl);
}
void

View File

@ -616,9 +616,9 @@ AppleObjCTypeVendor::FindTypes (const ConstString &name,
clang::DeclContext::lookup_const_result lookup_result = ast_ctx->getTranslationUnitDecl()->lookup(decl_name);
if (lookup_result.first != lookup_result.second)
if (!lookup_result.empty())
{
if (const clang::ObjCInterfaceDecl *result_iface_decl = llvm::dyn_cast<clang::ObjCInterfaceDecl>(*lookup_result.first))
if (const clang::ObjCInterfaceDecl *result_iface_decl = llvm::dyn_cast<clang::ObjCInterfaceDecl>(lookup_result[0]))
{
clang::QualType result_iface_type = ast_ctx->getObjCInterfaceType(result_iface_decl);

View File

@ -9,8 +9,6 @@
#include "UnwindAssemblyInstEmulation.h"
#include "llvm-c/EnhancedDisassembly.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/DataBufferHeap.h"

View File

@ -1277,9 +1277,10 @@ ClangASTContext::CreateClassTemplateDecl (DeclContext *decl_ctx,
DeclarationName decl_name (&identifier_info);
clang::DeclContext::lookup_result result = decl_ctx->lookup(decl_name);
for (clang::DeclContext::lookup_iterator pos = result.first, end = result.second; pos != end; ++pos)
for (NamedDecl *decl : result)
{
class_template_decl = dyn_cast<clang::ClassTemplateDecl>(*pos);
class_template_decl = dyn_cast<clang::ClassTemplateDecl>(decl);
if (class_template_decl)
return class_template_decl;
}
@ -4564,12 +4565,9 @@ ClangASTContext::GetIndexOfChildMemberWithName
parent_record_decl = cast<RecordDecl>(elem.Base->getType()->getAs<RecordType>()->getDecl());
}
}
DeclContext::lookup_iterator named_decl_pos;
for (named_decl_pos = path->Decls.first;
named_decl_pos != path->Decls.second && parent_record_decl;
++named_decl_pos)
for (NamedDecl *path_decl : path->Decls)
{
child_idx = GetIndexForRecordChild (parent_record_decl, *named_decl_pos, omit_empty_base_classes);
child_idx = GetIndexForRecordChild (parent_record_decl, path_decl, omit_empty_base_classes);
if (child_idx == UINT32_MAX)
{
child_indexes.clear();
@ -5073,9 +5071,9 @@ ClangASTContext::GetUniqueNamespaceDeclaration (const char *name, DeclContext *d
IdentifierInfo &identifier_info = ast->Idents.get(name);
DeclarationName decl_name (&identifier_info);
clang::DeclContext::lookup_result result = decl_ctx->lookup(decl_name);
for (clang::DeclContext::lookup_iterator pos = result.first, end = result.second; pos != end; ++pos)
for (NamedDecl *decl : result)
{
namespace_decl = dyn_cast<clang::NamespaceDecl>(*pos);
namespace_decl = dyn_cast<clang::NamespaceDecl>(decl);
if (namespace_decl)
return namespace_decl;
}

View File

@ -1283,7 +1283,6 @@ ClangASTType::DumpTypeDescription (clang::ASTContext *ast_context, clang_type_t
if (class_interface_decl)
{
clang::PrintingPolicy policy = ast_context->getPrintingPolicy();
policy.DumpSourceManager = &ast_context->getSourceManager();
class_interface_decl->print(llvm_ostrm, policy, s->GetIndentLevel());
}
}