Fixed the Objective C method prototypes to be correct (the selectors weren't
being chopped up correctly). The DWARF plug-in also keeps a map of the ObjC
class names to selectors for easy parsing of all class selectors when we parse
the class type.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116290 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Symbol/ClangASTContext.cpp b/source/Symbol/ClangASTContext.cpp
index 074775d..e741cc0 100644
--- a/source/Symbol/ClangASTContext.cpp
+++ b/source/Symbol/ClangASTContext.cpp
@@ -1559,12 +1559,22 @@
return NULL;
llvm::SmallVector<IdentifierInfo *, 12> selector_idents;
- size_t len;
+ size_t len = 0;
const char *start;
- for (start = selector_start, len = ::strcspn(start, ":]");
+ //printf ("name = '%s'\n", name);
+
+ unsigned num_selectors_with_args = 0;
+ for (start = selector_start;
start && *start != '\0' && *start != ']';
- start += len + 1)
+ start += len)
{
+ len = ::strcspn(start, ":]");
+ if (start[len] == ':')
+ {
+ ++num_selectors_with_args;
+ len += 1;
+ }
+ //printf ("@selector[%zu] = '%.*s'\n", selector_idents.size(), (int)len, start);
selector_idents.push_back (&identifier_table->get (StringRef (start, len)));
}
@@ -1572,7 +1582,7 @@
if (selector_idents.size() == 0)
return 0;
- clang::Selector method_selector = ast_context->Selectors.getSelector (selector_idents.size(),
+ clang::Selector method_selector = ast_context->Selectors.getSelector (num_selectors_with_args ? selector_idents.size() : 0,
selector_idents.data());
QualType method_qual_type (QualType::getFromOpaquePtr (method_opaque_type));