forked from OSchip/llvm-project
Updated LLVM/Clang to pull in a fix for Objective-C
interfaces. This allows us to pull in Objective-C method types on demand, which is also now implemented. Also added a minor fix to prevent multiple-definition errors for "Class" and "id". llvm-svn: 144405
This commit is contained in:
parent
617940f166
commit
46198ff824
|
@ -21,8 +21,8 @@ our ($llvm_clang_basename, $llvm_clang_dirname) = fileparse ($llvm_clang_outfile
|
|||
|
||||
our $llvm_configuration = $ENV{LLVM_CONFIGURATION};
|
||||
|
||||
our $llvm_revision = "143631";
|
||||
our $clang_revision = "143631";
|
||||
our $llvm_revision = "144393";
|
||||
our $clang_revision = "144393";
|
||||
|
||||
our $SRCROOT = "$ENV{SRCROOT}";
|
||||
our $llvm_dstroot_zip = "$SRCROOT/llvm.zip";
|
||||
|
|
|
@ -429,6 +429,7 @@ ClangASTSource::FindExternalVisibleDecls (NameSearchContext &context,
|
|||
}
|
||||
|
||||
static ConstString id_name("id");
|
||||
static ConstString Class_name("Class");
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -437,7 +438,7 @@ ClangASTSource::FindExternalVisibleDecls (NameSearchContext &context,
|
|||
|
||||
if (module_sp && namespace_decl)
|
||||
module_sp->FindTypes(null_sc, name, &namespace_decl, true, 1, types);
|
||||
else if(name != id_name)
|
||||
else if(name != id_name && name != Class_name)
|
||||
m_target->GetImages().FindTypes (null_sc, name, true, 1, types);
|
||||
else
|
||||
break;
|
||||
|
@ -468,6 +469,9 @@ ClangASTSource::FindObjCMethodDecls (NameSearchContext &context)
|
|||
{
|
||||
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
|
||||
|
||||
static unsigned int invocation_id = 0;
|
||||
unsigned int current_id = invocation_id++;
|
||||
|
||||
const DeclarationName &decl_name(context.m_decl_name);
|
||||
const DeclContext *decl_ctx(context.m_decl_context);
|
||||
|
||||
|
@ -499,8 +503,69 @@ ClangASTSource::FindObjCMethodDecls (NameSearchContext &context)
|
|||
}
|
||||
ss.Flush();
|
||||
|
||||
ConstString selector_name(ss.GetData());
|
||||
|
||||
if (log)
|
||||
log->Printf("ClangASTSource::FindObjCMethodDecls for selector [%s %s]", interface_decl->getNameAsString().c_str(), ss.GetData());
|
||||
log->Printf("ClangASTSource::FindObjCMethodDecls[%d] for selector [%s %s]",
|
||||
current_id,
|
||||
interface_decl->getNameAsString().c_str(),
|
||||
selector_name.AsCString());
|
||||
|
||||
SymbolContextList sc_list;
|
||||
|
||||
const bool include_symbols = false;
|
||||
const bool append = false;
|
||||
|
||||
m_target->GetImages().FindFunctions(selector_name, lldb::eFunctionNameTypeSelector, include_symbols, append, sc_list);
|
||||
|
||||
for (uint32_t i = 0, e = sc_list.GetSize();
|
||||
i != e;
|
||||
++i)
|
||||
{
|
||||
SymbolContext sc;
|
||||
|
||||
if (!sc_list.GetContextAtIndex(i, sc))
|
||||
continue;
|
||||
|
||||
if (!sc.function)
|
||||
continue;
|
||||
|
||||
DeclContext *function_ctx = sc.function->GetClangDeclContext();
|
||||
|
||||
if (!function_ctx)
|
||||
continue;
|
||||
|
||||
ObjCMethodDecl *method_decl = dyn_cast<ObjCMethodDecl>(function_ctx);
|
||||
|
||||
if (!method_decl)
|
||||
continue;
|
||||
|
||||
ObjCInterfaceDecl *found_interface_decl = method_decl->getClassInterface();
|
||||
|
||||
if (!found_interface_decl)
|
||||
continue;
|
||||
|
||||
if (found_interface_decl->getName() == interface_decl->getName())
|
||||
{
|
||||
Decl *copied_decl = m_ast_importer->CopyDecl(&method_decl->getASTContext(), method_decl);
|
||||
|
||||
if (!copied_decl)
|
||||
continue;
|
||||
|
||||
ObjCMethodDecl *copied_method_decl = dyn_cast<ObjCMethodDecl>(copied_decl);
|
||||
|
||||
if (!copied_method_decl)
|
||||
continue;
|
||||
|
||||
if (log)
|
||||
{
|
||||
ASTDumper dumper((Decl*)copied_method_decl);
|
||||
log->Printf(" CAS::FOMD[%d] found %s", current_id, dumper.GetCString());
|
||||
}
|
||||
|
||||
context.AddNamedDecl(copied_method_decl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -937,7 +937,7 @@ ClangASTContext::GetBuiltInType_objc_id()
|
|||
clang_type_t
|
||||
ClangASTContext::GetBuiltInType_objc_Class()
|
||||
{
|
||||
return getASTContext()->ObjCBuiltinClassTy.getAsOpaquePtr();
|
||||
return getASTContext()->getPointerType(getASTContext()->ObjCBuiltinClassTy).getAsOpaquePtr();
|
||||
}
|
||||
|
||||
clang_type_t
|
||||
|
|
Loading…
Reference in New Issue