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
73a4f297
Commit
73a4f297
authored
Nov 10, 2009
by
Roberto Raggi
Browse files
Cleanup MemInitializerAST
parent
1dbdbbef
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/shared/cplusplus/AST.cpp
View file @
73a4f297
...
...
@@ -527,10 +527,8 @@ unsigned CtorInitializerAST::firstToken() const
unsigned
CtorInitializerAST
::
lastToken
()
const
{
for
(
MemInitializerAST
*
it
=
member_initializers
;
it
;
it
=
it
->
next
)
{
if
(
!
it
->
next
)
return
it
->
lastToken
();
}
if
(
member_initializers
)
return
member_initializers
->
lastToken
();
return
colon_token
+
1
;
}
...
...
@@ -697,10 +695,8 @@ unsigned EnumSpecifierAST::lastToken() const
if
(
rbrace_token
)
return
rbrace_token
+
1
;
for
(
EnumeratorAST
*
it
=
enumerators
;
it
;
it
=
it
->
next
)
{
if
(
!
it
->
next
)
return
it
->
lastToken
();
}
if
(
enumerators
)
return
enumerators
->
lastToken
();
if
(
lbrace_token
)
return
lbrace_token
+
1
;
...
...
src/shared/cplusplus/AST.h
View file @
73a4f297
...
...
@@ -686,7 +686,7 @@ class CPLUSPLUS_EXPORT CtorInitializerAST: public AST
{
public:
unsigned
colon_token
;
MemInitializerAST
*
member_initializers
;
MemInitializer
List
AST
*
member_initializers
;
public:
virtual
CtorInitializerAST
*
asCtorInitializer
()
{
return
this
;
}
...
...
@@ -862,7 +862,7 @@ public:
unsigned
enum_token
;
NameAST
*
name
;
unsigned
lbrace_token
;
EnumeratorAST
*
enumerators
;
Enumerator
List
AST
*
enumerators
;
unsigned
rbrace_token
;
public:
...
...
@@ -881,7 +881,6 @@ public:
unsigned
identifier_token
;
unsigned
equal_token
;
ExpressionAST
*
expression
;
EnumeratorAST
*
next
;
public:
virtual
EnumeratorAST
*
asEnumerator
()
{
return
this
;
}
...
...
@@ -1134,7 +1133,6 @@ public:
unsigned
lparen_token
;
ExpressionAST
*
expression
;
unsigned
rparen_token
;
MemInitializerAST
*
next
;
public:
virtual
MemInitializerAST
*
asMemInitializer
()
{
return
this
;
}
...
...
src/shared/cplusplus/ASTVisit.cpp
View file @
73a4f297
...
...
@@ -220,8 +220,7 @@ void CppCastExpressionAST::accept0(ASTVisitor *visitor)
void
CtorInitializerAST
::
accept0
(
ASTVisitor
*
visitor
)
{
if
(
visitor
->
visit
(
this
))
{
for
(
MemInitializerAST
*
it
=
member_initializers
;
it
;
it
=
it
->
next
)
accept
(
it
,
visitor
);
accept
(
member_initializers
,
visitor
);
}
visitor
->
endVisit
(
this
);
}
...
...
@@ -307,8 +306,7 @@ void EnumSpecifierAST::accept0(ASTVisitor *visitor)
{
if
(
visitor
->
visit
(
this
))
{
accept
(
name
,
visitor
);
for
(
EnumeratorAST
*
it
=
enumerators
;
it
;
it
=
it
->
next
)
accept
(
it
,
visitor
);
accept
(
enumerators
,
visitor
);
}
visitor
->
endVisit
(
this
);
}
...
...
src/shared/cplusplus/ASTfwd.h
View file @
73a4f297
...
...
@@ -196,6 +196,8 @@ typedef List<DeclarationAST *> DeclarationListAST;
typedef
List
<
StatementAST
*>
StatementListAST
;
typedef
List
<
DeclaratorAST
*>
DeclaratorListAST
;
typedef
List
<
BaseSpecifierAST
*>
BaseSpecifierListAST
;
typedef
List
<
EnumeratorAST
*>
EnumeratorListAST
;
typedef
List
<
MemInitializerAST
*>
MemInitializerListAST
;
typedef
List
<
NameAST
*>
ObjCIdentifierListAST
;
typedef
List
<
ObjCMessageArgumentAST
*>
ObjCMessageArgumentListAST
;
...
...
src/shared/cplusplus/CheckSpecifier.cpp
View file @
73a4f297
...
...
@@ -387,8 +387,8 @@ bool CheckSpecifier::visit(EnumSpecifierAST *ast)
e
->
setVisibility
(
semantic
()
->
currentVisibility
());
_scope
->
enterSymbol
(
e
);
_fullySpecifiedType
.
setType
(
e
);
for
(
EnumeratorAST
*
enumerator
=
ast
->
enumerators
;
enumerator
;
e
numerator
=
enumerator
->
next
)
{
for
(
Enumerator
List
AST
*
it
=
ast
->
enumerators
;
it
;
it
=
it
->
next
)
{
E
numerator
AST
*
enumerator
=
it
->
value
;
Identifier
*
id
=
identifier
(
enumerator
->
identifier_token
);
if
(
!
id
)
continue
;
...
...
src/shared/cplusplus/Parser.cpp
View file @
73a4f297
...
...
@@ -1308,7 +1308,7 @@ bool Parser::parseEnumSpecifier(SpecifierAST *&node)
ast
->
name
=
name
;
ast
->
lbrace_token
=
consumeToken
();
unsigned
comma_token
=
0
;
EnumeratorAST
**
enumerator_ptr
=
&
ast
->
enumerators
;
Enumerator
List
AST
**
enumerator_ptr
=
&
ast
->
enumerators
;
while
(
int
tk
=
LA
())
{
if
(
tk
==
T_RBRACE
)
break
;
...
...
@@ -1722,7 +1722,7 @@ bool Parser::parseExceptionSpecification(ExceptionSpecificationAST *&node)
return
false
;
}
bool
Parser
::
parseEnumerator
(
EnumeratorAST
*&
node
)
bool
Parser
::
parseEnumerator
(
Enumerator
List
AST
*&
node
)
{
DEBUG_THIS_RULE
();
if
(
LA
()
==
T_IDENTIFIER
)
{
...
...
@@ -1733,7 +1733,9 @@ bool Parser::parseEnumerator(EnumeratorAST *&node)
ast
->
equal_token
=
consumeToken
();
parseConstantExpression
(
ast
->
expression
);
}
node
=
ast
;
node
=
new
(
_pool
)
EnumeratorListAST
;
node
->
value
=
ast
;
return
true
;
}
return
false
;
...
...
@@ -1820,10 +1822,10 @@ bool Parser::parseInitializer(ExpressionAST *&node, unsigned *equals_token)
return
false
;
}
bool
Parser
::
parseMemInitializerList
(
MemInitializerAST
*&
node
)
bool
Parser
::
parseMemInitializerList
(
MemInitializer
List
AST
*&
node
)
{
DEBUG_THIS_RULE
();
MemInitializerAST
**
initializer
=
&
node
;
MemInitializer
List
AST
**
initializer
=
&
node
;
if
(
parseMemInitializer
(
*
initializer
))
{
initializer
=
&
(
*
initializer
)
->
next
;
...
...
@@ -1838,7 +1840,7 @@ bool Parser::parseMemInitializerList(MemInitializerAST *&node)
return
false
;
}
bool
Parser
::
parseMemInitializer
(
MemInitializerAST
*&
node
)
bool
Parser
::
parseMemInitializer
(
MemInitializer
List
AST
*&
node
)
{
DEBUG_THIS_RULE
();
NameAST
*
name
=
0
;
...
...
@@ -1849,7 +1851,9 @@ bool Parser::parseMemInitializer(MemInitializerAST *&node)
parseExpression
(
ast
->
expression
);
if
(
LA
()
==
T_RPAREN
)
ast
->
rparen_token
=
consumeToken
();
node
=
ast
;
node
=
new
(
_pool
)
MemInitializerListAST
;
node
->
value
=
ast
;
return
true
;
}
return
false
;
...
...
src/shared/cplusplus/Parser.h
View file @
73a4f297
...
...
@@ -111,7 +111,7 @@ public:
bool
parseDoStatement
(
StatementAST
*&
node
);
bool
parseElaboratedTypeSpecifier
(
SpecifierAST
*&
node
);
bool
parseEnumSpecifier
(
SpecifierAST
*&
node
);
bool
parseEnumerator
(
EnumeratorAST
*&
node
);
bool
parseEnumerator
(
Enumerator
List
AST
*&
node
);
bool
parseEqualityExpression
(
ExpressionAST
*&
node
);
bool
parseExceptionDeclaration
(
ExceptionDeclarationAST
*&
node
);
bool
parseExceptionSpecification
(
ExceptionSpecificationAST
*&
node
);
...
...
@@ -134,8 +134,8 @@ public:
bool
parseLinkageSpecification
(
DeclarationAST
*&
node
);
bool
parseLogicalAndExpression
(
ExpressionAST
*&
node
);
bool
parseLogicalOrExpression
(
ExpressionAST
*&
node
);
bool
parseMemInitializer
(
MemInitializerAST
*&
node
);
bool
parseMemInitializerList
(
MemInitializerAST
*&
node
);
bool
parseMemInitializer
(
MemInitializer
List
AST
*&
node
);
bool
parseMemInitializerList
(
MemInitializer
List
AST
*&
node
);
bool
parseMemberSpecification
(
DeclarationAST
*&
node
);
bool
parseMultiplicativeExpression
(
ExpressionAST
*&
node
);
bool
parseTemplateId
(
NameAST
*&
node
);
...
...
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