Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
56f755ef
Commit
56f755ef
authored
15 years ago
by
Erik Verbruggen
Browse files
Options
Downloads
Patches
Plain Diff
Changed ObjC context keyword comparison to use identifiers.
parent
c5cf70c6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/shared/cplusplus/CheckDeclaration.cpp
+9
-9
9 additions, 9 deletions
src/shared/cplusplus/CheckDeclaration.cpp
src/shared/cplusplus/Control.cpp
+42
-1
42 additions, 1 deletion
src/shared/cplusplus/Control.cpp
src/shared/cplusplus/Control.h
+10
-0
10 additions, 0 deletions
src/shared/cplusplus/Control.h
with
61 additions
and
10 deletions
src/shared/cplusplus/CheckDeclaration.cpp
+
9
−
9
View file @
56f755ef
...
@@ -700,26 +700,26 @@ bool CheckDeclaration::visit(ObjCPropertyDeclarationAST *ast)
...
@@ -700,26 +700,26 @@ bool CheckDeclaration::visit(ObjCPropertyDeclarationAST *ast)
if
(
!
attrAst
)
if
(
!
attrAst
)
continue
;
continue
;
const
char
*
attrName
=
spell
(
attrAst
->
attribute_identifier_token
);
Identifier
*
attrId
=
identifier
(
attrAst
->
attribute_identifier_token
);
if
(
!
strcmp
(
"getter"
,
attrName
))
{
if
(
attrId
==
control
()
->
objcGetterId
(
))
{
if
(
checkPropertyAttribute
(
attrAst
,
propAttrs
,
Getter
))
{
if
(
checkPropertyAttribute
(
attrAst
,
propAttrs
,
Getter
))
{
// TODO: find method declaration for getter
// TODO: find method declaration for getter
}
}
}
else
if
(
!
strcmp
(
"setter"
,
attrName
))
{
}
else
if
(
attrId
==
control
()
->
objcSetterId
(
))
{
if
(
checkPropertyAttribute
(
attrAst
,
propAttrs
,
Setter
))
{
if
(
checkPropertyAttribute
(
attrAst
,
propAttrs
,
Setter
))
{
// TODO: find method declaration for setter
// TODO: find method declaration for setter
}
}
}
else
if
(
!
strcmp
(
"readwrite"
,
attrName
))
{
}
else
if
(
attrId
==
control
()
->
objcReadwriteId
(
))
{
checkPropertyAttribute
(
attrAst
,
propAttrs
,
ReadWrite
);
checkPropertyAttribute
(
attrAst
,
propAttrs
,
ReadWrite
);
}
else
if
(
!
strcmp
(
"readonly"
,
attrName
))
{
}
else
if
(
attrId
==
control
()
->
objcReadonlyId
(
))
{
checkPropertyAttribute
(
attrAst
,
propAttrs
,
ReadOnly
);
checkPropertyAttribute
(
attrAst
,
propAttrs
,
ReadOnly
);
}
else
if
(
!
strcmp
(
"assign"
,
attrName
))
{
}
else
if
(
attrId
==
control
()
->
objcAssignId
(
))
{
checkPropertyAttribute
(
attrAst
,
propAttrs
,
Assign
);
checkPropertyAttribute
(
attrAst
,
propAttrs
,
Assign
);
}
else
if
(
!
strcmp
(
"retain"
,
attrName
))
{
}
else
if
(
attrId
==
control
()
->
objcRetainId
(
))
{
checkPropertyAttribute
(
attrAst
,
propAttrs
,
Retain
);
checkPropertyAttribute
(
attrAst
,
propAttrs
,
Retain
);
}
else
if
(
!
strcmp
(
"copy"
,
attrName
))
{
}
else
if
(
attrId
==
control
()
->
objcCopyId
(
))
{
checkPropertyAttribute
(
attrAst
,
propAttrs
,
Copy
);
checkPropertyAttribute
(
attrAst
,
propAttrs
,
Copy
);
}
else
if
(
!
strcmp
(
"nonatomic"
,
attrName
))
{
}
else
if
(
attrId
==
control
()
->
objcNonatomicId
(
))
{
checkPropertyAttribute
(
attrAst
,
propAttrs
,
NonAtomic
);
checkPropertyAttribute
(
attrAst
,
propAttrs
,
NonAtomic
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/shared/cplusplus/Control.cpp
+
42
−
1
View file @
56f755ef
...
@@ -89,7 +89,16 @@ public:
...
@@ -89,7 +89,16 @@ public:
:
control
(
control
),
:
control
(
control
),
translationUnit
(
0
),
translationUnit
(
0
),
diagnosticClient
(
0
)
diagnosticClient
(
0
)
{
}
{
objcGetterId
=
control
->
findOrInsertIdentifier
(
"getter"
);
objcSetterId
=
control
->
findOrInsertIdentifier
(
"setter"
);
objcReadwriteId
=
control
->
findOrInsertIdentifier
(
"readwrite"
);
objcReadonlyId
=
control
->
findOrInsertIdentifier
(
"readonly"
);
objcAssignId
=
control
->
findOrInsertIdentifier
(
"assign"
);
objcRetainId
=
control
->
findOrInsertIdentifier
(
"retain"
);
objcCopyId
=
control
->
findOrInsertIdentifier
(
"copy"
);
objcNonatomicId
=
control
->
findOrInsertIdentifier
(
"nonatomic"
);
}
~
Data
()
~
Data
()
{
{
...
@@ -577,6 +586,16 @@ public:
...
@@ -577,6 +586,16 @@ public:
std
::
vector
<
ObjCForwardClassDeclaration
*>
objcForwardClassDeclarations
;
std
::
vector
<
ObjCForwardClassDeclaration
*>
objcForwardClassDeclarations
;
std
::
vector
<
ObjCForwardProtocolDeclaration
*>
objcForwardProtocolDeclarations
;
std
::
vector
<
ObjCForwardProtocolDeclaration
*>
objcForwardProtocolDeclarations
;
std
::
vector
<
ObjCMethod
*>
objcMethods
;
std
::
vector
<
ObjCMethod
*>
objcMethods
;
// ObjC context keywords:
Identifier
*
objcGetterId
;
Identifier
*
objcSetterId
;
Identifier
*
objcReadwriteId
;
Identifier
*
objcReadonlyId
;
Identifier
*
objcAssignId
;
Identifier
*
objcRetainId
;
Identifier
*
objcCopyId
;
Identifier
*
objcNonatomicId
;
};
};
Control
::
Control
()
Control
::
Control
()
...
@@ -766,4 +785,26 @@ ObjCForwardProtocolDeclaration *Control::newObjCForwardProtocolDeclaration(unsig
...
@@ -766,4 +785,26 @@ ObjCForwardProtocolDeclaration *Control::newObjCForwardProtocolDeclaration(unsig
ObjCMethod
*
Control
::
newObjCMethod
(
unsigned
sourceLocation
,
Name
*
name
)
ObjCMethod
*
Control
::
newObjCMethod
(
unsigned
sourceLocation
,
Name
*
name
)
{
return
d
->
newObjCMethod
(
sourceLocation
,
name
);
}
{
return
d
->
newObjCMethod
(
sourceLocation
,
name
);
}
Identifier
*
Control
::
objcGetterId
()
const
{
return
d
->
objcGetterId
;
}
Identifier
*
Control
::
objcSetterId
()
const
{
return
d
->
objcSetterId
;
}
Identifier
*
Control
::
objcReadwriteId
()
const
{
return
d
->
objcReadwriteId
;
}
Identifier
*
Control
::
objcReadonlyId
()
const
{
return
d
->
objcReadonlyId
;
}
Identifier
*
Control
::
objcAssignId
()
const
{
return
d
->
objcAssignId
;
}
Identifier
*
Control
::
objcRetainId
()
const
{
return
d
->
objcRetainId
;
}
Identifier
*
Control
::
objcCopyId
()
const
{
return
d
->
objcCopyId
;
}
Identifier
*
Control
::
objcNonatomicId
()
const
{
return
d
->
objcNonatomicId
;
}
This diff is collapsed.
Click to expand it.
src/shared/cplusplus/Control.h
+
10
−
0
View file @
56f755ef
...
@@ -169,6 +169,16 @@ public:
...
@@ -169,6 +169,16 @@ public:
/// Creates a new Objective-C method symbol.
/// Creates a new Objective-C method symbol.
ObjCMethod
*
newObjCMethod
(
unsigned
sourceLocation
,
Name
*
name
=
0
);
ObjCMethod
*
newObjCMethod
(
unsigned
sourceLocation
,
Name
*
name
=
0
);
// Objective-C specific context keywords.
Identifier
*
objcGetterId
()
const
;
Identifier
*
objcSetterId
()
const
;
Identifier
*
objcReadwriteId
()
const
;
Identifier
*
objcReadonlyId
()
const
;
Identifier
*
objcAssignId
()
const
;
Identifier
*
objcRetainId
()
const
;
Identifier
*
objcCopyId
()
const
;
Identifier
*
objcNonatomicId
()
const
;
Identifier
*
findIdentifier
(
const
char
*
chars
,
unsigned
size
)
const
;
Identifier
*
findIdentifier
(
const
char
*
chars
,
unsigned
size
)
const
;
Identifier
*
findOrInsertIdentifier
(
const
char
*
chars
,
unsigned
size
);
Identifier
*
findOrInsertIdentifier
(
const
char
*
chars
,
unsigned
size
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment