Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
510bd6dc
Commit
510bd6dc
authored
Sep 30, 2009
by
Roberto Raggi
Browse files
Cache the lookup context.
parent
ae43149c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/cpptools/cppfindreferences.cpp
View file @
510bd6dc
...
...
@@ -166,12 +166,19 @@ protected:
return
false
;
}
LookupContext
currentContext
(
AST
*
ast
)
const
LookupContext
_previousContext
;
LookupContext
currentContext
(
AST
*
ast
)
{
unsigned
line
,
column
;
getTokenStartPosition
(
ast
->
firstToken
(),
&
line
,
&
column
);
Symbol
*
lastVisibleSymbol
=
_doc
->
findSymbolAt
(
line
,
column
);
if
(
lastVisibleSymbol
&&
lastVisibleSymbol
==
_previousContext
.
symbol
())
return
_previousContext
;
LookupContext
ctx
(
lastVisibleSymbol
,
_exprDoc
,
_doc
,
_snapshot
);
_previousContext
=
ctx
;
return
ctx
;
}
...
...
@@ -456,6 +463,8 @@ static void find_helper(QFutureInterface<Core::Utils::FileSearchResult> &future,
Control
*
control
=
doc
->
control
();
if
(
Identifier
*
id
=
control
->
findIdentifier
(
symbolId
->
chars
(),
symbolId
->
size
()))
{
QTime
tm
;
tm
.
start
();
TranslationUnit
*
unit
=
doc
->
translationUnit
();
Control
*
control
=
doc
->
control
();
...
...
@@ -464,10 +473,18 @@ static void find_helper(QFutureInterface<Core::Utils::FileSearchResult> &future,
doc
->
parse
();
control
->
setMacroResolver
(
0
);
//qDebug() << "***" << unit->fileName() << "parsed in:" << tm.elapsed();
tm
.
start
();
doc
->
check
();
//qDebug() << "***" << unit->fileName() << "checked in:" << tm.elapsed();
tm
.
start
();
Process
process
(
doc
,
snapshot
,
&
future
);
process
(
symbol
,
id
,
unit
->
ast
());
//qDebug() << "***" << unit->fileName() << "processed in:" << tm.elapsed();
}
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment