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
36a0ea2b
Commit
36a0ea2b
authored
Nov 10, 2009
by
Roberto Raggi
Browse files
Removed DeclarationListAST node.
Done with Erik Verbruggen
parent
4089c906
Changes
13
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/CheckUndefinedSymbols.cpp
View file @
36a0ea2b
...
...
@@ -104,7 +104,7 @@ bool CheckUndefinedSymbols::isType(const QByteArray &name) const
TemplateDeclarationAST
*
templateDeclaration
=
_templateDeclarationStack
.
at
(
i
);
for
(
DeclarationListAST
*
it
=
templateDeclaration
->
template_parameters
;
it
;
it
=
it
->
next
)
{
DeclarationAST
*
templateParameter
=
it
->
declaration
;
DeclarationAST
*
templateParameter
=
it
->
value
;
if
(
templateParameterName
(
templateParameter
)
==
name
)
return
true
;
...
...
src/libs/cplusplus/CppDocument.cpp
View file @
36a0ea2b
...
...
@@ -414,7 +414,7 @@ void Document::check(CheckMode mode)
if
(
TranslationUnitAST
*
ast
=
_translationUnit
->
ast
()
->
asTranslationUnit
())
{
for
(
DeclarationListAST
*
decl
=
ast
->
declarations
;
decl
;
decl
=
decl
->
next
)
{
semantic
.
check
(
decl
->
declaration
,
globals
);
semantic
.
check
(
decl
->
value
,
globals
);
}
}
else
if
(
ExpressionAST
*
ast
=
_translationUnit
->
ast
()
->
asExpression
())
{
semantic
.
check
(
ast
,
globals
);
...
...
src/shared/cplusplus/AST.cpp
View file @
36a0ea2b
...
...
@@ -552,21 +552,6 @@ unsigned CtorInitializerAST::lastToken() const
return
colon_token
+
1
;
}
unsigned
DeclarationListAST
::
firstToken
()
const
{
return
declaration
->
firstToken
();
}
unsigned
DeclarationListAST
::
lastToken
()
const
{
for
(
const
DeclarationListAST
*
it
=
this
;
it
;
it
=
it
->
next
)
{
if
(
!
it
->
next
)
return
it
->
declaration
->
lastToken
();
}
return
0
;
}
unsigned
DeclaratorAST
::
firstToken
()
const
{
if
(
attributes
)
...
...
@@ -1642,7 +1627,7 @@ unsigned TemplateTypeParameterAST::lastToken() const
for
(
DeclarationListAST
*
it
=
template_parameters
;
it
;
it
=
it
->
next
)
{
if
(
!
it
->
next
)
return
it
->
declaration
->
lastToken
();
return
it
->
value
->
lastToken
();
}
if
(
less_token
)
...
...
src/shared/cplusplus/AST.h
View file @
36a0ea2b
...
...
@@ -362,22 +362,6 @@ public:
virtual
DeclarationAST
*
asDeclaration
()
{
return
this
;
}
};
class
CPLUSPLUS_EXPORT
DeclarationListAST
:
public
AST
{
public:
DeclarationAST
*
declaration
;
DeclarationListAST
*
next
;
public:
virtual
DeclarationListAST
*
asDeclarationList
()
{
return
this
;
}
virtual
unsigned
firstToken
()
const
;
virtual
unsigned
lastToken
()
const
;
protected:
virtual
void
accept0
(
ASTVisitor
*
visitor
);
};
class
CPLUSPLUS_EXPORT
CoreDeclaratorAST
:
public
AST
{
public:
...
...
src/shared/cplusplus/ASTVisit.cpp
View file @
36a0ea2b
...
...
@@ -65,14 +65,6 @@ void TypeofSpecifierAST::accept0(ASTVisitor *visitor)
visitor
->
endVisit
(
this
);
}
void
DeclarationListAST
::
accept0
(
ASTVisitor
*
visitor
)
{
if
(
visitor
->
visit
(
this
))
{
accept
(
declaration
,
visitor
);
}
visitor
->
endVisit
(
this
);
}
void
DeclaratorAST
::
accept0
(
ASTVisitor
*
visitor
)
{
if
(
visitor
->
visit
(
this
))
{
...
...
src/shared/cplusplus/ASTVisitor.h
View file @
36a0ea2b
...
...
@@ -228,9 +228,6 @@ public:
virtual
bool
visit
(
ObjCFastEnumerationAST
*
)
{
return
true
;
}
virtual
bool
visit
(
ObjCSynchronizedStatementAST
*
)
{
return
true
;
}
virtual
bool
visit
(
DeclarationListAST
*
)
{
return
true
;
}
virtual
void
endVisit
(
DeclarationListAST
*
)
{
}
virtual
void
endVisit
(
AccessDeclarationAST
*
)
{
}
virtual
void
endVisit
(
ArrayAccessAST
*
)
{
}
virtual
void
endVisit
(
ArrayDeclaratorAST
*
)
{
}
...
...
src/shared/cplusplus/ASTfwd.h
View file @
36a0ea2b
...
...
@@ -84,7 +84,6 @@ class CoreDeclaratorAST;
class
CppCastExpressionAST
;
class
CtorInitializerAST
;
class
DeclarationAST
;
class
DeclarationListAST
;
class
DeclarationStatementAST
;
class
DeclaratorAST
;
class
DeclaratorIdAST
;
...
...
@@ -202,7 +201,7 @@ class UsingDirectiveAST;
class
WhileStatementAST
;
typedef
List
<
ExpressionAST
*>
ExpressionListAST
;
typedef
List
<
DeclarationAST
*>
DeclarationListAST
;
}
// end of namespace CPlusPlus
...
...
src/shared/cplusplus/CheckDeclaration.cpp
View file @
36a0ea2b
...
...
@@ -363,7 +363,7 @@ bool CheckDeclaration::visit(MemInitializerAST *ast)
bool
CheckDeclaration
::
visit
(
LinkageBodyAST
*
ast
)
{
for
(
DeclarationListAST
*
decl
=
ast
->
declarations
;
decl
;
decl
=
decl
->
next
)
{
semantic
()
->
check
(
decl
->
declaration
,
_scope
);
semantic
()
->
check
(
decl
->
value
,
_scope
);
}
return
false
;
}
...
...
@@ -428,7 +428,7 @@ bool CheckDeclaration::visit(TemplateDeclarationAST *ast)
Scope
*
scope
=
new
Scope
(
_scope
->
owner
());
for
(
DeclarationListAST
*
param
=
ast
->
template_parameters
;
param
;
param
=
param
->
next
)
{
semantic
()
->
check
(
param
->
declaration
,
scope
);
semantic
()
->
check
(
param
->
value
,
scope
);
}
semantic
()
->
check
(
ast
->
declaration
,
_scope
,
...
...
@@ -547,7 +547,7 @@ bool CheckDeclaration::visit(ObjCProtocolDeclarationAST *ast)
int
previousObjCVisibility
=
semantic
()
->
switchObjCVisibility
(
Function
::
Public
);
for
(
DeclarationListAST
*
it
=
ast
->
member_declarations
;
it
;
it
=
it
->
next
)
{
semantic
()
->
check
(
it
->
declaration
,
protocol
->
members
());
semantic
()
->
check
(
it
->
value
,
protocol
->
members
());
}
(
void
)
semantic
()
->
switchObjCVisibility
(
previousObjCVisibility
);
...
...
@@ -626,14 +626,14 @@ bool CheckDeclaration::visit(ObjCClassDeclarationAST *ast)
if
(
ast
->
inst_vars_decl
)
{
for
(
DeclarationListAST
*
it
=
ast
->
inst_vars_decl
->
instance_variables
;
it
;
it
=
it
->
next
)
{
semantic
()
->
check
(
it
->
declaration
,
klass
->
members
());
semantic
()
->
check
(
it
->
value
,
klass
->
members
());
}
}
(
void
)
semantic
()
->
switchObjCVisibility
(
Function
::
Public
);
for
(
DeclarationListAST
*
it
=
ast
->
member_declarations
;
it
;
it
=
it
->
next
)
{
semantic
()
->
check
(
it
->
declaration
,
klass
->
members
());
semantic
()
->
check
(
it
->
value
,
klass
->
members
());
}
(
void
)
semantic
()
->
switchObjCVisibility
(
previousObjCVisibility
);
...
...
src/shared/cplusplus/CheckDeclarator.cpp
View file @
36a0ea2b
...
...
@@ -174,7 +174,7 @@ bool CheckDeclarator::visit(FunctionDeclaratorAST *ast)
if
(
ast
->
parameters
)
{
DeclarationListAST
*
parameter_declarations
=
ast
->
parameters
->
parameter_declarations
;
for
(
DeclarationListAST
*
decl
=
parameter_declarations
;
decl
;
decl
=
decl
->
next
)
{
semantic
()
->
check
(
decl
->
declaration
,
fun
->
arguments
());
semantic
()
->
check
(
decl
->
value
,
fun
->
arguments
());
}
if
(
ast
->
parameters
->
dot_dot_dot_token
)
...
...
src/shared/cplusplus/CheckSpecifier.cpp
View file @
36a0ea2b
...
...
@@ -347,7 +347,7 @@ bool CheckSpecifier::visit(ClassSpecifierAST *ast)
int
previousMethodKey
=
semantic
()
->
switchMethodKey
(
Function
::
NormalMethod
);
for
(
DeclarationListAST
*
member
=
ast
->
member_specifiers
;
member
;
member
=
member
->
next
)
{
semantic
()
->
check
(
member
->
declaration
,
klass
->
members
());
semantic
()
->
check
(
member
->
value
,
klass
->
members
());
}
(
void
)
semantic
()
->
switchMethodKey
(
previousMethodKey
);
...
...
src/shared/cplusplus/Parser.cpp
View file @
36a0ea2b
...
...
@@ -435,7 +435,7 @@ bool Parser::parseTranslationUnit(TranslationUnitAST *&node)
if
(
parseDeclaration
(
declaration
))
{
*
decl
=
new
(
_pool
)
DeclarationListAST
;
(
*
decl
)
->
declaration
=
declaration
;
(
*
decl
)
->
value
=
declaration
;
decl
=
&
(
*
decl
)
->
next
;
}
else
{
rewind
(
start_declaration
+
1
);
...
...
@@ -562,7 +562,7 @@ bool Parser::parseLinkageBody(DeclarationAST *&node)
DeclarationAST
*
declaration
=
0
;
if
(
parseDeclaration
(
declaration
))
{
*
declaration_ptr
=
new
(
_pool
)
DeclarationListAST
;
(
*
declaration_ptr
)
->
declaration
=
declaration
;
(
*
declaration_ptr
)
->
value
=
declaration
;
declaration_ptr
=
&
(
*
declaration_ptr
)
->
next
;
}
else
{
rewind
(
start_declaration
+
1
);
...
...
@@ -1340,7 +1340,7 @@ bool Parser::parseTemplateParameterList(DeclarationListAST *&node)
DeclarationAST
*
declaration
=
0
;
if
(
parseTemplateParameter
(
declaration
))
{
*
template_parameter_ptr
=
new
(
_pool
)
DeclarationListAST
;
(
*
template_parameter_ptr
)
->
declaration
=
declaration
;
(
*
template_parameter_ptr
)
->
value
=
declaration
;
template_parameter_ptr
=
&
(
*
template_parameter_ptr
)
->
next
;
while
(
LA
()
==
T_COMMA
)
{
...
...
@@ -1349,7 +1349,7 @@ bool Parser::parseTemplateParameterList(DeclarationListAST *&node)
declaration
=
0
;
if
(
parseTemplateParameter
(
declaration
))
{
*
template_parameter_ptr
=
new
(
_pool
)
DeclarationListAST
;
(
*
template_parameter_ptr
)
->
declaration
=
declaration
;
(
*
template_parameter_ptr
)
->
value
=
declaration
;
template_parameter_ptr
=
&
(
*
template_parameter_ptr
)
->
next
;
}
}
...
...
@@ -1480,7 +1480,7 @@ bool Parser::parseParameterDeclarationList(DeclarationListAST *&node)
DeclarationAST
*
declaration
=
0
;
if
(
parseParameterDeclaration
(
declaration
))
{
*
parameter_declaration_ptr
=
new
(
_pool
)
DeclarationListAST
;
(
*
parameter_declaration_ptr
)
->
declaration
=
declaration
;
(
*
parameter_declaration_ptr
)
->
value
=
declaration
;
parameter_declaration_ptr
=
&
(
*
parameter_declaration_ptr
)
->
next
;
while
(
LA
()
==
T_COMMA
)
{
consumeToken
();
...
...
@@ -1491,7 +1491,7 @@ bool Parser::parseParameterDeclarationList(DeclarationListAST *&node)
declaration
=
0
;
if
(
parseParameterDeclaration
(
declaration
))
{
*
parameter_declaration_ptr
=
new
(
_pool
)
DeclarationListAST
;
(
*
parameter_declaration_ptr
)
->
declaration
=
declaration
;
(
*
parameter_declaration_ptr
)
->
value
=
declaration
;
parameter_declaration_ptr
=
&
(
*
parameter_declaration_ptr
)
->
next
;
}
}
...
...
@@ -1587,7 +1587,7 @@ bool Parser::parseClassSpecifier(SpecifierAST *&node)
DeclarationAST
*
declaration
=
0
;
if
(
parseMemberSpecification
(
declaration
))
{
*
declaration_ptr
=
new
(
_pool
)
DeclarationListAST
;
(
*
declaration_ptr
)
->
declaration
=
declaration
;
(
*
declaration_ptr
)
->
value
=
declaration
;
declaration_ptr
=
&
(
*
declaration_ptr
)
->
next
;
}
else
{
rewind
(
start_declaration
+
1
);
...
...
@@ -4380,7 +4380,7 @@ bool Parser::parseObjCInterface(DeclarationAST *&node,
DeclarationAST
*
declaration
=
0
;
while
(
parseObjCInterfaceMemberDeclaration
(
declaration
))
{
*
nextMembers
=
new
(
_pool
)
DeclarationListAST
;
(
*
nextMembers
)
->
declaration
=
declaration
;
(
*
nextMembers
)
->
value
=
declaration
;
nextMembers
=
&
((
*
nextMembers
)
->
next
);
}
...
...
@@ -4411,7 +4411,7 @@ bool Parser::parseObjCInterface(DeclarationAST *&node,
DeclarationAST
*
declaration
=
0
;
while
(
parseObjCInterfaceMemberDeclaration
(
declaration
))
{
*
nextMembers
=
new
(
_pool
)
DeclarationListAST
;
(
*
nextMembers
)
->
declaration
=
declaration
;
(
*
nextMembers
)
->
value
=
declaration
;
nextMembers
=
&
((
*
nextMembers
)
->
next
);
}
...
...
@@ -4482,7 +4482,7 @@ bool Parser::parseObjCProtocol(DeclarationAST *&node,
DeclarationAST
*
declaration
=
0
;
while
(
parseObjCInterfaceMemberDeclaration
(
declaration
))
{
*
nextMembers
=
new
(
_pool
)
DeclarationListAST
;
(
*
nextMembers
)
->
declaration
=
declaration
;
(
*
nextMembers
)
->
value
=
declaration
;
nextMembers
=
&
((
*
nextMembers
)
->
next
);
}
...
...
@@ -4650,7 +4650,7 @@ bool Parser::parseObjCMethodDefinitionList(DeclarationListAST *&node)
if
(
declaration
)
{
*
next
=
new
(
_pool
)
DeclarationListAST
;
(
*
next
)
->
declaration
=
declaration
;
(
*
next
)
->
value
=
declaration
;
next
=
&
((
*
next
)
->
next
);
}
}
...
...
@@ -4738,7 +4738,7 @@ bool Parser::parseObjClassInstanceVariables(ObjCInstanceVariablesDeclarationAST
const
unsigned
start
=
cursor
();
*
next
=
new
(
_pool
)
DeclarationListAST
;
parseObjCInstanceVariableDeclaration
((
*
next
)
->
declaration
);
parseObjCInstanceVariableDeclaration
((
*
next
)
->
value
);
if
(
start
==
cursor
())
{
// skip stray token.
...
...
tests/auto/cplusplus/ast/tst_ast.cpp
View file @
36a0ea2b
...
...
@@ -497,12 +497,12 @@ void tst_AST::cpp_initializer_or_function_declaration()
QCOMPARE
(
param_clause
->
dot_dot_dot_token
,
0U
);
// check the parameter
DeclarationListAST
*
declarations
=
param_clause
->
parameter_declarations
->
asDeclarationList
()
;
DeclarationListAST
*
declarations
=
param_clause
->
parameter_declarations
;
QVERIFY
(
declarations
);
QVERIFY
(
declarations
->
declaration
);
QVERIFY
(
declarations
->
value
);
QVERIFY
(
!
declarations
->
next
);
ParameterDeclarationAST
*
param
=
declarations
->
declaration
->
asParameterDeclaration
();
ParameterDeclarationAST
*
param
=
declarations
->
value
->
asParameterDeclaration
();
QVERIFY
(
param
);
QVERIFY
(
param
->
type_specifier
!=
0
);
QVERIFY
(
param
->
type_specifier
->
next
==
0
);
...
...
tests/auto/cplusplus/semantic/tst_semantic.cpp
View file @
36a0ea2b
...
...
@@ -59,7 +59,7 @@ public:
TranslationUnitAST
*
ast
=
unit
->
ast
()
->
asTranslationUnit
();
QVERIFY
(
ast
);
for
(
DeclarationListAST
*
decl
=
ast
->
declarations
;
decl
;
decl
=
decl
->
next
)
{
sem
.
check
(
decl
->
declaration
,
globals
);
sem
.
check
(
decl
->
value
,
globals
);
}
}
...
...
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