Commit 26267c03 authored by Erik Verbruggen's avatar Erik Verbruggen

Improved ObjC parsing, and added semantic checks.

parent a9b521f8
......@@ -154,6 +154,14 @@ void CheckUndefinedSymbols::buildTypeMap(NamespaceBinding *binding, QSet<Namespa
} else if (Declaration *decl = member->asDeclaration()) {
if (decl->isTypedef())
addType(decl->name());
} else if (ObjCForwardClassDeclaration *fKlass = member->asObjCForwardClassDeclaration()) {
addType(fKlass->name());
} else if (ObjCClass *klass = member->asObjCClass()) {
addType(klass->name());
} else if (ObjCForwardProtocolDeclaration *fProto = member->asObjCForwardProtocolDeclaration()) {
addType(fProto->name());
} else if (ObjCProtocol *proto = member->asObjCProtocol()) {
addType(proto->name());
}
}
}
......
......@@ -98,6 +98,10 @@ QIcon Icons::iconForSymbol(const Symbol *symbol) const
return _enumIcon;
} else if (symbol->isClass() || symbol->isForwardClassDeclaration()) {
return _classIcon;
} else if (symbol->isObjCClass() || symbol->isObjCForwardClassDeclaration()) {
return _classIcon;
} else if (symbol->isObjCProtocol() || symbol->isObjCForwardProtocolDeclaration()) {
return _classIcon;
} else if (symbol->isNamespace()) {
return _namespaceIcon;
} else if (symbol->isUsingNamespaceDirective() ||
......
......@@ -1906,14 +1906,17 @@ unsigned WhileStatementAST::lastToken() const
// ObjC++
unsigned IdentifierListAST::firstToken() const
{
return identifier_token;
if (name)
return name->firstToken();
else
return comma_token;
}
unsigned IdentifierListAST::lastToken() const
{
for (const IdentifierListAST *it = this; it; it = it->next) {
if (! it->next && it->identifier_token) {
return it->identifier_token + 1;
if (! it->next && it->name) {
return it->name->lastToken();
}
}
// ### assert?
......@@ -1934,8 +1937,8 @@ unsigned ObjCClassDeclarationAST::lastToken() const
return semicolon_token + 1;
for (IdentifierListAST *it = identifier_list; it; it = it->next) {
if (! it->next && it->identifier_token)
return it->identifier_token + 1;
if (! it->next && it->name)
return it->name->lastToken();
}
for (SpecifierAST *it = attributes; it; it = it->next) {
......@@ -1959,8 +1962,8 @@ unsigned ObjCProtocolDeclarationAST::lastToken() const
return semicolon_token + 1;
for (IdentifierListAST *it = identifier_list; it; it = it->next) {
if (! it->next && it->identifier_token)
return it->identifier_token + 1;
if (! it->next && it->name)
return it->name->lastToken();
}
for (SpecifierAST *it = attributes; it; it = it->next) {
......@@ -1971,21 +1974,21 @@ unsigned ObjCProtocolDeclarationAST::lastToken() const
return protocol_token + 1;
}
unsigned ObjCClassInterfaceDeclarationAST::firstToken() const
unsigned ObjCClassInterfaceDefinitionAST::firstToken() const
{
if (attributes)
return attributes->firstToken();
return interface_token;
}
unsigned ObjCClassInterfaceDeclarationAST::lastToken() const
unsigned ObjCClassInterfaceDefinitionAST::lastToken() const
{
if (end_token) return end_token + 1;
if (member_declarations) return member_declarations->lastToken();
if (inst_vars_decl) return inst_vars_decl->lastToken();
if (superclass_identifier_token) return superclass_identifier_token + 1;
if (colon_token) return colon_token + 1;
if (class_identifier_token) return class_identifier_token + 1;
if (class_name) return class_name->lastToken();
for (SpecifierAST *it = attributes; it; it = it->next) {
if (! it->next)
......@@ -2036,8 +2039,8 @@ unsigned ObjCProtocolDefinitionAST::lastToken() const
if (protocol_refs)
return protocol_refs->lastToken();
if (identifier_token)
return identifier_token + 1;
if (name)
return name->lastToken();
for (SpecifierAST *it = attributes; it; it = it->next) {
if (! it->next)
......@@ -2057,8 +2060,8 @@ unsigned ObjCProtocolRefsAST::lastToken() const
if (greater_token) return greater_token + 1;
for (IdentifierListAST *it = identifier_list; it; it = it->next) {
if (! it->next && it->identifier_token)
return it->identifier_token + 1;
if (! it->next && it->name)
return it->name->lastToken();
}
return less_token + 1;
......@@ -2169,6 +2172,74 @@ unsigned ObjCEncodeExpressionAST::lastToken() const
return encode_token + 1;
}
unsigned ObjCSelectorWithoutArgumentsAST::firstToken() const
{
return name_token;
}
unsigned ObjCSelectorWithoutArgumentsAST::lastToken() const
{
return name_token + 1;
}
unsigned ObjCSelectorArgumentAST::firstToken() const
{
return name_token;
}
unsigned ObjCSelectorArgumentAST::lastToken() const
{
if (colon_token)
return colon_token + 1;
else
return name_token + 1;
}
unsigned ObjCSelectorArgumentListAST::firstToken() const
{
if (argument)
return argument->firstToken();
// ### assert?
return 0;
}
unsigned ObjCSelectorArgumentListAST::lastToken() const
{
for (const ObjCSelectorArgumentListAST *it = this; it; it = it->next)
if (!it->next && it->argument)
return it->argument->lastToken();
// ### assert?
return 0;
}
unsigned ObjCSelectorWithArgumentsAST::firstToken() const
{
return selector_arguments->firstToken();
}
unsigned ObjCSelectorWithArgumentsAST::lastToken() const
{
return selector_arguments->lastToken();
}
unsigned ObjCSelectorExpressionAST::firstToken() const
{
return selector_token;
}
unsigned ObjCSelectorExpressionAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (selector)
return selector->lastToken();
if (lparen_token)
return rparen_token + 1;
return selector_token + 1;
}
unsigned ObjCInstanceVariablesDeclarationAST::firstToken() const
{
return lbrace_token;
......@@ -2179,9 +2250,6 @@ unsigned ObjCInstanceVariablesDeclarationAST::lastToken() const
if (rbrace_token)
return rbrace_token + 1;
if (member_declarations)
return member_declarations->lastToken();
if (instance_variables)
return instance_variables->lastToken();
......@@ -2198,24 +2266,22 @@ unsigned ObjCVisibilityDeclarationAST::lastToken() const
return visibility_token + 1;
}
unsigned ObjcPropertyAttributeAST::firstToken() const
unsigned ObjCPropertyAttributeAST::firstToken() const
{
return attribute_identifier_token;
}
unsigned ObjcPropertyAttributeAST::lastToken() const
unsigned ObjCPropertyAttributeAST::lastToken() const
{
if (colon_token)
return colon_token + 1;
if (method_selector_identifier_token)
return method_selector_identifier_token + 1;
if (method_selector)
return method_selector->lastToken();
if (equals_token)
return equals_token + 1;
return attribute_identifier_token + 1;
}
unsigned ObjcPropertyAttributeListAST::firstToken() const
unsigned ObjCPropertyAttributeListAST::firstToken() const
{
if (attr)
return attr->firstToken();
......@@ -2228,9 +2294,9 @@ unsigned ObjcPropertyAttributeListAST::firstToken() const
return 0;
}
unsigned ObjcPropertyAttributeListAST::lastToken() const
unsigned ObjCPropertyAttributeListAST::lastToken() const
{
for (const ObjcPropertyAttributeListAST *it = this; it; it = it->next) {
for (const ObjCPropertyAttributeListAST *it = this; it; it = it->next) {
if (! it->next && (comma_token || it->attr)) {
if (comma_token)
return comma_token + 1;
......@@ -2266,21 +2332,21 @@ unsigned ObjCPropertyDeclarationAST::lastToken() const
unsigned ObjCMessageArgumentDeclarationAST::firstToken() const
{
return param_selector_token;
if (type_name)
return type_name->firstToken();
else
return param_name_token;
}
unsigned ObjCMessageArgumentDeclarationAST::lastToken() const
{
if (param_name_token)
return param_name_token + 1;
else if (colon_token)
return colon_token + 1;
else if (type_name)
return type_name->lastToken();
else if (attributes)
return attributes->lastToken();
else
return param_name_token + 1;
// ### assert?
return 0;
}
unsigned ObjCMessageArgumentDeclarationListAST::firstToken() const
......
This diff is collapsed.
......@@ -1207,7 +1207,8 @@ IdentifierListAST *IdentifierListAST::clone(MemoryPool *pool) const
{
IdentifierListAST *ast = new (pool) IdentifierListAST;
// copy IdentifierListAST
ast->identifier_token = identifier_token;
if (ast->name) ast->name = name->clone(pool);
ast->comma_token = comma_token;
if (next) ast->next = next->clone(pool);
return ast;
}
......@@ -1224,14 +1225,14 @@ ObjCClassDeclarationAST *ObjCClassDeclarationAST::clone(MemoryPool *pool) const
return ast;
}
ObjCClassInterfaceDeclarationAST *ObjCClassInterfaceDeclarationAST::clone(MemoryPool *pool) const
ObjCClassInterfaceDefinitionAST *ObjCClassInterfaceDefinitionAST::clone(MemoryPool *pool) const
{
ObjCClassInterfaceDeclarationAST *ast = new (pool) ObjCClassInterfaceDeclarationAST;
ObjCClassInterfaceDefinitionAST *ast = new (pool) ObjCClassInterfaceDefinitionAST;
// copy DeclarationAST
// copy ObjCClassInterfaceDeclarationAST
if (attributes) ast->attributes = attributes->clone(pool);
ast->interface_token = interface_token;
ast->class_identifier_token = class_identifier_token;
if (class_name) ast->class_name = class_name->clone(pool);
ast->colon_token = colon_token;
ast->superclass_identifier_token = superclass_identifier_token;
if (protocol_refs) ast->protocol_refs = protocol_refs->clone(pool);
......@@ -1273,7 +1274,7 @@ ObjCProtocolDefinitionAST *ObjCProtocolDefinitionAST::clone(MemoryPool *pool) co
ObjCProtocolDefinitionAST *ast = new (pool) ObjCProtocolDefinitionAST;
if (attributes) ast->attributes = attributes->clone(pool);
ast->protocol_token = protocol_token;
ast->identifier_token = identifier_token;
if (name) ast->name = name->clone(pool);
if (protocol_refs) ast->protocol_refs = protocol_refs->clone(pool);
if (member_declarations) ast->member_declarations = member_declarations->clone(pool);
ast->end_token = end_token;
......@@ -1344,12 +1345,51 @@ ObjCEncodeExpressionAST *ObjCEncodeExpressionAST::clone(MemoryPool *pool) const
return ast;
}
ObjCSelectorWithoutArgumentsAST *ObjCSelectorWithoutArgumentsAST::clone(MemoryPool *pool) const
{
ObjCSelectorWithoutArgumentsAST *ast = new (pool) ObjCSelectorWithoutArgumentsAST;
ast->name_token = name_token;
return ast;
}
ObjCSelectorArgumentAST *ObjCSelectorArgumentAST::clone(MemoryPool *pool) const
{
ObjCSelectorArgumentAST *ast = new (pool) ObjCSelectorArgumentAST;
ast->name_token = name_token;
ast->colon_token = colon_token;
return ast;
}
ObjCSelectorArgumentListAST *ObjCSelectorArgumentListAST::clone(MemoryPool *pool) const
{
ObjCSelectorArgumentListAST *ast = new (pool) ObjCSelectorArgumentListAST;
if (argument) ast->argument = argument->clone(pool);
if (next) ast->next = next->clone(pool);
return ast;
}
ObjCSelectorWithArgumentsAST *ObjCSelectorWithArgumentsAST::clone(MemoryPool *pool) const
{
ObjCSelectorWithArgumentsAST *ast = new (pool) ObjCSelectorWithArgumentsAST;
if (selector_arguments) ast->selector_arguments = selector_arguments->clone(pool);
return ast;
}
ObjCSelectorExpressionAST *ObjCSelectorExpressionAST::clone(MemoryPool *pool) const
{
ObjCSelectorExpressionAST *ast = new (pool) ObjCSelectorExpressionAST;
ast->selector_token = selector_token;
ast->lparen_token = lparen_token;
if (selector) ast->selector = selector->clone(pool);
ast->rparen_token = rparen_token;
return ast;
}
ObjCInstanceVariablesDeclarationAST *ObjCInstanceVariablesDeclarationAST::clone(MemoryPool *pool) const
{
ObjCInstanceVariablesDeclarationAST *ast = new (pool) ObjCInstanceVariablesDeclarationAST;
ast->lbrace_token = lbrace_token;
if (instance_variables) ast->instance_variables = instance_variables->clone(pool);
if (member_declarations) ast->member_declarations = member_declarations->clone(pool);
ast->rbrace_token = rbrace_token;
return ast;
}
......@@ -1361,19 +1401,18 @@ ObjCVisibilityDeclarationAST *ObjCVisibilityDeclarationAST::clone(MemoryPool *po
return ast;
}
ObjcPropertyAttributeAST *ObjcPropertyAttributeAST::clone(MemoryPool *pool) const
ObjCPropertyAttributeAST *ObjCPropertyAttributeAST::clone(MemoryPool *pool) const
{
ObjcPropertyAttributeAST *ast = new (pool) ObjcPropertyAttributeAST;
ObjCPropertyAttributeAST *ast = new (pool) ObjCPropertyAttributeAST;
ast->attribute_identifier_token = attribute_identifier_token;
ast->equals_token = equals_token;
ast->method_selector_identifier_token = method_selector_identifier_token;
ast->colon_token = colon_token;
if (method_selector) ast->method_selector = method_selector->clone(pool);
return ast;
}
ObjcPropertyAttributeListAST *ObjcPropertyAttributeListAST::clone(MemoryPool *pool) const
ObjCPropertyAttributeListAST *ObjCPropertyAttributeListAST::clone(MemoryPool *pool) const
{
ObjcPropertyAttributeListAST *ast = new (pool) ObjcPropertyAttributeListAST;
ObjCPropertyAttributeListAST *ast = new (pool) ObjCPropertyAttributeListAST;
if (attr) ast->attr = attr->clone(pool);
ast->comma_token = comma_token;
if (next) ast->next = next->clone(pool);
......@@ -1395,8 +1434,6 @@ ObjCPropertyDeclarationAST *ObjCPropertyDeclarationAST::clone(MemoryPool *pool)
ObjCMessageArgumentDeclarationAST *ObjCMessageArgumentDeclarationAST::clone(MemoryPool *pool) const
{
ObjCMessageArgumentDeclarationAST *ast = new (pool) ObjCMessageArgumentDeclarationAST;
ast->param_selector_token = param_selector_token;
ast->colon_token = colon_token;
if (type_name) ast->type_name = type_name->clone(pool);
if (attributes) ast->attributes = attributes->clone(pool);
ast->param_name_token = param_name_token;
......
......@@ -1122,6 +1122,9 @@ void IdentifierListAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
// visit IdentifierListAST
if (name)
accept(name, visitor);
// visit AST
}
visitor->endVisit(this);
}
......@@ -1139,7 +1142,7 @@ void ObjCClassDeclarationAST::accept0(ASTVisitor *visitor)
visitor->endVisit(this);
}
void ObjCClassInterfaceDeclarationAST::accept0(ASTVisitor *visitor)
void ObjCClassInterfaceDefinitionAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
// visit ObjCClassInterfaceDeclarationAST
......@@ -1189,6 +1192,8 @@ void ObjCProtocolDefinitionAST::accept0(ASTVisitor *visitor)
// visit ObjCProtocolDefinitionAST
for (SpecifierAST *it = attributes; it; it = it->next)
accept(it, visitor);
if (name)
accept(name, visitor);
if (protocol_refs)
accept(protocol_refs, visitor);
if (member_declarations)
......@@ -1277,14 +1282,53 @@ void ObjCEncodeExpressionAST::accept0(ASTVisitor *visitor)
visitor->endVisit(this);
}
void ObjCSelectorWithoutArgumentsAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void ObjCSelectorArgumentAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
}
visitor->endVisit(this);
}
void ObjCSelectorArgumentListAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
if (argument)
accept(argument, visitor);
}
visitor->endVisit(this);
}
void ObjCSelectorWithArgumentsAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
for (ObjCSelectorArgumentListAST *it = selector_arguments; it; it = it->next)
accept(it, visitor);
}
visitor->endVisit(this);
}
void ObjCSelectorExpressionAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
if (selector)
accept(selector, visitor);
}
visitor->endVisit(this);
}
void ObjCInstanceVariablesDeclarationAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
// visit ObjCInstanceVariablesDeclarationAST
if (instance_variables)
accept(instance_variables, visitor);
if (member_declarations)
accept(member_declarations, visitor);
// visit AST
}
visitor->endVisit(this);
......@@ -1299,7 +1343,7 @@ void ObjCVisibilityDeclarationAST::accept0(ASTVisitor *visitor)
visitor->endVisit(this);
}
void ObjcPropertyAttributeAST::accept0(ASTVisitor *visitor)
void ObjCPropertyAttributeAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
// visit ObjcPropertyAttributeAST
......@@ -1308,7 +1352,7 @@ void ObjcPropertyAttributeAST::accept0(ASTVisitor *visitor)
visitor->endVisit(this);
}
void ObjcPropertyAttributeListAST::accept0(ASTVisitor *visitor)
void ObjCPropertyAttributeListAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
// visit ObjcPropertyAttributeListAST
......@@ -1325,7 +1369,7 @@ void ObjCPropertyDeclarationAST::accept0(ASTVisitor *visitor)
// visit ObjCPropertyDeclarationAST:
for (SpecifierAST *it = attributes; it; it = it->next)
accept(it, visitor);
for (ObjcPropertyAttributeListAST *it = property_attributes; it; it = it->next)
for (ObjCPropertyAttributeListAST *it = property_attributes; it; it = it->next)
accept(it, visitor);
if (simple_declaration)
accept(simple_declaration, visitor);
......
......@@ -198,7 +198,7 @@ public:
// ObjC++
virtual bool visit(IdentifierListAST *) { return true; }
virtual bool visit(ObjCClassDeclarationAST *) { return true; }
virtual bool visit(ObjCClassInterfaceDeclarationAST *) { return true; }
virtual bool visit(ObjCClassInterfaceDefinitionAST *) { return true; }
virtual bool visit(ObjCCategoryInterfaceDeclarationAST *) { return true; }
virtual bool visit(ObjCProtocolDeclarationAST *) { return true; }
virtual bool visit(ObjCProtocolDefinitionAST *) { return true; }
......@@ -209,10 +209,15 @@ public:
virtual bool visit(ObjCProtocolExpressionAST *) { return true; }
virtual bool visit(ObjCTypeNameAST *) { return true; }
virtual bool visit(ObjCEncodeExpressionAST *) { return true; }
virtual bool visit(ObjCSelectorWithoutArgumentsAST *) { return true; }
virtual bool visit(ObjCSelectorArgumentAST *) { return true; }
virtual bool visit(ObjCSelectorArgumentListAST *) { return true; }
virtual bool visit(ObjCSelectorWithArgumentsAST *) { return true; }
virtual bool visit(ObjCSelectorExpressionAST *) { return true; }
virtual bool visit(ObjCInstanceVariablesDeclarationAST *) { return true; }
virtual bool visit(ObjCVisibilityDeclarationAST *) { return true; }
virtual bool visit(ObjcPropertyAttributeAST *) { return true; }
virtual bool visit(ObjcPropertyAttributeListAST *) { return true; }
virtual bool visit(ObjCPropertyAttributeAST *) { return true; }
virtual bool visit(ObjCPropertyAttributeListAST *) { return true; }
virtual bool visit(ObjCPropertyDeclarationAST *) { return true; }
virtual bool visit(ObjCMethodPrototypeAST *) { return true; }
virtual bool visit(ObjCMethodDeclarationAST *) { return true; }
......@@ -335,7 +340,7 @@ public:
// ObjC++
virtual void endVisit(IdentifierListAST *) { }
virtual void endVisit(ObjCClassDeclarationAST *) { }
virtual void endVisit(ObjCClassInterfaceDeclarationAST *) { }
virtual void endVisit(ObjCClassInterfaceDefinitionAST *) { }
virtual void endVisit(ObjCCategoryInterfaceDeclarationAST *) { }
virtual void endVisit(ObjCProtocolDeclarationAST *) { }
virtual void endVisit(ObjCProtocolDefinitionAST *) { }
......@@ -346,10 +351,15 @@ public:
virtual void endVisit(ObjCProtocolExpressionAST *) { }
virtual void endVisit(ObjCTypeNameAST *) { }
virtual void endVisit(ObjCEncodeExpressionAST *) { }
virtual void endVisit(ObjCSelectorWithoutArgumentsAST *) { }
virtual void endVisit(ObjCSelectorArgumentAST *) { }
virtual void endVisit(ObjCSelectorArgumentListAST *) { }
virtual void endVisit(ObjCSelectorWithArgumentsAST *) { }
virtual void endVisit(ObjCSelectorExpressionAST *) { }
virtual void endVisit(ObjCInstanceVariablesDeclarationAST *) { }
virtual void endVisit(ObjCVisibilityDeclarationAST *) { }
virtual void endVisit(ObjcPropertyAttributeAST *) { }
virtual void endVisit(ObjcPropertyAttributeListAST *) { }
virtual void endVisit(ObjCPropertyAttributeAST *) { }
virtual void endVisit(ObjCPropertyAttributeListAST *) { }
virtual void endVisit(ObjCPropertyDeclarationAST *) { }
virtual void endVisit(ObjCMethodPrototypeAST *) { }
virtual void endVisit(ObjCMethodDeclarationAST *) { }
......
......@@ -173,7 +173,7 @@ class IdentifierListAST;
class ObjCClassDeclarationAST;
class ObjCProtocolDeclarationAST;
class ObjCProtocolDefinitionAST;
class ObjCClassInterfaceDeclarationAST;
class ObjCClassInterfaceDefinitionAST;
class ObjCCategoryInterfaceDeclarationAST;
class ObjCProtocolRefsAST;
class ObjCMessageExpressionAST;
......@@ -182,11 +182,17 @@ class ObjCMessageArgumentAST;
class ObjCProtocolExpressionAST;
class ObjCTypeNameAST;
class ObjCEncodeExpressionAST;
class ObjCSelectorAST;
class ObjCSelectorWithoutArgumentsAST;
class ObjCSelectorArgumentAST;
class ObjCSelectorArgumentListAST;
class ObjCSelectorWithArgumentsAST;
class ObjCSelectorExpressionAST;
class ObjCInstanceVariablesDeclarationAST;
class ObjCVisibilityDeclarationAST;
class ObjCPropertyDeclarationAST;
class ObjcPropertyAttributeListAST;
class ObjcPropertyAttributeAST;
class ObjCPropertyAttributeListAST;
class ObjCPropertyAttributeAST;
class ObjCMethodPrototypeAST;
class ObjCMethodDeclarationAST;
class ObjCMethodDefinitionAST;
......
......@@ -133,6 +133,12 @@ class ForwardClassDeclaration;
class Token;
// Objective-C symbols
class ObjCClass;
class ObjCForwardClassDeclaration;
class ObjCProtocol;
class ObjCForwardProtocolDeclaration;
CPLUSPLUS_END_NAMESPACE
CPLUSPLUS_END_HEADER
......
......@@ -464,4 +464,146 @@ bool CheckDeclaration::visit(UsingDirectiveAST *ast)
return false;
}
bool CheckDeclaration::visit(ObjCProtocolDeclarationAST *ast)
{
const unsigned sourceLocation = ast->firstToken();
List<ObjCForwardProtocolDeclaration *> **symbolIter = &ast->symbols;
for (IdentifierListAST *it = ast->identifier_list; it; it = it->next) {
unsigned declarationLocation;
if (it->name)
declarationLocation = it->name->firstToken();
else
declarationLocation = sourceLocation;
Name *protocolName = semantic()->check(it->name, _scope);
ObjCForwardProtocolDeclaration *fwdProtocol = control()->newObjCForwardProtocolDeclaration(sourceLocation, protocolName)