summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2013-02-12 08:01:13 +0000
committerSean Callanan <scallanan@apple.com>2013-02-12 08:01:13 +0000
commiteeffea416bb5b291f96b4222cc6ff6f222952334 (patch)
treeda1a90370507d9b2a06f3bec4678d5fd152ea95d
parent7cde51d84318cf1c33ec8252bf3badf2c5755c1e (diff)
downloadbcm5719-llvm-eeffea416bb5b291f96b4222cc6ff6f222952334.tar.gz
bcm5719-llvm-eeffea416bb5b291f96b4222cc6ff6f222952334.zip
Made LLDB build with the latest Clang. This meant
changing the ClangASTSource to return a bool instead of returning a list of results. Our testsuite mostly works with this change, but some minor issues may remain both on LLDB's side and on Clang's side. llvm-svn: 174949
-rw-r--r--lldb/include/lldb/Expression/ClangASTSource.h4
-rw-r--r--lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h2
-rw-r--r--lldb/source/Expression/ClangASTSource.cpp46
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp11
-rw-r--r--lldb/source/Symbol/ClangExternalASTSourceCallbacks.cpp50
5 files changed, 70 insertions, 43 deletions
diff --git a/lldb/include/lldb/Expression/ClangASTSource.h b/lldb/include/lldb/Expression/ClangASTSource.h
index 95bbba36f74..eebc11be5e4 100644
--- a/lldb/include/lldb/Expression/ClangASTSource.h
+++ b/lldb/include/lldb/Expression/ClangASTSource.h
@@ -98,7 +98,7 @@ public:
/// @return
/// Whatever SetExternalVisibleDeclsForName returns.
//------------------------------------------------------------------
- clang::DeclContextLookupResult
+ bool
FindExternalVisibleDeclsByName (const clang::DeclContext *DC,
clang::DeclarationName Name);
@@ -248,7 +248,7 @@ public:
{
}
- clang::DeclContextLookupResult
+ bool
FindExternalVisibleDeclsByName (const clang::DeclContext *DC,
clang::DeclarationName Name)
{
diff --git a/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h b/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
index d37f10fa57d..5fc4b0bad0d 100644
--- a/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
+++ b/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
@@ -113,7 +113,7 @@ public:
return clang::ELR_Failure;
}
- virtual clang::DeclContextLookupResult
+ virtual bool
FindExternalVisibleDeclsByName (const clang::DeclContext *decl_ctx,
clang::DeclarationName decl_name);
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp
index ed3e6299294..7a3bda13012 100644
--- a/lldb/source/Expression/ClangASTSource.cpp
+++ b/lldb/source/Expression/ClangASTSource.cpp
@@ -56,7 +56,7 @@ ClangASTSource::StartTranslationUnit(ASTConsumer *Consumer)
}
// The core lookup interface.
-DeclContext::lookup_result
+bool
ClangASTSource::FindExternalVisibleDeclsByName
(
const DeclContext *decl_ctx,
@@ -64,11 +64,17 @@ ClangASTSource::FindExternalVisibleDeclsByName
)
{
if (!m_ast_context)
- return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ {
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
+ }
if (GetImportInProgress())
- return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
-
+ {
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
+ }
+
std::string decl_name (clang_decl_name.getAsString());
// if (m_decl_map.DoingASTImport ())
@@ -83,7 +89,8 @@ ClangASTSource::FindExternalVisibleDeclsByName
if (!identifier_info ||
identifier_info->getBuiltinID() != 0)
{
- return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
}
}
break;
@@ -91,12 +98,14 @@ ClangASTSource::FindExternalVisibleDeclsByName
// Operator names. Not important for now.
case DeclarationName::CXXOperatorName:
case DeclarationName::CXXLiteralOperatorName:
- return DeclContext::lookup_result();
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
// Using directives found in this context.
// Tell Sema we didn't find any or we'll end up getting asked a *lot*.
case DeclarationName::CXXUsingDirective:
- return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
case DeclarationName::ObjCZeroArgSelector:
case DeclarationName::ObjCOneArgSelector:
@@ -108,13 +117,15 @@ ClangASTSource::FindExternalVisibleDeclsByName
FindObjCMethodDecls(method_search_context);
- return SetExternalVisibleDeclsForName (decl_ctx, clang_decl_name, method_decls);
+ SetExternalVisibleDeclsForName (decl_ctx, clang_decl_name, method_decls);
+ return (method_decls.size() > 0);
}
// These aren't possible in the global context.
case DeclarationName::CXXConstructorName:
case DeclarationName::CXXDestructorName:
case DeclarationName::CXXConversionFunctionName:
- return DeclContext::lookup_result();
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
}
@@ -128,7 +139,8 @@ ClangASTSource::FindExternalVisibleDeclsByName
}
else
{
- return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
}
}
@@ -138,7 +150,8 @@ ClangASTSource::FindExternalVisibleDeclsByName
if (m_active_lookups.find (uniqued_const_decl_name) != m_active_lookups.end())
{
// We are currently looking up this name...
- return DeclContext::lookup_result();
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
}
m_active_lookups.insert(uniqued_const_decl_name);
// static uint32_t g_depth = 0;
@@ -147,10 +160,10 @@ ClangASTSource::FindExternalVisibleDeclsByName
llvm::SmallVector<NamedDecl*, 4> name_decls;
NameSearchContext name_search_context(*this, name_decls, clang_decl_name, decl_ctx);
FindExternalVisibleDecls(name_search_context);
- DeclContext::lookup_result result (SetExternalVisibleDeclsForName (decl_ctx, clang_decl_name, name_decls));
+ SetExternalVisibleDeclsForName (decl_ctx, clang_decl_name, name_decls);
// --g_depth;
m_active_lookups.erase (uniqued_const_decl_name);
- return result;
+ return (name_decls.size() != 0);
}
void
@@ -1646,9 +1659,14 @@ ClangASTSource::AddNamespace (NameSearchContext &context, ClangASTImporter::Name
if (!copied_decl)
return NULL;
-
+
NamespaceDecl *copied_namespace_decl = dyn_cast<NamespaceDecl>(copied_decl);
+ if (!copied_namespace_decl)
+ return NULL;
+
+ context.m_decls.push_back(copied_namespace_decl);
+
m_ast_importer->RegisterNamespaceMap(copied_namespace_decl, namespace_decls);
return dyn_cast<NamespaceDecl>(copied_decl);
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp
index 0a77406bb94..f601c8ba4a1 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp
@@ -30,7 +30,7 @@ public:
{
}
- clang::DeclContextLookupResult
+ bool
FindExternalVisibleDeclsByName (const clang::DeclContext *decl_ctx,
clang::DeclarationName name)
{
@@ -60,12 +60,15 @@ public:
if (!m_type_vendor.FinishDecl(non_const_interface_decl))
break;
-
- return non_const_interface_decl->lookup(name);
+
+ clang::DeclContext::lookup_const_result result = non_const_interface_decl->lookup(name);
+
+ return (result.size() != 0);
}
while(0);
- return clang::DeclContextLookupResult();
+ SetNoExternalVisibleDeclsForName(decl_ctx, name);
+ return false;
}
clang::ExternalLoadResult
diff --git a/lldb/source/Symbol/ClangExternalASTSourceCallbacks.cpp b/lldb/source/Symbol/ClangExternalASTSourceCallbacks.cpp
index 314408daa7b..b2328d6e5b4 100644
--- a/lldb/source/Symbol/ClangExternalASTSourceCallbacks.cpp
+++ b/lldb/source/Symbol/ClangExternalASTSourceCallbacks.cpp
@@ -45,7 +45,7 @@
using namespace clang;
using namespace lldb_private;
-clang::DeclContextLookupResult
+bool
ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName
(
const clang::DeclContext *decl_ctx,
@@ -58,9 +58,9 @@ ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName
m_callback_find_by_name (m_callback_baton, decl_ctx, clang_decl_name, &results);
- DeclContextLookupResult lookup_result (SetExternalVisibleDeclsForName(decl_ctx, clang_decl_name, results));
+ SetExternalVisibleDeclsForName(decl_ctx, clang_decl_name, results);
- return lookup_result;
+ return (results.size() != 0);
}
std::string decl_name (clang_decl_name.getAsString());
@@ -70,55 +70,61 @@ ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName
case clang::DeclarationName::Identifier:
//printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"Identifier\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
if (clang_decl_name.getAsIdentifierInfo()->getBuiltinID() != 0)
- return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ {
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
+ }
break;
case clang::DeclarationName::ObjCZeroArgSelector:
//printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"ObjCZeroArgSelector\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- return DeclContext::lookup_result();
- break;
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
case clang::DeclarationName::ObjCOneArgSelector:
//printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"ObjCOneArgSelector\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- return DeclContext::lookup_result();
- break;
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
case clang::DeclarationName::ObjCMultiArgSelector:
//printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"ObjCMultiArgSelector\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- return DeclContext::lookup_result();
- break;
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
case clang::DeclarationName::CXXConstructorName:
//printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXConstructorName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- return DeclContext::lookup_result();
- break;
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
+
case clang::DeclarationName::CXXDestructorName:
//printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXDestructorName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- return DeclContext::lookup_result();
- break;
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
case clang::DeclarationName::CXXConversionFunctionName:
//printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXConversionFunctionName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- return DeclContext::lookup_result();
- break;
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
case clang::DeclarationName::CXXOperatorName:
//printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXOperatorName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- return DeclContext::lookup_result();
- break;
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
case clang::DeclarationName::CXXLiteralOperatorName:
//printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXLiteralOperatorName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- return DeclContext::lookup_result();
- break;
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
case clang::DeclarationName::CXXUsingDirective:
//printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXUsingDirective\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
- return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
}
- return DeclContext::lookup_result();
+ SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+ return false;
}
void
OpenPOWER on IntegriCloud