From 5deaa4c9025daac004a879a9a1f44a715db9930c Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Fri, 21 Dec 2012 21:34:42 +0000 Subject: 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 --- lldb/source/Expression/ClangASTSource.cpp | 12 +++++------- .../ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp | 4 ++-- .../InstEmulation/UnwindAssemblyInstEmulation.cpp | 2 -- lldb/source/Symbol/ClangASTContext.cpp | 16 +++++++--------- lldb/source/Symbol/ClangASTType.cpp | 1 - 5 files changed, 14 insertions(+), 21 deletions(-) (limited to 'lldb') diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp index 8d8fa6e2e5a..36f0e84b6b5 100644 --- a/lldb/source/Expression/ClangASTSource.cpp +++ b/lldb/source/Expression/ClangASTSource.cpp @@ -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(*result.first); + ObjCMethodDecl *result_method = dyn_cast(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 diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp index 19c99632baa..0a77406bb94 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp @@ -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(*lookup_result.first)) + if (const clang::ObjCInterfaceDecl *result_iface_decl = llvm::dyn_cast(lookup_result[0])) { clang::QualType result_iface_type = ast_ctx->getObjCInterfaceType(result_iface_decl); diff --git a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp index efc03b327e6..004d6b5fe7e 100644 --- a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp +++ b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp @@ -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" diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index dc29bd06be9..ef8b3403c74 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -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(*pos); + class_template_decl = dyn_cast(decl); if (class_template_decl) return class_template_decl; } @@ -4564,12 +4565,9 @@ ClangASTContext::GetIndexOfChildMemberWithName parent_record_decl = cast(elem.Base->getType()->getAs()->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(*pos); + namespace_decl = dyn_cast(decl); if (namespace_decl) return namespace_decl; } diff --git a/lldb/source/Symbol/ClangASTType.cpp b/lldb/source/Symbol/ClangASTType.cpp index 1037aaa7625..642819e2e46 100644 --- a/lldb/source/Symbol/ClangASTType.cpp +++ b/lldb/source/Symbol/ClangASTType.cpp @@ -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()); } } -- cgit v1.2.1