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
1a7855af
Commit
1a7855af
authored
15 years ago
by
Roberto Raggi
Browse files
Options
Downloads
Patches
Plain Diff
Match the value of the literals.
parent
baffd97e
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/ASTMatcher.cpp
+3
-0
3 additions, 0 deletions
src/shared/cplusplus/ASTMatcher.cpp
src/shared/cplusplus/Literals.cpp
+13
-14
13 additions, 14 deletions
src/shared/cplusplus/Literals.cpp
src/shared/cplusplus/Literals.h
+2
-2
2 additions, 2 deletions
src/shared/cplusplus/Literals.h
with
18 additions
and
16 deletions
src/shared/cplusplus/ASTMatcher.cpp
+
3
−
0
View file @
1a7855af
...
@@ -57,6 +57,9 @@ bool ASTMatcher::matchToken(unsigned tokenIndex, unsigned patternTokenIndex) con
...
@@ -57,6 +57,9 @@ bool ASTMatcher::matchToken(unsigned tokenIndex, unsigned patternTokenIndex) con
else
if
(
token
.
is
(
T_IDENTIFIER
))
{
else
if
(
token
.
is
(
T_IDENTIFIER
))
{
if
(
!
token
.
identifier
->
isEqualTo
(
otherToken
.
identifier
))
if
(
!
token
.
identifier
->
isEqualTo
(
otherToken
.
identifier
))
return
false
;
return
false
;
}
else
if
(
token
.
isLiteral
())
{
if
(
!
token
.
literal
->
isEqualTo
(
otherToken
.
literal
))
return
false
;
}
}
return
true
;
return
true
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/shared/cplusplus/Literals.cpp
+
13
−
14
View file @
1a7855af
...
@@ -72,6 +72,19 @@ Literal::Literal(const char *chars, unsigned size)
...
@@ -72,6 +72,19 @@ Literal::Literal(const char *chars, unsigned size)
Literal
::~
Literal
()
Literal
::~
Literal
()
{
delete
[]
_chars
;
}
{
delete
[]
_chars
;
}
bool
Literal
::
isEqualTo
(
const
Literal
*
other
)
const
{
if
(
!
other
)
return
false
;
else
if
(
this
==
other
)
return
true
;
else
if
(
hashCode
()
!=
other
->
hashCode
())
return
false
;
else
if
(
size
()
!=
other
->
size
())
return
false
;
return
!
strcmp
(
chars
(),
other
->
chars
());
}
Literal
::
iterator
Literal
::
begin
()
const
Literal
::
iterator
Literal
::
begin
()
const
{
return
_chars
;
}
{
return
_chars
;
}
...
@@ -214,17 +227,3 @@ Identifier::Identifier(const char *chars, unsigned size)
...
@@ -214,17 +227,3 @@ Identifier::Identifier(const char *chars, unsigned size)
Identifier
::~
Identifier
()
Identifier
::~
Identifier
()
{
}
{
}
bool
Identifier
::
isEqualTo
(
const
Identifier
*
other
)
const
{
if
(
!
other
)
return
false
;
else
if
(
this
==
other
)
return
true
;
else
if
(
hashCode
()
!=
other
->
hashCode
())
return
false
;
else
if
(
size
()
!=
other
->
size
())
return
false
;
return
!
strcmp
(
chars
(),
other
->
chars
());
}
This diff is collapsed.
Click to expand it.
src/shared/cplusplus/Literals.h
+
2
−
2
View file @
1a7855af
...
@@ -78,6 +78,8 @@ public:
...
@@ -78,6 +78,8 @@ public:
unsigned
hashCode
()
const
;
unsigned
hashCode
()
const
;
static
unsigned
hashCode
(
const
char
*
chars
,
unsigned
size
);
static
unsigned
hashCode
(
const
char
*
chars
,
unsigned
size
);
bool
isEqualTo
(
const
Literal
*
other
)
const
;
private:
private:
char
*
_chars
;
char
*
_chars
;
unsigned
_size
;
unsigned
_size
;
...
@@ -131,8 +133,6 @@ class CPLUSPLUS_EXPORT Identifier: public Literal
...
@@ -131,8 +133,6 @@ class CPLUSPLUS_EXPORT Identifier: public Literal
public:
public:
Identifier
(
const
char
*
chars
,
unsigned
size
);
Identifier
(
const
char
*
chars
,
unsigned
size
);
virtual
~
Identifier
();
virtual
~
Identifier
();
bool
isEqualTo
(
const
Identifier
*
other
)
const
;
};
};
}
// end of namespace CPlusPlus
}
// end of namespace CPlusPlus
...
...
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