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
1dbdbbef
Commit
1dbdbbef
authored
Nov 10, 2009
by
Roberto Raggi
Browse files
Cleanup base base specifiers.
parent
86a8812b
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/CheckUndefinedSymbols.cpp
View file @
1dbdbbef
...
...
@@ -286,11 +286,6 @@ void CheckUndefinedSymbols::endVisit(TemplateDeclarationAST *)
bool
CheckUndefinedSymbols
::
visit
(
ClassSpecifierAST
*
ast
)
{
if
(
ast
->
base_clause
)
{
unsigned
line
,
col
;
getTokenStartPosition
(
ast
->
firstToken
(),
&
line
,
&
col
);
}
bool
hasQ_OBJECT_CHECK
=
false
;
if
(
ast
->
symbol
)
{
...
...
src/shared/cplusplus/AST.cpp
View file @
1dbdbbef
...
...
@@ -382,15 +382,13 @@ unsigned ClassSpecifierAST::lastToken() const
if
(
lbrace_token
)
return
lbrace_token
+
1
;
for
(
BaseSpecifierAST
*
it
=
base_clause
;
it
;
it
=
it
->
next
)
{
if
(
!
it
->
next
)
return
it
->
lastToken
();
}
else
if
(
base_clause_list
)
return
base_clause_list
->
lastToken
();
if
(
colon_token
)
else
if
(
colon_token
)
return
colon_token
+
1
;
if
(
name
)
else
if
(
name
)
return
name
->
lastToken
();
for
(
SpecifierAST
*
it
=
attributes
;
it
;
it
=
it
->
next
)
{
...
...
src/shared/cplusplus/AST.h
View file @
1dbdbbef
...
...
@@ -478,7 +478,6 @@ public:
unsigned
virtual_token
;
unsigned
access_specifier_token
;
NameAST
*
name
;
BaseSpecifierAST
*
next
;
public:
// annotations
BaseClass
*
symbol
;
...
...
@@ -571,7 +570,7 @@ public:
SpecifierAST
*
attributes
;
NameAST
*
name
;
unsigned
colon_token
;
BaseSpecifierAST
*
base_clause
;
BaseSpecifier
List
AST
*
base_clause
_list
;
unsigned
lbrace_token
;
DeclarationListAST
*
member_specifiers
;
unsigned
rbrace_token
;
...
...
src/shared/cplusplus/ASTVisit.cpp
View file @
1dbdbbef
...
...
@@ -163,8 +163,7 @@ void ClassSpecifierAST::accept0(ASTVisitor *visitor)
for
(
SpecifierAST
*
it
=
attributes
;
it
;
it
=
it
->
next
)
accept
(
it
,
visitor
);
accept
(
name
,
visitor
);
for
(
BaseSpecifierAST
*
it
=
base_clause
;
it
;
it
=
it
->
next
)
accept
(
it
,
visitor
);
accept
(
base_clause_list
,
visitor
);
for
(
DeclarationListAST
*
it
=
member_specifiers
;
it
;
it
=
it
->
next
)
accept
(
it
,
visitor
);
}
...
...
src/shared/cplusplus/ASTfwd.h
View file @
1dbdbbef
...
...
@@ -195,6 +195,8 @@ typedef List<ExpressionAST *> ExpressionListAST;
typedef
List
<
DeclarationAST
*>
DeclarationListAST
;
typedef
List
<
StatementAST
*>
StatementListAST
;
typedef
List
<
DeclaratorAST
*>
DeclaratorListAST
;
typedef
List
<
BaseSpecifierAST
*>
BaseSpecifierListAST
;
typedef
List
<
NameAST
*>
ObjCIdentifierListAST
;
typedef
List
<
ObjCMessageArgumentAST
*>
ObjCMessageArgumentListAST
;
typedef
List
<
ObjCSelectorArgumentAST
*>
ObjCSelectorArgumentListAST
;
...
...
src/shared/cplusplus/CheckSpecifier.cpp
View file @
1dbdbbef
...
...
@@ -328,7 +328,8 @@ bool CheckSpecifier::visit(ClassSpecifierAST *ast)
_scope
->
enterSymbol
(
klass
);
_fullySpecifiedType
.
setType
(
klass
);
for
(
BaseSpecifierAST
*
base
=
ast
->
base_clause
;
base
;
base
=
base
->
next
)
{
for
(
BaseSpecifierListAST
*
it
=
ast
->
base_clause_list
;
it
;
it
=
it
->
next
)
{
BaseSpecifierAST
*
base
=
it
->
value
;
Name
*
baseClassName
=
semantic
()
->
check
(
base
->
name
,
_scope
);
BaseClass
*
baseClass
=
control
()
->
newBaseClass
(
ast
->
firstToken
(),
baseClassName
);
base
->
symbol
=
baseClass
;
...
...
src/shared/cplusplus/Parser.cpp
View file @
1dbdbbef
...
...
@@ -1550,17 +1550,23 @@ bool Parser::parseClassSpecifier(SpecifierAST *&node)
unsigned
colon_token
=
0
;
if
(
LA
()
==
T_COLON
||
LA
()
==
T_LBRACE
)
{
BaseSpecifierAST
*
base_clause
=
0
;
BaseSpecifierListAST
*
base_clause_list
=
0
;
if
(
LA
()
==
T_COLON
)
{
colon_token
=
cursor
();
parseBaseClause
(
base_clause
);
parseBaseClause
(
base_clause_list
);
if
(
LA
()
!=
T_LBRACE
)
{
_translationUnit
->
error
(
cursor
(),
"expected `{' before `%s'"
,
tok
().
spell
());
unsigned
saved
=
cursor
();
const
unsigned
saved
=
cursor
();
for
(
int
n
=
0
;
n
<
3
&&
LA
()
!=
T_EOF_SYMBOL
;
++
n
,
consumeToken
())
{
if
(
LA
()
==
T_LBRACE
)
break
;
}
if
(
LA
()
!=
T_LBRACE
)
rewind
(
saved
);
}
...
...
@@ -1571,7 +1577,7 @@ bool Parser::parseClassSpecifier(SpecifierAST *&node)
ast
->
attributes
=
attributes
;
ast
->
name
=
name
;
ast
->
colon_token
=
colon_token
;
ast
->
base_clause
=
base_clause
;
ast
->
base_clause
_list
=
base_clause
_list
;
if
(
LA
()
==
T_LBRACE
)
ast
->
lbrace_token
=
consumeToken
();
...
...
@@ -1778,13 +1784,14 @@ bool Parser::parseInitDeclarator(DeclaratorAST *&node,
return
true
;
}
bool
Parser
::
parseBaseClause
(
BaseSpecifierAST
*&
node
)
bool
Parser
::
parseBaseClause
(
BaseSpecifier
List
AST
*&
node
)
{
DEBUG_THIS_RULE
();
if
(
LA
()
==
T_COLON
)
{
consumeToken
();
consumeToken
();
// ### remove me
BaseSpecifierAST
**
ast
=
&
node
;
BaseSpecifier
List
AST
**
ast
=
&
node
;
if
(
parseBaseSpecifier
(
*
ast
))
{
ast
=
&
(
*
ast
)
->
next
;
...
...
@@ -1895,7 +1902,7 @@ bool Parser::parseExpressionList(ExpressionListAST *&node)
return
false
;
}
bool
Parser
::
parseBaseSpecifier
(
BaseSpecifierAST
*&
node
)
bool
Parser
::
parseBaseSpecifier
(
BaseSpecifier
List
AST
*&
node
)
{
DEBUG_THIS_RULE
();
BaseSpecifierAST
*
ast
=
new
(
_pool
)
BaseSpecifierAST
;
...
...
@@ -1918,7 +1925,9 @@ bool Parser::parseBaseSpecifier(BaseSpecifierAST *&node)
parseName
(
ast
->
name
);
if
(
!
ast
->
name
)
_translationUnit
->
error
(
cursor
(),
"expected class-name"
);
node
=
ast
;
node
=
new
(
_pool
)
BaseSpecifierListAST
;
node
->
value
=
ast
;
return
true
;
}
...
...
src/shared/cplusplus/Parser.h
View file @
1dbdbbef
...
...
@@ -84,8 +84,8 @@ public:
bool
parseAsmOperand
();
bool
parseAsmClobberList
();
bool
parseAssignmentExpression
(
ExpressionAST
*&
node
);
bool
parseBaseClause
(
BaseSpecifierAST
*&
node
);
bool
parseBaseSpecifier
(
BaseSpecifierAST
*&
node
);
bool
parseBaseClause
(
BaseSpecifier
List
AST
*&
node
);
bool
parseBaseSpecifier
(
BaseSpecifier
List
AST
*&
node
);
bool
parseBlockDeclaration
(
DeclarationAST
*&
node
);
bool
parseCppCastExpression
(
ExpressionAST
*&
node
);
bool
parseCastExpression
(
ExpressionAST
*&
node
);
...
...
tests/auto/cplusplus/ast/tst_ast.cpp
View file @
1dbdbbef
...
...
@@ -121,9 +121,9 @@ void tst_AST::template_id_1()
QCOMPARE
(
ast
->
asTemplateId
()
->
identifier_token
,
1U
);
QCOMPARE
(
ast
->
asTemplateId
()
->
less_token
,
2U
);
QVERIFY
(
ast
->
asTemplateId
()
->
template_arguments
!=
0
);
QVERIFY
(
ast
->
asTemplateId
()
->
template_arguments
->
template_argument
!=
0
);
QVERIFY
(
ast
->
asTemplateId
()
->
template_arguments
->
template_argument
->
asNumericLiteral
()
!=
0
);
QCOMPARE
(
ast
->
asTemplateId
()
->
template_arguments
->
template_argument
->
asNumericLiteral
()
->
literal_token
,
3U
);
QVERIFY
(
ast
->
asTemplateId
()
->
template_arguments
->
value
!=
0
);
QVERIFY
(
ast
->
asTemplateId
()
->
template_arguments
->
value
->
asNumericLiteral
()
!=
0
);
QCOMPARE
(
ast
->
asTemplateId
()
->
template_arguments
->
value
->
asNumericLiteral
()
->
literal_token
,
3U
);
QVERIFY
(
ast
->
asTemplateId
()
->
template_arguments
->
next
==
0
);
QCOMPARE
(
ast
->
asTemplateId
()
->
greater_token
,
4U
);
}
...
...
@@ -471,7 +471,7 @@ void tst_AST::cpp_initializer_or_function_declaration()
QVERIFY
(
simple_named_ty
!=
0
);
QCOMPARE
(
simple_named_ty
->
identifier_token
,
1U
);
DeclaratorAST
*
declarator
=
simple_decl
->
declarators
->
declarator
;
DeclaratorAST
*
declarator
=
simple_decl
->
declarators
->
value
;
QVERIFY
(
declarator
!=
0
);
QVERIFY
(
declarator
->
core_declarator
!=
0
);
QVERIFY
(
declarator
->
postfix_declarators
!=
0
);
...
...
@@ -664,7 +664,7 @@ void tst_AST::objc_msg_send_expression()
{
// check the assignment
QVERIFY
(
simpleDecl
->
declarators
&&
!
simpleDecl
->
declarators
->
next
);
DeclaratorAST
*
declarator
=
simpleDecl
->
declarators
->
declarator
;
DeclaratorAST
*
declarator
=
simpleDecl
->
declarators
->
value
;
QVERIFY
(
declarator
);
QVERIFY
(
!
declarator
->
attributes
);
...
...
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