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
b93c9ce3
Commit
b93c9ce3
authored
16 years ago
by
Roberto Raggi
Browse files
Options
Downloads
Patches
Plain Diff
Some cleanup in the lookup context.
parent
089401fb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/libs/cplusplus/LookupContext.cpp
+21
-31
21 additions, 31 deletions
src/libs/cplusplus/LookupContext.cpp
src/libs/cplusplus/LookupContext.h
+4
-4
4 additions, 4 deletions
src/libs/cplusplus/LookupContext.h
with
25 additions
and
35 deletions
src/libs/cplusplus/LookupContext.cpp
+
21
−
31
View file @
b93c9ce3
...
...
@@ -351,14 +351,10 @@ void LookupContext::expand(const QList<Scope *> &scopes, QList<Scope *> *expande
}
}
void
LookupContext
::
expandNamespace
(
Scope
*
scope
,
void
LookupContext
::
expandNamespace
(
Namespace
*
ns
,
const
QList
<
Scope
*>
&
visibleScopes
,
QList
<
Scope
*>
*
expandedScopes
)
const
{
Namespace
*
ns
=
scope
->
owner
()
->
asNamespace
();
if
(
!
ns
)
return
;
if
(
Name
*
nsName
=
ns
->
name
())
{
const
QList
<
Symbol
*>
namespaceList
=
resolveNamespace
(
nsName
,
visibleScopes
);
foreach
(
Symbol
*
otherNs
,
namespaceList
)
{
...
...
@@ -368,10 +364,10 @@ void LookupContext::expandNamespace(Scope *scope,
}
}
for
(
unsigned
i
=
0
;
i
<
scope
->
symbol
Count
();
++
i
)
{
// ### make me fast
Symbol
*
symbol
=
scope
->
symbol
At
(
i
);
if
(
Namespace
*
n
s
=
symbol
->
asNamespace
())
{
if
(
!
n
s
->
name
())
{
for
(
unsigned
i
=
0
;
i
<
ns
->
member
Count
();
++
i
)
{
// ### make me fast
Symbol
*
symbol
=
ns
->
member
At
(
i
);
if
(
Namespace
*
otherN
s
=
symbol
->
asNamespace
())
{
if
(
!
otherN
s
->
name
())
{
expand
(
ns
->
members
(),
visibleScopes
,
expandedScopes
);
}
}
else
if
(
UsingNamespaceDirective
*
u
=
symbol
->
asUsingNamespaceDirective
())
{
...
...
@@ -386,16 +382,12 @@ void LookupContext::expandNamespace(Scope *scope,
}
}
void
LookupContext
::
expandClass
(
Scope
*
scope
,
void
LookupContext
::
expandClass
(
Class
*
klass
,
const
QList
<
Scope
*>
&
visibleScopes
,
QList
<
Scope
*>
*
expandedScopes
)
const
{
Class
*
klass
=
scope
->
owner
()
->
asClass
();
if
(
!
klass
)
return
;
for
(
unsigned
i
=
0
;
i
<
scope
->
symbolCount
();
++
i
)
{
Symbol
*
symbol
=
scope
->
symbolAt
(
i
);
for
(
unsigned
i
=
0
;
i
<
klass
->
memberCount
();
++
i
)
{
Symbol
*
symbol
=
klass
->
memberAt
(
i
);
if
(
Class
*
nestedClass
=
symbol
->
asClass
())
{
if
(
!
nestedClass
->
name
())
{
expand
(
nestedClass
->
members
(),
visibleScopes
,
expandedScopes
);
...
...
@@ -442,12 +434,12 @@ void LookupContext::expandClass(Scope *scope,
}
}
void
LookupContext
::
expandBlock
(
Scope
*
scope
,
void
LookupContext
::
expandBlock
(
Block
*
blockSymbol
,
const
QList
<
Scope
*>
&
visibleScopes
,
QList
<
Scope
*>
*
expandedScopes
)
const
{
for
(
unsigned
i
=
0
;
i
<
scope
->
symbol
Count
();
++
i
)
{
Symbol
*
symbol
=
scope
->
symbol
At
(
i
);
for
(
unsigned
i
=
0
;
i
<
blockSymbol
->
member
Count
();
++
i
)
{
Symbol
*
symbol
=
blockSymbol
->
member
At
(
i
);
if
(
UsingNamespaceDirective
*
u
=
symbol
->
asUsingNamespaceDirective
())
{
const
QList
<
Symbol
*>
candidates
=
resolveNamespace
(
u
->
name
(),
visibleScopes
);
...
...
@@ -460,13 +452,13 @@ void LookupContext::expandBlock(Scope *scope,
}
}
void
LookupContext
::
expandFunction
(
Scope
*
scope
,
void
LookupContext
::
expandFunction
(
Function
*
function
,
const
QList
<
Scope
*>
&
visibleScopes
,
QList
<
Scope
*>
*
expandedScopes
)
const
{
Function
*
function
=
scope
->
owner
()
->
asFunction
();
if
(
!
expandedScopes
->
contains
(
function
->
arguments
()))
expandedScopes
->
append
(
function
->
arguments
());
if
(
QualifiedNameId
*
q
=
function
->
name
()
->
asQualifiedNameId
())
{
Name
*
nestedNameSpec
=
0
;
if
(
q
->
nameCount
()
==
1
)
...
...
@@ -491,15 +483,13 @@ void LookupContext::expand(Scope *scope,
expandedScopes
->
append
(
scope
);
if
(
scope
->
isNamespaceScope
())
{
expandNamespace
(
scope
,
visibleScopes
,
expandedScopes
);
}
else
if
(
scope
->
isClassScope
())
{
expandClass
(
scope
,
visibleScopes
,
expandedScopes
);
}
else
if
(
scope
->
isBlockScope
())
{
expandBlock
(
scope
,
visibleScopes
,
expandedScopes
);
}
else
if
(
scope
->
isFunctionScope
())
{
expandFunction
(
scope
,
visibleScopes
,
expandedScopes
);
}
else
if
(
scope
->
isPrototypeScope
())
{
//qDebug() << "prototype scope" << overview.prettyName(scope->owner()->name());
if
(
Namespace
*
ns
=
scope
->
owner
()
->
asNamespace
())
{
expandNamespace
(
ns
,
visibleScopes
,
expandedScopes
);
}
else
if
(
Class
*
klass
=
scope
->
owner
()
->
asClass
())
{
expandClass
(
klass
,
visibleScopes
,
expandedScopes
);
}
else
if
(
Block
*
block
=
scope
->
owner
()
->
asBlock
())
{
expandBlock
(
block
,
visibleScopes
,
expandedScopes
);
}
else
if
(
Function
*
fun
=
scope
->
owner
()
->
asFunction
())
{
expandFunction
(
fun
,
visibleScopes
,
expandedScopes
);
}
}
This diff is collapsed.
Click to expand it.
src/libs/cplusplus/LookupContext.h
+
4
−
4
View file @
b93c9ce3
...
...
@@ -110,19 +110,19 @@ public:
void
expand
(
Scope
*
scope
,
const
QList
<
Scope
*>
&
visibleScopes
,
QList
<
Scope
*>
*
expandedScopes
)
const
;
void
expandNamespace
(
Scope
*
scope
,
void
expandNamespace
(
Namespace
*
namespaceSymbol
,
const
QList
<
Scope
*>
&
visibleScopes
,
QList
<
Scope
*>
*
expandedScopes
)
const
;
void
expandClass
(
Scope
*
scope
,
void
expandClass
(
Class
*
classSymbol
,
const
QList
<
Scope
*>
&
visibleScopes
,
QList
<
Scope
*>
*
expandedScopes
)
const
;
void
expandBlock
(
Scope
*
scope
,
void
expandBlock
(
Block
*
blockSymbol
,
const
QList
<
Scope
*>
&
visibleScopes
,
QList
<
Scope
*>
*
expandedScopes
)
const
;
void
expandFunction
(
Scope
*
scope
,
void
expandFunction
(
Function
*
functionSymbol
,
const
QList
<
Scope
*>
&
visibleScopes
,
QList
<
Scope
*>
*
expandedScopes
)
const
;
...
...
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