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
Q
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
Tobias Hunger
qt-creator
Commits
f2372257
Commit
f2372257
authored
Aug 13, 2010
by
Roberto Raggi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Process objc methods
parent
f23c2286
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
25 deletions
+64
-25
src/shared/cplusplus/Bind.cpp
src/shared/cplusplus/Bind.cpp
+60
-22
src/shared/cplusplus/Bind.h
src/shared/cplusplus/Bind.h
+4
-3
No files found.
src/shared/cplusplus/Bind.cpp
View file @
f2372257
...
...
@@ -847,15 +847,14 @@ bool Bind::visit(ObjCTypeNameAST *ast)
return
false
;
}
void
Bind
::
objCTypeName
(
ObjCTypeNameAST
*
ast
)
FullySpecifiedType
Bind
::
objCTypeName
(
ObjCTypeNameAST
*
ast
)
{
if
(
!
ast
)
return
;
return
FullySpecifiedType
()
;
// unsigned lparen_token = ast->lparen_token;
// unsigned type_qualifier_token = ast->type_qualifier_token;
ExpressionTy
type_id
=
this
->
expression
(
ast
->
type_id
);
// unsigned rparen_token = ast->rparen_token
;
return
type_id
;
}
bool
Bind
::
visit
(
ObjCInstanceVariablesDeclarationAST
*
ast
)
...
...
@@ -903,18 +902,23 @@ bool Bind::visit(ObjCMessageArgumentDeclarationAST *ast)
return
false
;
}
void
Bind
::
objCMessageArgumentDeclaration
(
ObjCMessageArgumentDeclarationAST
*
ast
)
void
Bind
::
objCMessageArgumentDeclaration
(
ObjCMessageArgumentDeclarationAST
*
ast
,
ObjCMethod
*
method
)
{
if
(
!
ast
)
return
;
this
->
objCTypeName
(
ast
->
type_name
);
FullySpecifiedType
type
;
FullySpecifiedType
type
=
this
->
objCTypeName
(
ast
->
type_name
);
for
(
SpecifierListAST
*
it
=
ast
->
attribute_list
;
it
;
it
=
it
->
next
)
{
type
=
this
->
specifier
(
it
->
value
,
type
);
}
/*const Name *param_name =*/
this
->
name
(
ast
->
param_name
);
// Argument *argument = ast->argument;
const
Name
*
param_name
=
this
->
name
(
ast
->
param_name
);
const
unsigned
sourceLocation
=
ast
->
param_name
?
ast
->
param_name
->
firstToken
()
:
ast
->
firstToken
();
Argument
*
arg
=
control
()
->
newArgument
(
sourceLocation
,
param_name
);
arg
->
setType
(
type
);
ast
->
argument
=
arg
;
method
->
addMember
(
arg
);
}
bool
Bind
::
visit
(
ObjCMethodPrototypeAST
*
ast
)
...
...
@@ -924,23 +928,41 @@ bool Bind::visit(ObjCMethodPrototypeAST *ast)
return
false
;
}
void
Bind
::
objCMethodPrototype
(
ObjCMethodPrototypeAST
*
ast
)
ObjCMethod
*
Bind
::
objCMethodPrototype
(
ObjCMethodPrototypeAST
*
ast
)
{
if
(
!
ast
)
return
;
return
0
;
// unsigned method_type_token = ast->method_type_token;
this
->
objCTypeName
(
ast
->
type_name
);
/*const Name *selector =*/
this
->
name
(
ast
->
selector
);
FullySpecifiedType
returnType
=
this
->
objCTypeName
(
ast
->
type_name
);
const
Name
*
selector
=
this
->
name
(
ast
->
selector
);
const
unsigned
sourceLocation
=
ast
->
selector
?
ast
->
selector
->
firstToken
()
:
ast
->
firstToken
();
ObjCMethod
*
method
=
control
()
->
newObjCMethod
(
sourceLocation
,
selector
);
// ### set the offsets
method
->
setReturnType
(
returnType
);
if
(
isObjCClassMethod
(
tokenKind
(
ast
->
method_type_token
)))
method
->
setStorage
(
Symbol
::
Static
);
method
->
setVisibility
(
_objcVisibility
);
_scope
->
addMember
(
method
);
ast
->
symbol
=
method
;
Scope
*
previousScope
=
switchScope
(
method
);
for
(
ObjCMessageArgumentDeclarationListAST
*
it
=
ast
->
argument_list
;
it
;
it
=
it
->
next
)
{
this
->
objCMessageArgumentDeclaration
(
it
->
value
);
this
->
objCMessageArgumentDeclaration
(
it
->
value
,
method
);
}
// unsigned dot_dot_dot_token = ast->dot_dot_dot_token;
FullySpecifiedType
type
;
(
void
)
switchScope
(
previousScope
);
if
(
ast
->
dot_dot_dot_token
)
method
->
setVariadic
(
true
);
FullySpecifiedType
specifiers
;
for
(
SpecifierListAST
*
it
=
ast
->
attribute_list
;
it
;
it
=
it
->
next
)
{
type
=
this
->
specifier
(
it
->
value
,
type
);
specifiers
=
this
->
specifier
(
it
->
value
,
specifiers
);
}
// ObjCMethod *symbol = ast->symbol;
setDeclSpecifiers
(
method
,
specifiers
);
return
method
;
}
bool
Bind
::
visit
(
ObjCSynthesizedPropertyAST
*
ast
)
...
...
@@ -1579,7 +1601,7 @@ bool Bind::visit(ObjCProtocolExpressionAST *ast)
bool
Bind
::
visit
(
ObjCEncodeExpressionAST
*
ast
)
{
// unsigned encode_token = ast->encode_token;
this
->
objCTypeName
(
ast
->
type_name
);
FullySpecifiedType
type
=
this
->
objCTypeName
(
ast
->
type_name
);
return
false
;
}
...
...
@@ -2227,9 +2249,14 @@ bool Bind::visit(ObjCPropertyDeclarationAST *ast)
bool
Bind
::
visit
(
ObjCMethodDeclarationAST
*
ast
)
{
this
->
objCMethodPrototype
(
ast
->
method_prototype
);
this
->
statement
(
ast
->
function_body
);
// unsigned semicolon_token = ast->semicolon_token;
ObjCMethod
*
method
=
this
->
objCMethodPrototype
(
ast
->
method_prototype
);
if
(
!
_skipFunctionBodies
&&
ast
->
function_body
)
{
Scope
*
previousScope
=
switchScope
(
method
);
this
->
statement
(
ast
->
function_body
);
(
void
)
switchScope
(
previousScope
);
}
return
false
;
}
...
...
@@ -2831,3 +2858,14 @@ int Bind::visibilityForObjCAccessSpecifier(int tokenKind)
return
Symbol
::
Protected
;
}
}
bool
Bind
::
isObjCClassMethod
(
int
tokenKind
)
{
switch
(
tokenKind
)
{
case
T_PLUS
:
return
true
;
case
T_MINUS
:
default:
return
false
;
}
}
src/shared/cplusplus/Bind.h
View file @
f2372257
...
...
@@ -72,6 +72,7 @@ protected:
static
int
visibilityForAccessSpecifier
(
int
tokenKind
);
static
int
visibilityForClassKey
(
int
tokenKind
);
static
int
visibilityForObjCAccessSpecifier
(
int
tokenKind
);
static
bool
isObjCClassMethod
(
int
tokenKind
);
void
setDeclSpecifiers
(
Symbol
*
symbol
,
const
FullySpecifiedType
&
declSpecifiers
);
...
...
@@ -116,11 +117,11 @@ protected:
void
translationUnit
(
TranslationUnitAST
*
ast
);
void
objCProtocolRefs
(
ObjCProtocolRefsAST
*
ast
,
Symbol
*
objcClassOrProtocol
);
void
objCMessageArgument
(
ObjCMessageArgumentAST
*
ast
);
void
objCTypeName
(
ObjCTypeNameAST
*
ast
);
FullySpecifiedType
objCTypeName
(
ObjCTypeNameAST
*
ast
);
void
objCInstanceVariablesDeclaration
(
ObjCInstanceVariablesDeclarationAST
*
ast
,
ObjCClass
*
klass
);
void
objCPropertyAttribute
(
ObjCPropertyAttributeAST
*
ast
);
void
objCMessageArgumentDeclaration
(
ObjCMessageArgumentDeclarationAST
*
ast
);
void
objCMethodPrototype
(
ObjCMethodPrototypeAST
*
ast
);
void
objCMessageArgumentDeclaration
(
ObjCMessageArgumentDeclarationAST
*
ast
,
ObjCMethod
*
method
);
ObjCMethod
*
objCMethodPrototype
(
ObjCMethodPrototypeAST
*
ast
);
void
objCSynthesizedProperty
(
ObjCSynthesizedPropertyAST
*
ast
);
void
lambdaIntroducer
(
LambdaIntroducerAST
*
ast
);
void
lambdaCapture
(
LambdaCaptureAST
*
ast
);
...
...
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