Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flatpak-qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
0ae2d96a
Commit
0ae2d96a
authored
Nov 10, 2009
by
Roberto Raggi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the AST field names.
parent
e5eb88a3
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
455 additions
and
455 deletions
+455
-455
src/libs/cplusplus/CheckUndefinedSymbols.cpp
src/libs/cplusplus/CheckUndefinedSymbols.cpp
+6
-6
src/libs/cplusplus/CppDocument.cpp
src/libs/cplusplus/CppDocument.cpp
+1
-1
src/libs/cplusplus/FindUsages.cpp
src/libs/cplusplus/FindUsages.cpp
+10
-10
src/libs/cplusplus/ResolveExpression.cpp
src/libs/cplusplus/ResolveExpression.cpp
+3
-3
src/plugins/cppeditor/cppeditor.cpp
src/plugins/cppeditor/cppeditor.cpp
+6
-6
src/plugins/cpptools/cppcodecompletion.cpp
src/plugins/cpptools/cppcodecompletion.cpp
+2
-2
src/shared/cplusplus/AST.cpp
src/shared/cplusplus/AST.cpp
+133
-133
src/shared/cplusplus/AST.h
src/shared/cplusplus/AST.h
+54
-54
src/shared/cplusplus/ASTVisit.cpp
src/shared/cplusplus/ASTVisit.cpp
+54
-54
src/shared/cplusplus/CheckDeclaration.cpp
src/shared/cplusplus/CheckDeclaration.cpp
+14
-14
src/shared/cplusplus/CheckDeclarator.cpp
src/shared/cplusplus/CheckDeclarator.cpp
+8
-8
src/shared/cplusplus/CheckExpression.cpp
src/shared/cplusplus/CheckExpression.cpp
+6
-6
src/shared/cplusplus/CheckName.cpp
src/shared/cplusplus/CheckName.cpp
+5
-5
src/shared/cplusplus/CheckSpecifier.cpp
src/shared/cplusplus/CheckSpecifier.cpp
+2
-2
src/shared/cplusplus/CheckStatement.cpp
src/shared/cplusplus/CheckStatement.cpp
+5
-5
src/shared/cplusplus/Parser.cpp
src/shared/cplusplus/Parser.cpp
+93
-93
tests/auto/cplusplus/ast/tst_ast.cpp
tests/auto/cplusplus/ast/tst_ast.cpp
+52
-52
tests/auto/cplusplus/semantic/tst_semantic.cpp
tests/auto/cplusplus/semantic/tst_semantic.cpp
+1
-1
No files found.
src/libs/cplusplus/CheckUndefinedSymbols.cpp
View file @
0ae2d96a
...
...
@@ -103,7 +103,7 @@ bool CheckUndefinedSymbols::isType(const QByteArray &name) const
for
(
int
i
=
_templateDeclarationStack
.
size
()
-
1
;
i
!=
-
1
;
--
i
)
{
TemplateDeclarationAST
*
templateDeclaration
=
_templateDeclarationStack
.
at
(
i
);
for
(
DeclarationListAST
*
it
=
templateDeclaration
->
template_parameter
s
;
it
;
it
=
it
->
next
)
{
for
(
DeclarationListAST
*
it
=
templateDeclaration
->
template_parameter
_list
;
it
;
it
=
it
->
next
)
{
DeclarationAST
*
templateParameter
=
it
->
value
;
if
(
templateParameterName
(
templateParameter
)
==
name
)
...
...
@@ -424,7 +424,7 @@ bool CheckUndefinedSymbols::visit(CastExpressionAST *ast)
{
if
(
ast
->
lparen_token
&&
ast
->
type_id
&&
ast
->
rparen_token
&&
ast
->
expression
)
{
if
(
TypeIdAST
*
cast_type_id
=
ast
->
type_id
->
asTypeId
())
{
SpecifierListAST
*
type_specifier
=
cast_type_id
->
type_specifier
;
SpecifierListAST
*
type_specifier
=
cast_type_id
->
type_specifier
_list
;
if
(
!
cast_type_id
->
declarator
&&
type_specifier
&&
!
type_specifier
->
next
&&
type_specifier
->
value
->
asNamedTypeSpecifier
()
&&
ast
->
expression
&&
ast
->
expression
->
asUnaryExpression
())
{
...
...
@@ -447,7 +447,7 @@ bool CheckUndefinedSymbols::visit(SizeofExpressionAST *ast)
{
if
(
ast
->
lparen_token
&&
ast
->
expression
&&
ast
->
rparen_token
)
{
if
(
TypeIdAST
*
type_id
=
ast
->
expression
->
asTypeId
())
{
SpecifierListAST
*
type_specifier
=
type_id
->
type_specifier
;
SpecifierListAST
*
type_specifier
=
type_id
->
type_specifier
_list
;
if
(
!
type_id
->
declarator
&&
type_specifier
&&
!
type_specifier
->
next
&&
type_specifier
->
value
->
asNamedTypeSpecifier
())
{
// this sizeof expression is ambiguos, e.g.
...
...
@@ -455,9 +455,9 @@ bool CheckUndefinedSymbols::visit(SizeofExpressionAST *ast)
// `a' can be a typeid or a nested-expression.
return
false
;
}
else
if
(
type_id
->
declarator
&&
type_id
->
declarator
->
postfix_declarator
s
&&
!
type_id
->
declarator
->
postfix_declarator
s
->
next
&&
type_id
->
declarator
->
postfix_declarator
s
->
value
->
asArrayDeclarator
()
!=
0
)
{
&&
type_id
->
declarator
->
postfix_declarator
_list
&&
!
type_id
->
declarator
->
postfix_declarator
_list
->
next
&&
type_id
->
declarator
->
postfix_declarator
_list
->
value
->
asArrayDeclarator
()
!=
0
)
{
// this sizeof expression is ambiguos, e.g.
// sizeof(a[10])
// `a' can be a typeid or an expression.
...
...
src/libs/cplusplus/CppDocument.cpp
View file @
0ae2d96a
...
...
@@ -413,7 +413,7 @@ void Document::check(CheckMode mode)
return
;
// nothing to do.
if
(
TranslationUnitAST
*
ast
=
_translationUnit
->
ast
()
->
asTranslationUnit
())
{
for
(
DeclarationListAST
*
decl
=
ast
->
declaration
s
;
decl
;
decl
=
decl
->
next
)
{
for
(
DeclarationListAST
*
decl
=
ast
->
declaration
_list
;
decl
;
decl
=
decl
->
next
)
{
semantic
.
check
(
decl
->
value
,
globals
);
}
}
else
if
(
ExpressionAST
*
ast
=
_translationUnit
->
ast
()
->
asExpression
())
{
...
...
src/libs/cplusplus/FindUsages.cpp
View file @
0ae2d96a
...
...
@@ -288,7 +288,7 @@ void FindUsages::checkExpression(unsigned startToken, unsigned endToken)
bool
FindUsages
::
visit
(
QualifiedNameAST
*
ast
)
{
for
(
NestedNameSpecifierListAST
*
it
=
ast
->
nested_name_specifier
;
it
;
it
=
it
->
next
)
{
for
(
NestedNameSpecifierListAST
*
it
=
ast
->
nested_name_specifier
_list
;
it
;
it
=
it
->
next
)
{
NestedNameSpecifierAST
*
nested_name_specifier
=
it
->
value
;
if
(
NameAST
*
class_or_namespace_name
=
nested_name_specifier
->
class_or_namespace_name
)
{
...
...
@@ -299,7 +299,7 @@ bool FindUsages::visit(QualifiedNameAST *ast)
template_id
=
class_or_namespace_name
->
asTemplateId
();
if
(
template_id
)
{
for
(
TemplateArgumentListAST
*
arg_it
=
template_id
->
template_argument
s
;
arg_it
;
arg_it
=
arg_it
->
next
)
{
for
(
TemplateArgumentListAST
*
arg_it
=
template_id
->
template_argument
_list
;
arg_it
;
arg_it
=
arg_it
->
next
)
{
accept
(
arg_it
->
value
);
}
}
...
...
@@ -332,7 +332,7 @@ bool FindUsages::visit(QualifiedNameAST *ast)
if
(
template_id
)
{
identifier_token
=
template_id
->
identifier_token
;
for
(
TemplateArgumentListAST
*
template_arguments
=
template_id
->
template_argument
s
;
for
(
TemplateArgumentListAST
*
template_arguments
=
template_id
->
template_argument
_list
;
template_arguments
;
template_arguments
=
template_arguments
->
next
)
{
accept
(
template_arguments
->
value
);
}
...
...
@@ -392,7 +392,7 @@ bool FindUsages::visit(TemplateIdAST *ast)
reportResult
(
ast
->
identifier_token
,
candidates
);
}
for
(
TemplateArgumentListAST
*
template_arguments
=
ast
->
template_argument
s
;
for
(
TemplateArgumentListAST
*
template_arguments
=
ast
->
template_argument
_list
;
template_arguments
;
template_arguments
=
template_arguments
->
next
)
{
accept
(
template_arguments
->
value
);
}
...
...
@@ -402,23 +402,23 @@ bool FindUsages::visit(TemplateIdAST *ast)
bool
FindUsages
::
visit
(
ParameterDeclarationAST
*
ast
)
{
for
(
SpecifierListAST
*
it
=
ast
->
type_specifier
;
it
;
it
=
it
->
next
)
for
(
SpecifierListAST
*
it
=
ast
->
type_specifier
_list
;
it
;
it
=
it
->
next
)
accept
(
it
->
value
);
if
(
DeclaratorAST
*
declarator
=
ast
->
declarator
)
{
for
(
SpecifierListAST
*
it
=
declarator
->
attribute
s
;
it
;
it
=
it
->
next
)
for
(
SpecifierListAST
*
it
=
declarator
->
attribute
_list
;
it
;
it
=
it
->
next
)
accept
(
it
->
value
);
for
(
PtrOperatorListAST
*
it
=
declarator
->
ptr_operator
s
;
it
;
it
=
it
->
next
)
for
(
PtrOperatorListAST
*
it
=
declarator
->
ptr_operator
_list
;
it
;
it
=
it
->
next
)
accept
(
it
->
value
);
if
(
!
_inSimpleDeclaration
)
// visit the core declarator only if we are not in simple-declaration.
accept
(
declarator
->
core_declarator
);
for
(
PostfixDeclaratorListAST
*
it
=
declarator
->
postfix_declarator
s
;
it
;
it
=
it
->
next
)
for
(
PostfixDeclaratorListAST
*
it
=
declarator
->
postfix_declarator
_list
;
it
;
it
=
it
->
next
)
accept
(
it
->
value
);
for
(
SpecifierListAST
*
it
=
declarator
->
post_attribute
s
;
it
;
it
=
it
->
next
)
for
(
SpecifierListAST
*
it
=
declarator
->
post_attribute
_list
;
it
;
it
=
it
->
next
)
accept
(
it
->
value
);
accept
(
declarator
->
initializer
);
...
...
@@ -438,7 +438,7 @@ bool FindUsages::visit(FunctionDeclaratorAST *ast)
{
accept
(
ast
->
parameters
);
for
(
SpecifierListAST
*
it
=
ast
->
cv_qualifier_
seq
;
it
;
it
=
it
->
next
)
for
(
SpecifierListAST
*
it
=
ast
->
cv_qualifier_
list
;
it
;
it
=
it
->
next
)
accept
(
it
->
value
);
accept
(
ast
->
exception_specification
);
...
...
src/libs/cplusplus/ResolveExpression.cpp
View file @
0ae2d96a
...
...
@@ -170,8 +170,8 @@ bool ResolveExpression::visit(NewExpressionAST *ast)
{
if
(
ast
->
new_type_id
)
{
Scope
*
scope
=
_context
.
expressionDocument
()
->
globalSymbols
();
FullySpecifiedType
ty
=
sem
.
check
(
ast
->
new_type_id
->
type_specifier
,
scope
);
ty
=
sem
.
check
(
ast
->
new_type_id
->
ptr_operator
s
,
ty
,
scope
);
FullySpecifiedType
ty
=
sem
.
check
(
ast
->
new_type_id
->
type_specifier
_list
,
scope
);
ty
=
sem
.
check
(
ast
->
new_type_id
->
ptr_operator
_list
,
ty
,
scope
);
FullySpecifiedType
ptrTy
(
control
()
->
pointerType
(
ty
));
addResult
(
ptrTy
);
}
...
...
@@ -208,7 +208,7 @@ bool ResolveExpression::visit(PostfixExpressionAST *ast)
{
accept
(
ast
->
base_expression
);
for
(
PostfixListAST
*
it
=
ast
->
postfix_expression
s
;
it
;
it
=
it
->
next
)
{
for
(
PostfixListAST
*
it
=
ast
->
postfix_expression
_list
;
it
;
it
=
it
->
next
)
{
accept
(
it
->
value
);
}
...
...
src/plugins/cppeditor/cppeditor.cpp
View file @
0ae2d96a
...
...
@@ -239,7 +239,7 @@ protected:
return
;
else
if
(
TemplateIdAST
*
template_id
=
name
->
asTemplateId
())
{
for
(
TemplateArgumentListAST
*
it
=
template_id
->
template_argument
s
;
it
;
it
=
it
->
next
)
{
for
(
TemplateArgumentListAST
*
it
=
template_id
->
template_argument
_list
;
it
;
it
=
it
->
next
)
{
accept
(
it
->
value
);
}
}
...
...
@@ -276,7 +276,7 @@ protected:
virtual
bool
visit
(
TemplateIdAST
*
ast
)
{
for
(
TemplateArgumentListAST
*
arg
=
ast
->
template_argument
s
;
arg
;
arg
=
arg
->
next
)
for
(
TemplateArgumentListAST
*
arg
=
ast
->
template_argument
_list
;
arg
;
arg
=
arg
->
next
)
accept
(
arg
->
value
);
unsigned
line
,
column
;
...
...
@@ -308,7 +308,7 @@ protected:
virtual
bool
visit
(
QualifiedNameAST
*
ast
)
{
for
(
NestedNameSpecifierListAST
*
it
=
ast
->
nested_name_specifier
;
it
;
it
=
it
->
next
)
for
(
NestedNameSpecifierListAST
*
it
=
ast
->
nested_name_specifier
_list
;
it
;
it
=
it
->
next
)
searchUsesInTemplateArguments
(
it
->
value
->
class_or_namespace_name
);
searchUsesInTemplateArguments
(
ast
->
unqualified_name
);
...
...
@@ -318,7 +318,7 @@ protected:
virtual
bool
visit
(
PostfixExpressionAST
*
ast
)
{
accept
(
ast
->
base_expression
);
for
(
PostfixListAST
*
it
=
ast
->
postfix_expression
s
;
it
;
it
=
it
->
next
)
{
for
(
PostfixListAST
*
it
=
ast
->
postfix_expression
_list
;
it
;
it
=
it
->
next
)
{
PostfixAST
*
fx
=
it
->
value
;
if
(
fx
->
asMemberAccess
()
!=
0
)
continue
;
// skip members
...
...
@@ -366,7 +366,7 @@ protected:
{
accept
(
ast
->
parameters
);
for
(
SpecifierListAST
*
it
=
ast
->
cv_qualifier_
seq
;
it
;
it
=
it
->
next
)
for
(
SpecifierListAST
*
it
=
ast
->
cv_qualifier_
list
;
it
;
it
=
it
->
next
)
accept
(
it
->
value
);
accept
(
ast
->
exception_specification
);
...
...
@@ -439,7 +439,7 @@ public:
if
(
ast
)
{
if
(
ast
->
declarator
)
{
_visitFunctionDeclarator
=
true
;
accept
(
ast
->
declarator
->
postfix_declarator
s
);
accept
(
ast
->
declarator
->
postfix_declarator
_list
);
}
_visitFunctionDeclarator
=
false
;
...
...
src/plugins/cpptools/cppcodecompletion.cpp
View file @
0ae2d96a
...
...
@@ -1072,8 +1072,8 @@ bool CppCodeCompletion::completeConstructorOrFunction(const QList<TypeOfExpressi
if
(
doc
->
parse
(
Document
::
ParseDeclaration
))
{
doc
->
check
();
if
(
SimpleDeclarationAST
*
sd
=
doc
->
translationUnit
()
->
ast
()
->
asSimpleDeclaration
())
{
if
(
sd
->
declarator
s
->
value
->
postfix_declarators
&&
sd
->
declarator
s
->
value
->
postfix_declarators
->
value
->
asFunctionDeclarator
())
{
if
(
sd
->
declarator
_list
&&
sd
->
declarator_list
->
value
->
postfix_declarator_list
&&
sd
->
declarator
_list
->
value
->
postfix_declarator_list
->
value
->
asFunctionDeclarator
())
{
autocompleteSignature
=
true
;
}
}
...
...
src/shared/cplusplus/AST.cpp
View file @
0ae2d96a
This diff is collapsed.
Click to expand it.
src/shared/cplusplus/AST.h
View file @
0ae2d96a
This diff is collapsed.
Click to expand it.
src/shared/cplusplus/ASTVisit.cpp
View file @
0ae2d96a
This diff is collapsed.
Click to expand it.
src/shared/cplusplus/CheckDeclaration.cpp
View file @
0ae2d96a
...
...
@@ -136,7 +136,7 @@ unsigned CheckDeclaration::locationOfDeclaratorId(DeclaratorAST *declarator) con
bool
CheckDeclaration
::
visit
(
SimpleDeclarationAST
*
ast
)
{
FullySpecifiedType
ty
=
semantic
()
->
check
(
ast
->
decl_specifier_
seq
,
_scope
);
FullySpecifiedType
ty
=
semantic
()
->
check
(
ast
->
decl_specifier_
list
,
_scope
);
FullySpecifiedType
qualTy
=
ty
.
qualifiedType
();
if
(
_templateParameters
&&
ty
)
{
...
...
@@ -145,8 +145,8 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
}
}
if
(
!
ast
->
declarator
s
&&
ast
->
decl_specifier_seq
&&
!
ast
->
decl_specifier_seq
->
next
)
{
if
(
ElaboratedTypeSpecifierAST
*
elab_type_spec
=
ast
->
decl_specifier_
seq
->
value
->
asElaboratedTypeSpecifier
())
{
if
(
!
ast
->
declarator
_list
&&
ast
->
decl_specifier_list
&&
!
ast
->
decl_specifier_list
->
next
)
{
if
(
ElaboratedTypeSpecifierAST
*
elab_type_spec
=
ast
->
decl_specifier_
list
->
value
->
asElaboratedTypeSpecifier
())
{
unsigned
sourceLocation
=
elab_type_spec
->
firstToken
();
...
...
@@ -171,7 +171,7 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
const
bool
isQ_SIGNAL
=
ast
->
qt_invokable_token
&&
tokenKind
(
ast
->
qt_invokable_token
)
==
T_Q_SIGNAL
;
List
<
Declaration
*>
**
decl_it
=
&
ast
->
symbols
;
for
(
DeclaratorListAST
*
it
=
ast
->
declarator
s
;
it
;
it
=
it
->
next
)
{
for
(
DeclaratorListAST
*
it
=
ast
->
declarator
_list
;
it
;
it
=
it
->
next
)
{
Name
*
name
=
0
;
FullySpecifiedType
declTy
=
semantic
()
->
check
(
it
->
value
,
qualTy
,
_scope
,
&
name
);
...
...
@@ -208,7 +208,7 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
symbol
->
setType
(
control
()
->
integerType
(
IntegerType
::
Int
));
symbol
->
setType
(
declTy
);
if
(
_templateParameters
&&
it
==
ast
->
declarator
s
&&
ty
&&
!
ty
->
isClassType
())
if
(
_templateParameters
&&
it
==
ast
->
declarator
_list
&&
ty
&&
!
ty
->
isClassType
())
symbol
->
setTemplateParameters
(
_templateParameters
);
symbol
->
setVisibility
(
semantic
()
->
currentVisibility
());
...
...
@@ -265,7 +265,7 @@ bool CheckDeclaration::visit(AsmDefinitionAST *)
bool
CheckDeclaration
::
visit
(
ExceptionDeclarationAST
*
ast
)
{
FullySpecifiedType
ty
=
semantic
()
->
check
(
ast
->
type_specifier
,
_scope
);
FullySpecifiedType
ty
=
semantic
()
->
check
(
ast
->
type_specifier
_list
,
_scope
);
FullySpecifiedType
qualTy
=
ty
.
qualifiedType
();
Name
*
name
=
0
;
...
...
@@ -291,7 +291,7 @@ bool CheckDeclaration::visit(ExceptionDeclarationAST *ast)
bool
CheckDeclaration
::
visit
(
FunctionDefinitionAST
*
ast
)
{
FullySpecifiedType
ty
=
semantic
()
->
check
(
ast
->
decl_specifier_
seq
,
_scope
);
FullySpecifiedType
ty
=
semantic
()
->
check
(
ast
->
decl_specifier_
list
,
_scope
);
FullySpecifiedType
qualTy
=
ty
.
qualifiedType
();
Name
*
name
=
0
;
FullySpecifiedType
funTy
=
semantic
()
->
check
(
ast
->
declarator
,
qualTy
,
...
...
@@ -362,7 +362,7 @@ bool CheckDeclaration::visit(MemInitializerAST *ast)
bool
CheckDeclaration
::
visit
(
LinkageBodyAST
*
ast
)
{
for
(
DeclarationListAST
*
decl
=
ast
->
declaration
s
;
decl
;
decl
=
decl
->
next
)
{
for
(
DeclarationListAST
*
decl
=
ast
->
declaration
_list
;
decl
;
decl
=
decl
->
next
)
{
semantic
()
->
check
(
decl
->
value
,
_scope
);
}
return
false
;
...
...
@@ -410,7 +410,7 @@ bool CheckDeclaration::visit(ParameterDeclarationAST *ast)
}
Name
*
argName
=
0
;
FullySpecifiedType
ty
=
semantic
()
->
check
(
ast
->
type_specifier
,
_scope
);
FullySpecifiedType
ty
=
semantic
()
->
check
(
ast
->
type_specifier
_list
,
_scope
);
FullySpecifiedType
argTy
=
semantic
()
->
check
(
ast
->
declarator
,
ty
.
qualifiedType
(),
_scope
,
&
argName
);
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
ast
->
expression
,
_scope
);
...
...
@@ -427,7 +427,7 @@ bool CheckDeclaration::visit(TemplateDeclarationAST *ast)
{
Scope
*
scope
=
new
Scope
(
_scope
->
owner
());
for
(
DeclarationListAST
*
param
=
ast
->
template_parameter
s
;
param
;
param
=
param
->
next
)
{
for
(
DeclarationListAST
*
param
=
ast
->
template_parameter
_list
;
param
;
param
=
param
->
next
)
{
semantic
()
->
check
(
param
->
value
,
scope
);
}
...
...
@@ -546,7 +546,7 @@ bool CheckDeclaration::visit(ObjCProtocolDeclarationAST *ast)
}
int
previousObjCVisibility
=
semantic
()
->
switchObjCVisibility
(
Function
::
Public
);
for
(
DeclarationListAST
*
it
=
ast
->
member_declaration
s
;
it
;
it
=
it
->
next
)
{
for
(
DeclarationListAST
*
it
=
ast
->
member_declaration
_list
;
it
;
it
=
it
->
next
)
{
semantic
()
->
check
(
it
->
value
,
protocol
->
members
());
}
(
void
)
semantic
()
->
switchObjCVisibility
(
previousObjCVisibility
);
...
...
@@ -625,14 +625,14 @@ bool CheckDeclaration::visit(ObjCClassDeclarationAST *ast)
int
previousObjCVisibility
=
semantic
()
->
switchObjCVisibility
(
Function
::
Protected
);
if
(
ast
->
inst_vars_decl
)
{
for
(
DeclarationListAST
*
it
=
ast
->
inst_vars_decl
->
instance_variable
s
;
it
;
it
=
it
->
next
)
{
for
(
DeclarationListAST
*
it
=
ast
->
inst_vars_decl
->
instance_variable
_list
;
it
;
it
=
it
->
next
)
{
semantic
()
->
check
(
it
->
value
,
klass
->
members
());
}
}
(
void
)
semantic
()
->
switchObjCVisibility
(
Function
::
Public
);
for
(
DeclarationListAST
*
it
=
ast
->
member_declaration
s
;
it
;
it
=
it
->
next
)
{
for
(
DeclarationListAST
*
it
=
ast
->
member_declaration
_list
;
it
;
it
=
it
->
next
)
{
semantic
()
->
check
(
it
->
value
,
klass
->
members
());
}
...
...
@@ -718,7 +718,7 @@ bool CheckDeclaration::visit(ObjCPropertyDeclarationAST *ast)
{
int
propAttrs
=
None
;
for
(
ObjCPropertyAttributeListAST
*
iter
=
ast
->
property_attribute
s
;
iter
;
iter
=
iter
->
next
)
{
for
(
ObjCPropertyAttributeListAST
*
iter
=
ast
->
property_attribute
_list
;
iter
;
iter
=
iter
->
next
)
{
ObjCPropertyAttributeAST
*
attrAst
=
iter
->
value
;
if
(
!
attrAst
)
continue
;
...
...
src/shared/cplusplus/CheckDeclarator.cpp
View file @
0ae2d96a
...
...
@@ -133,8 +133,8 @@ Name **CheckDeclarator::switchName(Name **name)
bool
CheckDeclarator
::
visit
(
DeclaratorAST
*
ast
)
{
accept
(
ast
->
ptr_operator
s
);
accept
(
ast
->
postfix_declarator
s
);
accept
(
ast
->
ptr_operator
_list
);
accept
(
ast
->
postfix_declarator
_list
);
accept
(
ast
->
core_declarator
);
if
(
ast
->
initializer
)
{
...
...
@@ -172,7 +172,7 @@ bool CheckDeclarator::visit(FunctionDeclaratorAST *ast)
fun
->
setVirtual
(
true
);
if
(
ast
->
parameters
)
{
DeclarationListAST
*
parameter_declarations
=
ast
->
parameters
->
parameter_declaration
s
;
DeclarationListAST
*
parameter_declarations
=
ast
->
parameters
->
parameter_declaration
_list
;
for
(
DeclarationListAST
*
decl
=
parameter_declarations
;
decl
;
decl
=
decl
->
next
)
{
semantic
()
->
check
(
decl
->
value
,
fun
->
arguments
());
}
...
...
@@ -196,7 +196,7 @@ bool CheckDeclarator::visit(FunctionDeclaratorAST *ast)
FullySpecifiedType
funTy
(
fun
);
_fullySpecifiedType
=
funTy
;
for
(
SpecifierListAST
*
it
=
ast
->
cv_qualifier_
seq
;
it
;
it
=
it
->
next
)
{
for
(
SpecifierListAST
*
it
=
ast
->
cv_qualifier_
list
;
it
;
it
=
it
->
next
)
{
SimpleSpecifierAST
*
cv
=
static_cast
<
SimpleSpecifierAST
*>
(
it
->
value
);
const
int
k
=
tokenKind
(
cv
->
specifier_token
);
if
(
k
==
T_CONST
)
...
...
@@ -219,11 +219,11 @@ bool CheckDeclarator::visit(ArrayDeclaratorAST *ast)
bool
CheckDeclarator
::
visit
(
PointerToMemberAST
*
ast
)
{
Name
*
memberName
=
semantic
()
->
check
(
ast
->
nested_name_specifier
,
_scope
);
Name
*
memberName
=
semantic
()
->
check
(
ast
->
nested_name_specifier
_list
,
_scope
);
PointerToMemberType
*
ptrTy
=
control
()
->
pointerToMemberType
(
memberName
,
_fullySpecifiedType
);
FullySpecifiedType
ty
(
ptrTy
);
_fullySpecifiedType
=
ty
;
applyCvQualifiers
(
ast
->
cv_qualifier_
seq
);
applyCvQualifiers
(
ast
->
cv_qualifier_
list
);
return
false
;
}
...
...
@@ -232,7 +232,7 @@ bool CheckDeclarator::visit(PointerAST *ast)
PointerType
*
ptrTy
=
control
()
->
pointerType
(
_fullySpecifiedType
);
FullySpecifiedType
ty
(
ptrTy
);
_fullySpecifiedType
=
ty
;
applyCvQualifiers
(
ast
->
cv_qualifier_
seq
);
applyCvQualifiers
(
ast
->
cv_qualifier_
list
);
return
false
;
}
...
...
@@ -261,7 +261,7 @@ bool CheckDeclarator::visit(ObjCMethodPrototypeAST *ast)
if
(
ast
->
selector
&&
ast
->
selector
->
asObjCSelectorWithArguments
())
{
// TODO: add arguments (EV)
for
(
ObjCMessageArgumentDeclarationListAST
*
it
=
ast
->
argument
s
;
it
;
it
=
it
->
next
)
{
for
(
ObjCMessageArgumentDeclarationListAST
*
it
=
ast
->
argument
_list
;
it
;
it
=
it
->
next
)
{
ObjCMessageArgumentDeclarationAST
*
argDecl
=
it
->
value
;
semantic
()
->
check
(
argDecl
,
method
->
arguments
());
...
...
src/shared/cplusplus/CheckExpression.cpp
View file @
0ae2d96a
...
...
@@ -119,7 +119,7 @@ bool CheckExpression::visit(CastExpressionAST *ast)
bool
CheckExpression
::
visit
(
ConditionAST
*
ast
)
{
FullySpecifiedType
typeSpecTy
=
semantic
()
->
check
(
ast
->
type_specifier
s
,
_scope
);
FullySpecifiedType
typeSpecTy
=
semantic
()
->
check
(
ast
->
type_specifier
_list
,
_scope
);
Name
*
name
=
0
;
FullySpecifiedType
declTy
=
semantic
()
->
check
(
ast
->
declarator
,
typeSpecTy
.
qualifiedType
(),
_scope
,
&
name
);
...
...
@@ -205,9 +205,9 @@ bool CheckExpression::visit(NewExpressionAST *ast)
FullySpecifiedType
typeIdTy
=
semantic
()
->
check
(
ast
->
type_id
,
_scope
);
if
(
ast
->
new_type_id
)
{
FullySpecifiedType
ty
=
semantic
()
->
check
(
ast
->
new_type_id
->
type_specifier
,
_scope
);
FullySpecifiedType
ty
=
semantic
()
->
check
(
ast
->
new_type_id
->
type_specifier
_list
,
_scope
);
for
(
NewArrayDeclaratorListAST
*
it
=
ast
->
new_type_id
->
new_array_declarator
s
;
it
;
it
=
it
->
next
)
{
for
(
NewArrayDeclaratorListAST
*
it
=
ast
->
new_type_id
->
new_array_declarator
_list
;
it
;
it
=
it
->
next
)
{
if
(
NewArrayDeclaratorAST
*
declarator
=
it
->
value
)
{
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
declarator
->
expression
,
_scope
);
}
...
...
@@ -241,7 +241,7 @@ bool CheckExpression::visit(TypenameCallExpressionAST *ast)
bool
CheckExpression
::
visit
(
TypeConstructorCallAST
*
ast
)
{
FullySpecifiedType
typeSpecTy
=
semantic
()
->
check
(
ast
->
type_specifier
,
_scope
);
FullySpecifiedType
typeSpecTy
=
semantic
()
->
check
(
ast
->
type_specifier
_list
,
_scope
);
for
(
ExpressionListAST
*
it
=
ast
->
expression_list
;
it
;
it
=
it
->
next
)
{
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
it
->
value
,
_scope
);
}
...
...
@@ -251,7 +251,7 @@ bool CheckExpression::visit(TypeConstructorCallAST *ast)
bool
CheckExpression
::
visit
(
PostfixExpressionAST
*
ast
)
{
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
ast
->
base_expression
,
_scope
);
for
(
PostfixListAST
*
it
=
ast
->
postfix_expression
s
;
it
;
it
=
it
->
next
)
{
for
(
PostfixListAST
*
it
=
ast
->
postfix_expression
_list
;
it
;
it
=
it
->
next
)
{
accept
(
it
->
value
);
// ### not exactly.
}
return
false
;
...
...
@@ -301,7 +301,7 @@ bool CheckExpression::visit(ThrowExpressionAST *ast)
bool
CheckExpression
::
visit
(
TypeIdAST
*
ast
)
{
FullySpecifiedType
typeSpecTy
=
semantic
()
->
check
(
ast
->
type_specifier
,
_scope
);
FullySpecifiedType
typeSpecTy
=
semantic
()
->
check
(
ast
->
type_specifier
_list
,
_scope
);
FullySpecifiedType
declTy
=
semantic
()
->
check
(
ast
->
declarator
,
typeSpecTy
.
qualifiedType
(),
_scope
);
_fullySpecifiedType
=
declTy
;
...
...
src/shared/cplusplus/CheckName.cpp
View file @
0ae2d96a
...
...
@@ -139,7 +139,7 @@ Scope *CheckName::switchScope(Scope *scope)
bool
CheckName
::
visit
(
QualifiedNameAST
*
ast
)
{
std
::
vector
<
Name
*>
names
;
for
(
NestedNameSpecifierListAST
*
it
=
ast
->
nested_name_specifier
;
it
;
it
=
it
->
next
)
{
for
(
NestedNameSpecifierListAST
*
it
=
ast
->
nested_name_specifier
_list
;
it
;
it
=
it
->
next
)
{
NestedNameSpecifierAST
*
nested_name_specifier
=
it
->
value
;
names
.
push_back
(
semantic
()
->
check
(
nested_name_specifier
->
class_or_namespace_name
,
_scope
));
}
...
...
@@ -335,8 +335,8 @@ bool CheckName::visit(OperatorFunctionIdAST *ast)
bool
CheckName
::
visit
(
ConversionFunctionIdAST
*
ast
)
{
FullySpecifiedType
ty
=
semantic
()
->
check
(
ast
->
type_specifier
,
_scope
);
ty
=
semantic
()
->
check
(
ast
->
ptr_operator
s
,
ty
,
_scope
);
FullySpecifiedType
ty
=
semantic
()
->
check
(
ast
->
type_specifier
_list
,
_scope
);
ty
=
semantic
()
->
check
(
ast
->
ptr_operator
_list
,
ty
,
_scope
);
_name
=
control
()
->
conversionNameId
(
ty
);
return
false
;
}
...
...
@@ -361,7 +361,7 @@ bool CheckName::visit(TemplateIdAST *ast)
{
Identifier
*
id
=
identifier
(
ast
->
identifier_token
);
std
::
vector
<
FullySpecifiedType
>
templateArguments
;
for
(
TemplateArgumentListAST
*
it
=
ast
->
template_argument
s
;
it
;
for
(
TemplateArgumentListAST
*
it
=
ast
->
template_argument
_list
;
it
;
it
=
it
->
next
)
{
ExpressionAST
*
arg
=
it
->
value
;
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
arg
,
_scope
);
...
...
@@ -390,7 +390,7 @@ bool CheckName::visit(ObjCSelectorWithoutArgumentsAST *ast)
bool
CheckName
::
visit
(
ObjCSelectorWithArgumentsAST
*
ast
)
{
std
::
vector
<
Name
*>
names
;
for
(
ObjCSelectorArgumentListAST
*
it
=
ast
->
selector_argument
s
;
it
;
it
=
it
->
next
)
{
for
(
ObjCSelectorArgumentListAST
*
it
=
ast
->
selector_argument
_list
;
it
;
it
=
it
->
next
)
{
Identifier
*
id
=
identifier
(
it
->
value
->
name_token
);
Name
*
name
=
control
()
->
nameId
(
id
);
...
...
src/shared/cplusplus/CheckSpecifier.cpp
View file @
0ae2d96a
...
...
@@ -347,7 +347,7 @@ bool CheckSpecifier::visit(ClassSpecifierAST *ast)
int
previousVisibility
=
semantic
()
->
switchVisibility
(
visibility
);
int
previousMethodKey
=
semantic
()
->
switchMethodKey
(
Function
::
NormalMethod
);
for
(
DeclarationListAST
*
member
=
ast
->
member_specifier
s
;
member
;
member
=
member
->
next
)
{
for
(
DeclarationListAST
*
member
=
ast
->
member_specifier
_list
;
member
;
member
=
member
->
next
)
{
semantic
()
->
check
(
member
->
value
,
klass
->
members
());
}
...
...
@@ -384,7 +384,7 @@ bool CheckSpecifier::visit(EnumSpecifierAST *ast)
e
->
setVisibility
(
semantic
()
->
currentVisibility
());
_scope
->
enterSymbol
(
e
);
_fullySpecifiedType
.
setType
(
e
);
for
(
EnumeratorListAST
*
it
=
ast
->
enumerator
s
;
it
;
it
=
it
->
next
)
{
for
(
EnumeratorListAST
*
it
=
ast
->
enumerator
_list
;
it
;
it
=
it
->
next
)
{
EnumeratorAST
*
enumerator
=
it
->
value
;
Identifier
*
id
=
identifier
(
enumerator
->
identifier_token
);
if
(
!
id
)
...
...
src/shared/cplusplus/CheckStatement.cpp
View file @
0ae2d96a
...
...
@@ -104,7 +104,7 @@ bool CheckStatement::visit(CompoundStatementAST *ast)
ast
->
symbol
=
block
;
_scope
->
enterSymbol
(
block
);
Scope
*
previousScope
=
switchScope
(
block
->
members
());
for
(
StatementListAST
*
it
=
ast
->
statement
s
;
it
;
it
=
it
->
next
)
{
for
(
StatementListAST
*
it
=
ast
->
statement
_list
;
it
;
it
=
it
->
next
)
{
semantic
()
->
check
(
it
->
value
,
_scope
);
}
(
void
)
switchScope
(
previousScope
);
...
...
@@ -149,8 +149,8 @@ bool CheckStatement::visit(ForeachStatementAST *ast)
ast
->
symbol
=
block
;
_scope
->
enterSymbol
(
block
);
Scope
*
previousScope
=
switchScope
(
block
->
members
());
if
(
ast
->
type_specifier
s
&&
ast
->
declarator
)
{
FullySpecifiedType
ty
=
semantic
()
->
check
(
ast
->
type_specifier
s
,
_scope
);
if
(
ast
->
type_specifier
_list
&&
ast
->
declarator
)
{
FullySpecifiedType
ty
=
semantic
()
->
check
(
ast
->
type_specifier
_list
,
_scope
);
Name
*
name
=
0
;
ty
=
semantic
()
->
check
(
ast
->
declarator
,
ty
,
_scope
,
&
name
);
unsigned
location
=
ast
->
declarator
->
firstToken
();
...
...
@@ -178,8 +178,8 @@ bool CheckStatement::visit(ObjCFastEnumerationAST *ast)
ast
->
symbol
=
block
;
_scope
->
enterSymbol
(
block
);
Scope
*
previousScope
=
switchScope
(
block
->
members
());
if
(
ast
->
type_specifier
s
&&
ast
->
declarator
)
{
FullySpecifiedType
ty
=
semantic
()
->
check
(
ast
->
type_specifier
s
,
_scope
);
if
(
ast
->
type_specifier
_list
&&
ast
->
declarator
)
{
FullySpecifiedType
ty
=
semantic
()
->
check
(
ast
->
type_specifier
_list
,
_scope
);
Name
*
name
=
0
;
ty
=
semantic
()
->
check
(
ast
->
declarator
,
ty
,
_scope
,
&
name
);
unsigned
location
=
ast
->
declarator
->
firstToken
();
...
...
src/shared/cplusplus/Parser.cpp
View file @
0ae2d96a
This diff is collapsed.
Click to expand it.
tests/auto/cplusplus/ast/tst_ast.cpp
View file @
0ae2d96a
This diff is collapsed.
Click to expand it.
tests/auto/cplusplus/semantic/tst_semantic.cpp
View file @
0ae2d96a
...
...
@@ -58,7 +58,7 @@ public:
Semantic
sem
(
unit
->
control
());
TranslationUnitAST
*
ast
=
unit
->
ast
()
->
asTranslationUnit
();
QVERIFY
(
ast
);
for
(
DeclarationListAST
*
decl
=
ast
->
declaration
s
;
decl
;
decl
=
decl
->
next
)
{
for
(
DeclarationListAST
*
decl
=
ast
->
declaration
_list
;
decl
;
decl
=
decl
->
next
)
{
sem
.
check
(
decl
->
value
,
globals
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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