summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2009-11-10 12:39:29 +0100
committerRoberto Raggi <roberto.raggi@nokia.com>2009-11-10 16:20:10 +0100
commit496ff15db3fa6b2004899345eef58ce5253514a1 (patch)
treee6c50eebf1f9f52e1195c051c10096912e671ab9 /src/shared/cplusplus
parent8efb73f5d2a84d70aae134dcf45cac87c70fa76f (diff)
downloadqt-creator-496ff15db3fa6b2004899345eef58ce5253514a1.tar.gz
Removed ObjCIdentifierListAST
Done with Erik Verbruggen
Diffstat (limited to 'src/shared/cplusplus')
-rw-r--r--src/shared/cplusplus/AST.cpp38
-rw-r--r--src/shared/cplusplus/AST.h28
-rw-r--r--src/shared/cplusplus/ASTVisit.cpp16
-rw-r--r--src/shared/cplusplus/ASTVisitor.h4
-rw-r--r--src/shared/cplusplus/ASTfwd.h3
-rw-r--r--src/shared/cplusplus/CheckDeclaration.cpp24
-rw-r--r--src/shared/cplusplus/Parser.cpp40
7 files changed, 54 insertions, 99 deletions
diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp
index f47158ce40..4cefd9a012 100644
--- a/src/shared/cplusplus/AST.cpp
+++ b/src/shared/cplusplus/AST.cpp
@@ -1816,26 +1816,6 @@ unsigned WhileStatementAST::lastToken() const
}
// ObjC++
-unsigned IdentifierListAST::firstToken() const
-{
- if (name)
- return name->firstToken();
- // ### assert?
- return 0;
-}
-
-unsigned IdentifierListAST::lastToken() const
-{
- for (const IdentifierListAST *it = this; it; it = it->next) {
- if (! it->next && it->name) {
- return it->name->lastToken();
- }
- }
- // ### assert?
- return 0;
-}
-
-
unsigned ObjCClassForwardDeclarationAST::firstToken() const
{
if (attributes)
@@ -1848,9 +1828,9 @@ unsigned ObjCClassForwardDeclarationAST::lastToken() const
if (semicolon_token)
return semicolon_token + 1;
- for (IdentifierListAST *it = identifier_list; it; it = it->next) {
- if (! it->next && it->name)
- return it->name->lastToken();
+ for (ObjCIdentifierListAST *it = identifier_list; it; it = it->next) {
+ if (! it->next && it->value)
+ return it->value->lastToken();
}
return class_token + 1;
@@ -1868,9 +1848,9 @@ unsigned ObjCProtocolForwardDeclarationAST::lastToken() const
if (semicolon_token)
return semicolon_token + 1;
- for (IdentifierListAST *it = identifier_list; it; it = it->next) {
- if (! it->next && it->name)
- return it->name->lastToken();
+ for (ObjCIdentifierListAST *it = identifier_list; it; it = it->next) {
+ if (! it->next && it->value)
+ return it->value->lastToken();
}
return protocol_token + 1;
@@ -1949,9 +1929,9 @@ unsigned ObjCProtocolRefsAST::lastToken() const
{
if (greater_token) return greater_token + 1;
- for (IdentifierListAST *it = identifier_list; it; it = it->next) {
- if (! it->next && it->name)
- return it->name->lastToken();
+ for (ObjCIdentifierListAST *it = identifier_list; it; it = it->next) {
+ if (! it->next && it->value)
+ return it->value->lastToken();
}
return less_token + 1;
diff --git a/src/shared/cplusplus/AST.h b/src/shared/cplusplus/AST.h
index 10aa1a0c7b..084913fc91 100644
--- a/src/shared/cplusplus/AST.h
+++ b/src/shared/cplusplus/AST.h
@@ -164,7 +164,7 @@ public:
virtual FunctionDeclaratorAST *asFunctionDeclarator() { return 0; }
virtual FunctionDefinitionAST *asFunctionDefinition() { return 0; }
virtual GotoStatementAST *asGotoStatement() { return 0; }
- virtual IdentifierListAST *asIdentifierList() { return 0; }
+ virtual ObjCIdentifierListAST *asIdentifierList() { return 0; }
virtual IfStatementAST *asIfStatement() { return 0; }
virtual LabeledStatementAST *asLabeledStatement() { return 0; }
virtual LinkageBodyAST *asLinkageBody() { return 0; }
@@ -2084,30 +2084,12 @@ protected:
virtual void accept0(ASTVisitor *visitor);
};
-
-// ObjC++
-class CPLUSPLUS_EXPORT IdentifierListAST: public AST
-{
-public:
- NameAST *name;
- IdentifierListAST *next;
-
-public:
- virtual IdentifierListAST *asIdentifierList() { return this; }
-
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
-
-protected:
- virtual void accept0(ASTVisitor *visitor);
-};
-
class CPLUSPLUS_EXPORT ObjCClassForwardDeclarationAST: public DeclarationAST
{
public:
SpecifierAST *attributes;
unsigned class_token;
- IdentifierListAST *identifier_list;
+ ObjCIdentifierListAST *identifier_list;
unsigned semicolon_token;
public: // annotations
@@ -2158,7 +2140,7 @@ class CPLUSPLUS_EXPORT ObjCProtocolForwardDeclarationAST: public DeclarationAST
public:
SpecifierAST *attributes;
unsigned protocol_token;
- IdentifierListAST *identifier_list;
+ ObjCIdentifierListAST *identifier_list;
unsigned semicolon_token;
public: // annotations
@@ -2201,7 +2183,7 @@ class CPLUSPLUS_EXPORT ObjCProtocolRefsAST: public AST
{
public:
unsigned less_token;
- IdentifierListAST *identifier_list;
+ ObjCIdentifierListAST *identifier_list;
unsigned greater_token;
public:
@@ -2621,7 +2603,7 @@ class CPLUSPLUS_EXPORT ObjCDynamicPropertiesDeclarationAST: public DeclarationAS
{
public:
unsigned dynamic_token;
- IdentifierListAST *property_identifiers;
+ ObjCIdentifierListAST *property_identifiers;
unsigned semicolon_token;
public:
diff --git a/src/shared/cplusplus/ASTVisit.cpp b/src/shared/cplusplus/ASTVisit.cpp
index f6b0bfb9b8..8095946f0a 100644
--- a/src/shared/cplusplus/ASTVisit.cpp
+++ b/src/shared/cplusplus/ASTVisit.cpp
@@ -890,20 +890,12 @@ void WhileStatementAST::accept0(ASTVisitor *visitor)
visitor->endVisit(this);
}
-void IdentifierListAST::accept0(ASTVisitor *visitor)
-{
- if (visitor->visit(this)) {
- accept(name, visitor);
- }
- visitor->endVisit(this);
-}
-
void ObjCClassForwardDeclarationAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
for (SpecifierAST *it = attributes; it; it = it->next)
accept(it, visitor);
- for (IdentifierListAST *it = identifier_list; it; it = it->next)
+ for (ObjCIdentifierListAST *it = identifier_list; it; it = it->next)
accept(it, visitor);
}
visitor->endVisit(this);
@@ -930,7 +922,7 @@ void ObjCProtocolForwardDeclarationAST::accept0(ASTVisitor *visitor)
if (visitor->visit(this)) {
for (SpecifierAST *it = attributes; it; it = it->next)
accept(it, visitor);
- for (IdentifierListAST *it = identifier_list; it; it = it->next)
+ for (ObjCIdentifierListAST *it = identifier_list; it; it = it->next)
accept(it, visitor);
}
visitor->endVisit(this);
@@ -952,7 +944,7 @@ void ObjCProtocolDeclarationAST::accept0(ASTVisitor *visitor)
void ObjCProtocolRefsAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
- for (IdentifierListAST *it = identifier_list; it; it = it->next)
+ for (ObjCIdentifierListAST *it = identifier_list; it; it = it->next)
accept(it, visitor);
}
visitor->endVisit(this);
@@ -1158,7 +1150,7 @@ void ObjCSynthesizedPropertiesDeclarationAST::accept0(ASTVisitor *visitor)
void ObjCDynamicPropertiesDeclarationAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
- for (IdentifierListAST *it = property_identifiers; it; it = it->next)
+ for (ObjCIdentifierListAST *it = property_identifiers; it; it = it->next)
accept(it, visitor);
}
visitor->endVisit(this);
diff --git a/src/shared/cplusplus/ASTVisitor.h b/src/shared/cplusplus/ASTVisitor.h
index ed61ea2a14..fff0c9f7d5 100644
--- a/src/shared/cplusplus/ASTVisitor.h
+++ b/src/shared/cplusplus/ASTVisitor.h
@@ -192,7 +192,7 @@ public:
virtual bool visit(QtMethodAST *) { return true; }
// ObjC++
- virtual bool visit(IdentifierListAST *) { return true; }
+ virtual bool visit(ObjCIdentifierListAST *) { return true; }
virtual bool visit(ObjCClassDeclarationAST *) { return true; }
virtual bool visit(ObjCClassForwardDeclarationAST *) { return true; }
virtual bool visit(ObjCProtocolDeclarationAST *) { return true; }
@@ -323,7 +323,7 @@ public:
virtual void endVisit(QtMethodAST *) { }
// ObjC++
- virtual void endVisit(IdentifierListAST *) { }
+ virtual void endVisit(ObjCIdentifierListAST *) { }
virtual void endVisit(ObjCClassDeclarationAST *) { }
virtual void endVisit(ObjCClassForwardDeclarationAST *) { }
virtual void endVisit(ObjCProtocolDeclarationAST *) { }
diff --git a/src/shared/cplusplus/ASTfwd.h b/src/shared/cplusplus/ASTfwd.h
index 50ab749ee5..c562384bf9 100644
--- a/src/shared/cplusplus/ASTfwd.h
+++ b/src/shared/cplusplus/ASTfwd.h
@@ -104,7 +104,6 @@ class ForeachStatementAST;
class FunctionDeclaratorAST;
class FunctionDefinitionAST;
class GotoStatementAST;
-class IdentifierListAST;
class IfStatementAST;
class LabeledStatementAST;
class LinkageBodyAST;
@@ -201,6 +200,8 @@ typedef List<ExpressionAST *> ExpressionListAST;
typedef List<DeclarationAST *> DeclarationListAST;
typedef List<StatementAST *> StatementListAST;
typedef List<DeclaratorAST *> DeclaratorListAST;
+typedef List<NameAST *> ObjCIdentifierListAST;
+
typedef ExpressionListAST TemplateArgumentListAST;
} // end of namespace CPlusPlus
diff --git a/src/shared/cplusplus/CheckDeclaration.cpp b/src/shared/cplusplus/CheckDeclaration.cpp
index 7adcde83bc..6dc9c9a75b 100644
--- a/src/shared/cplusplus/CheckDeclaration.cpp
+++ b/src/shared/cplusplus/CheckDeclaration.cpp
@@ -501,14 +501,14 @@ bool CheckDeclaration::visit(ObjCProtocolForwardDeclarationAST *ast)
const unsigned sourceLocation = ast->firstToken();
List<ObjCForwardProtocolDeclaration *> **symbolIter = &ast->symbols;
- for (IdentifierListAST *it = ast->identifier_list; it; it = it->next) {
+ for (ObjCIdentifierListAST *it = ast->identifier_list; it; it = it->next) {
unsigned declarationLocation;
- if (it->name)
- declarationLocation = it->name->firstToken();
+ if (it->value)
+ declarationLocation = it->value->firstToken();
else
declarationLocation = sourceLocation;
- Name *protocolName = semantic()->check(it->name, _scope);
+ Name *protocolName = semantic()->check(it->value, _scope);
ObjCForwardProtocolDeclaration *fwdProtocol = control()->newObjCForwardProtocolDeclaration(sourceLocation, protocolName);
fwdProtocol->setStartOffset(tokenAt(ast->firstToken()).offset);
fwdProtocol->setEndOffset(tokenAt(ast->lastToken()).offset);
@@ -537,8 +537,8 @@ bool CheckDeclaration::visit(ObjCProtocolDeclarationAST *ast)
protocol->setEndOffset(tokenAt(ast->lastToken()).offset);
if (ast->protocol_refs && ast->protocol_refs->identifier_list) {
- for (IdentifierListAST *iter = ast->protocol_refs->identifier_list; iter; iter = iter->next) {
- NameAST* name = iter->name;
+ for (ObjCIdentifierListAST *iter = ast->protocol_refs->identifier_list; iter; iter = iter->next) {
+ NameAST* name = iter->value;
Name *protocolName = semantic()->check(name, _scope);
ObjCBaseProtocol *baseProtocol = control()->newObjCBaseProtocol(name->firstToken(), protocolName);
protocol->addProtocol(baseProtocol);
@@ -562,14 +562,14 @@ bool CheckDeclaration::visit(ObjCClassForwardDeclarationAST *ast)
const unsigned sourceLocation = ast->firstToken();
List<ObjCForwardClassDeclaration *> **symbolIter = &ast->symbols;
- for (IdentifierListAST *it = ast->identifier_list; it; it = it->next) {
+ for (ObjCIdentifierListAST *it = ast->identifier_list; it; it = it->next) {
unsigned declarationLocation;
- if (it->name)
- declarationLocation = it->name->firstToken();
+ if (it->value)
+ declarationLocation = it->value->firstToken();
else
declarationLocation = sourceLocation;
- Name *className = semantic()->check(it->name, _scope);
+ Name *className = semantic()->check(it->value, _scope);
ObjCForwardClassDeclaration *fwdClass = control()->newObjCForwardClassDeclaration(sourceLocation, className);
fwdClass->setStartOffset(tokenAt(ast->firstToken()).offset);
fwdClass->setEndOffset(tokenAt(ast->lastToken()).offset);
@@ -612,8 +612,8 @@ bool CheckDeclaration::visit(ObjCClassDeclarationAST *ast)
}
if (ast->protocol_refs && ast->protocol_refs->identifier_list) {
- for (IdentifierListAST *iter = ast->protocol_refs->identifier_list; iter; iter = iter->next) {
- NameAST* name = iter->name;
+ for (ObjCIdentifierListAST *iter = ast->protocol_refs->identifier_list; iter; iter = iter->next) {
+ NameAST* name = iter->value;
Name *protocolName = semantic()->check(name, _scope);
ObjCBaseProtocol *baseProtocol = control()->newObjCBaseProtocol(name->firstToken(), protocolName);
klass->addProtocol(baseProtocol);
diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp
index d52431e01c..8cfa100c6e 100644
--- a/src/shared/cplusplus/Parser.cpp
+++ b/src/shared/cplusplus/Parser.cpp
@@ -4297,20 +4297,20 @@ bool Parser::parseObjCClassForwardDeclaration(DeclarationAST *&node)
unsigned identifier_token = 0;
match(T_IDENTIFIER, &identifier_token);
- ast->identifier_list = new (_pool) IdentifierListAST;
+ ast->identifier_list = new (_pool) ObjCIdentifierListAST;
SimpleNameAST *name = new (_pool) SimpleNameAST;
name->identifier_token = identifier_token;
- ast->identifier_list->name = name;
- IdentifierListAST **nextId = &(ast->identifier_list->next);
+ ast->identifier_list->value = name;
+ ObjCIdentifierListAST **nextId = &(ast->identifier_list->next);
while (LA() == T_COMMA) {
consumeToken(); // consume T_COMMA
match(T_IDENTIFIER, &identifier_token);
- *nextId = new (_pool) IdentifierListAST;
+ *nextId = new (_pool) ObjCIdentifierListAST;
name = new (_pool) SimpleNameAST;
name->identifier_token = identifier_token;
- (*nextId)->name = name;
+ (*nextId)->value = name;
nextId = &((*nextId)->next);
}
@@ -4447,20 +4447,20 @@ bool Parser::parseObjCProtocol(DeclarationAST *&node,
ObjCProtocolForwardDeclarationAST *ast = new (_pool) ObjCProtocolForwardDeclarationAST;
ast->attributes = attributes;
ast->protocol_token = protocol_token;
- ast->identifier_list = new (_pool) IdentifierListAST;
+ ast->identifier_list = new (_pool) ObjCIdentifierListAST;
SimpleNameAST *name = new (_pool) SimpleNameAST;
name->identifier_token = identifier_token;
- ast->identifier_list->name = name;
- IdentifierListAST **nextId = &(ast->identifier_list->next);
+ ast->identifier_list->value = name;
+ ObjCIdentifierListAST **nextId = &(ast->identifier_list->next);
while (LA() == T_COMMA) {
consumeToken(); // consume T_COMMA
match(T_IDENTIFIER, &identifier_token);
- *nextId = new (_pool) IdentifierListAST;
+ *nextId = new (_pool) ObjCIdentifierListAST;
name = new (_pool) SimpleNameAST;
name->identifier_token = identifier_token;
- (*nextId)->name = name;
+ (*nextId)->value = name;
nextId = &((*nextId)->next);
}
@@ -4611,20 +4611,20 @@ bool Parser::parseObjCMethodDefinitionList(DeclarationListAST *&node)
case T_AT_DYNAMIC: {
ObjCDynamicPropertiesDeclarationAST *ast = new (_pool) ObjCDynamicPropertiesDeclarationAST;
ast->dynamic_token = consumeToken();
- ast->property_identifiers = new (_pool) IdentifierListAST;
+ ast->property_identifiers = new (_pool) ObjCIdentifierListAST;
SimpleNameAST *name = new (_pool) SimpleNameAST;
match(T_IDENTIFIER, &(name->identifier_token));
- ast->property_identifiers->name = name;
+ ast->property_identifiers->value = name;
- IdentifierListAST *last = ast->property_identifiers;
+ ObjCIdentifierListAST *last = ast->property_identifiers;
while (LA() == T_COMMA) {
consumeToken(); // consume T_COMMA
- last->next = new (_pool) IdentifierListAST;
+ last->next = new (_pool) ObjCIdentifierListAST;
last = last->next;
name = new (_pool) SimpleNameAST;
match(T_IDENTIFIER, &name->identifier_token);
- last->name = name;
+ last->value = name;
}
match(T_SEMICOLON, &(ast->semicolon_token));
@@ -4696,20 +4696,20 @@ bool Parser::parseObjCProtocolRefs(ObjCProtocolRefsAST *&node)
unsigned identifier_token = 0;
match(T_IDENTIFIER, &identifier_token);
- ast->identifier_list = new (_pool) IdentifierListAST;
+ ast->identifier_list = new (_pool) ObjCIdentifierListAST;
SimpleNameAST *name = new (_pool) SimpleNameAST;
name->identifier_token = identifier_token;
- ast->identifier_list->name = name;
- IdentifierListAST **nextId = &(ast->identifier_list->next);
+ ast->identifier_list->value = name;
+ ObjCIdentifierListAST **nextId = &(ast->identifier_list->next);
while (LA() == T_COMMA) {
consumeToken(); // consume T_COMMA
match(T_IDENTIFIER, &identifier_token);
- *nextId = new (_pool) IdentifierListAST;
+ *nextId = new (_pool) ObjCIdentifierListAST;
name = new (_pool) SimpleNameAST;
name->identifier_token = identifier_token;
- (*nextId)->name = name;
+ (*nextId)->value = name;
nextId = &((*nextId)->next);
}