Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
496ff15d
Commit
496ff15d
authored
Nov 10, 2009
by
Roberto Raggi
Browse files
Removed ObjCIdentifierListAST
Done with Erik Verbruggen
parent
8efb73f5
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/CheckUndefinedSymbols.cpp
View file @
496ff15d
...
...
@@ -498,8 +498,8 @@ bool CheckUndefinedSymbols::visit(ObjCClassDeclarationAST *ast)
bool
CheckUndefinedSymbols
::
visit
(
ObjCProtocolRefsAST
*
ast
)
{
for
(
IdentifierListAST
*
iter
=
ast
->
identifier_list
;
iter
;
iter
=
iter
->
next
)
{
if
(
NameAST
*
nameAST
=
iter
->
nam
e
)
{
for
(
ObjC
IdentifierListAST
*
iter
=
ast
->
identifier_list
;
iter
;
iter
=
iter
->
next
)
{
if
(
NameAST
*
nameAST
=
iter
->
valu
e
)
{
bool
resolvedProtocolName
=
false
;
if
(
Name
*
name
=
nameAST
->
name
)
{
...
...
src/shared/cplusplus/AST.cpp
View file @
496ff15d
...
...
@@ -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
->
nam
e
)
return
it
->
nam
e
->
lastToken
();
for
(
ObjC
IdentifierListAST
*
it
=
identifier_list
;
it
;
it
=
it
->
next
)
{
if
(
!
it
->
next
&&
it
->
valu
e
)
return
it
->
valu
e
->
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
->
nam
e
)
return
it
->
nam
e
->
lastToken
();
for
(
ObjC
IdentifierListAST
*
it
=
identifier_list
;
it
;
it
=
it
->
next
)
{
if
(
!
it
->
next
&&
it
->
valu
e
)
return
it
->
valu
e
->
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
->
nam
e
)
return
it
->
nam
e
->
lastToken
();
for
(
ObjC
IdentifierListAST
*
it
=
identifier_list
;
it
;
it
=
it
->
next
)
{
if
(
!
it
->
next
&&
it
->
valu
e
)
return
it
->
valu
e
->
lastToken
();
}
return
less_token
+
1
;
...
...
src/shared/cplusplus/AST.h
View file @
496ff15d
...
...
@@ -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
ObjC
IdentifierListAST
*
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
;
ObjC
IdentifierListAST
*
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
;
ObjC
IdentifierListAST
*
identifier_list
;
unsigned
semicolon_token
;
public:
// annotations
...
...
@@ -2201,7 +2183,7 @@ class CPLUSPLUS_EXPORT ObjCProtocolRefsAST: public AST
{
public:
unsigned
less_token
;
IdentifierListAST
*
identifier_list
;
ObjC
IdentifierListAST
*
identifier_list
;
unsigned
greater_token
;
public:
...
...
@@ -2621,7 +2603,7 @@ class CPLUSPLUS_EXPORT ObjCDynamicPropertiesDeclarationAST: public DeclarationAS
{
public:
unsigned
dynamic_token
;
IdentifierListAST
*
property_identifiers
;
ObjC
IdentifierListAST
*
property_identifiers
;
unsigned
semicolon_token
;
public:
...
...
src/shared/cplusplus/ASTVisit.cpp
View file @
496ff15d
...
...
@@ -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
(
ObjC
IdentifierListAST
*
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
(
ObjC
IdentifierListAST
*
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
(
ObjC
IdentifierListAST
*
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
(
ObjC
IdentifierListAST
*
it
=
property_identifiers
;
it
;
it
=
it
->
next
)
accept
(
it
,
visitor
);
}
visitor
->
endVisit
(
this
);
...
...
src/shared/cplusplus/ASTVisitor.h
View file @
496ff15d
...
...
@@ -192,7 +192,7 @@ public:
virtual
bool
visit
(
QtMethodAST
*
)
{
return
true
;
}
// ObjC++
virtual
bool
visit
(
IdentifierListAST
*
)
{
return
true
;
}
virtual
bool
visit
(
ObjC
IdentifierListAST
*
)
{
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
(
ObjC
IdentifierListAST
*
)
{
}
virtual
void
endVisit
(
ObjCClassDeclarationAST
*
)
{
}
virtual
void
endVisit
(
ObjCClassForwardDeclarationAST
*
)
{
}
virtual
void
endVisit
(
ObjCProtocolDeclarationAST
*
)
{
}
...
...
src/shared/cplusplus/ASTfwd.h
View file @
496ff15d
...
...
@@ -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
...
...
src/shared/cplusplus/CheckDeclaration.cpp
View file @
496ff15d
...
...
@@ -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
(
ObjC
IdentifierListAST
*
it
=
ast
->
identifier_list
;
it
;
it
=
it
->
next
)
{
unsigned
declarationLocation
;
if
(
it
->
nam
e
)
declarationLocation
=
it
->
nam
e
->
firstToken
();
if
(
it
->
valu
e
)
declarationLocation
=
it
->
valu
e
->
firstToken
();
else
declarationLocation
=
sourceLocation
;
Name
*
protocolName
=
semantic
()
->
check
(
it
->
nam
e
,
_scope
);
Name
*
protocolName
=
semantic
()
->
check
(
it
->
valu
e
,
_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
->
nam
e
;
for
(
ObjC
IdentifierListAST
*
iter
=
ast
->
protocol_refs
->
identifier_list
;
iter
;
iter
=
iter
->
next
)
{
NameAST
*
name
=
iter
->
valu
e
;
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
(
ObjC
IdentifierListAST
*
it
=
ast
->
identifier_list
;
it
;
it
=
it
->
next
)
{
unsigned
declarationLocation
;
if
(
it
->
nam
e
)
declarationLocation
=
it
->
nam
e
->
firstToken
();
if
(
it
->
valu
e
)
declarationLocation
=
it
->
valu
e
->
firstToken
();
else
declarationLocation
=
sourceLocation
;
Name
*
className
=
semantic
()
->
check
(
it
->
nam
e
,
_scope
);
Name
*
className
=
semantic
()
->
check
(
it
->
valu
e
,
_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
->
nam
e
;
for
(
ObjC
IdentifierListAST
*
iter
=
ast
->
protocol_refs
->
identifier_list
;
iter
;
iter
=
iter
->
next
)
{
NameAST
*
name
=
iter
->
valu
e
;
Name
*
protocolName
=
semantic
()
->
check
(
name
,
_scope
);
ObjCBaseProtocol
*
baseProtocol
=
control
()
->
newObjCBaseProtocol
(
name
->
firstToken
(),
protocolName
);
klass
->
addProtocol
(
baseProtocol
);
...
...
src/shared/cplusplus/Parser.cpp
View file @
496ff15d
...
...
@@ -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
)
ObjC
IdentifierListAST
;
SimpleNameAST
*
name
=
new
(
_pool
)
SimpleNameAST
;
name
->
identifier_token
=
identifier_token
;
ast
->
identifier_list
->
nam
e
=
name
;
IdentifierListAST
**
nextId
=
&
(
ast
->
identifier_list
->
next
);
ast
->
identifier_list
->
valu
e
=
name
;
ObjC
IdentifierListAST
**
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
)
ObjC
IdentifierListAST
;
name
=
new
(
_pool
)
SimpleNameAST
;
name
->
identifier_token
=
identifier_token
;
(
*
nextId
)
->
nam
e
=
name
;
(
*
nextId
)
->
valu
e
=
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
)
ObjC
IdentifierListAST
;
SimpleNameAST
*
name
=
new
(
_pool
)
SimpleNameAST
;
name
->
identifier_token
=
identifier_token
;
ast
->
identifier_list
->
nam
e
=
name
;
IdentifierListAST
**
nextId
=
&
(
ast
->
identifier_list
->
next
);
ast
->
identifier_list
->
valu
e
=
name
;
ObjC
IdentifierListAST
**
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
)
ObjC
IdentifierListAST
;
name
=
new
(
_pool
)
SimpleNameAST
;
name
->
identifier_token
=
identifier_token
;
(
*
nextId
)
->
nam
e
=
name
;
(
*
nextId
)
->
valu
e
=
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
)
ObjC
IdentifierListAST
;
SimpleNameAST
*
name
=
new
(
_pool
)
SimpleNameAST
;
match
(
T_IDENTIFIER
,
&
(
name
->
identifier_token
));
ast
->
property_identifiers
->
nam
e
=
name
;
ast
->
property_identifiers
->
valu
e
=
name
;
IdentifierListAST
*
last
=
ast
->
property_identifiers
;
ObjC
IdentifierListAST
*
last
=
ast
->
property_identifiers
;
while
(
LA
()
==
T_COMMA
)
{
consumeToken
();
// consume T_COMMA
last
->
next
=
new
(
_pool
)
IdentifierListAST
;
last
->
next
=
new
(
_pool
)
ObjC
IdentifierListAST
;
last
=
last
->
next
;
name
=
new
(
_pool
)
SimpleNameAST
;
match
(
T_IDENTIFIER
,
&
name
->
identifier_token
);
last
->
nam
e
=
name
;
last
->
valu
e
=
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
)
ObjC
IdentifierListAST
;
SimpleNameAST
*
name
=
new
(
_pool
)
SimpleNameAST
;
name
->
identifier_token
=
identifier_token
;
ast
->
identifier_list
->
nam
e
=
name
;
IdentifierListAST
**
nextId
=
&
(
ast
->
identifier_list
->
next
);
ast
->
identifier_list
->
valu
e
=
name
;
ObjC
IdentifierListAST
**
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
)
ObjC
IdentifierListAST
;
name
=
new
(
_pool
)
SimpleNameAST
;
name
->
identifier_token
=
identifier_token
;
(
*
nextId
)
->
nam
e
=
name
;
(
*
nextId
)
->
valu
e
=
name
;
nextId
=
&
((
*
nextId
)
->
next
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment