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
e9c43b3e
Commit
e9c43b3e
authored
May 31, 2010
by
Roberto Raggi
Browse files
Cache the LookupContext.
parent
1c078ec2
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/cppeditor/cppeditor.cpp
View file @
e9c43b3e
...
...
@@ -966,8 +966,7 @@ void CPPEditor::markSymbols(Symbol *canonicalSymbol, const SemanticInfo &info)
if
(
canonicalSymbol
)
{
TranslationUnit
*
unit
=
info
.
doc
->
translationUnit
();
LookupContext
context
(
info
.
doc
,
info
.
snapshot
);
// ### remove me
const
QList
<
int
>
references
=
m_modelManager
->
references
(
canonicalSymbol
,
context
);
const
QList
<
int
>
references
=
m_modelManager
->
references
(
canonicalSymbol
,
info
.
context
);
foreach
(
int
index
,
references
)
{
unsigned
line
,
column
;
unit
->
getTokenPosition
(
index
,
&
line
,
&
column
);
...
...
@@ -2055,6 +2054,7 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source)
Document
::
Ptr
doc
;
QList
<
Document
::
DiagnosticMessage
>
diagnosticMessages
;
QList
<
SemanticInfo
::
Use
>
typeUsages
;
LookupContext
context
;
if
(
!
source
.
force
&&
revision
==
source
.
revision
)
{
m_mutex
.
lock
();
...
...
@@ -2062,6 +2062,7 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source)
doc
=
m_lastSemanticInfo
.
doc
;
diagnosticMessages
=
m_lastSemanticInfo
.
diagnosticMessages
;
typeUsages
=
m_lastSemanticInfo
.
typeUsages
;
context
=
m_lastSemanticInfo
.
context
;
m_mutex
.
unlock
();
}
...
...
@@ -2072,7 +2073,7 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source)
doc
=
snapshot
.
documentFromSource
(
preprocessedCode
,
source
.
fileName
);
doc
->
check
();
LookupContext
c
ontext
(
doc
,
snapshot
);
context
=
LookupC
ontext
(
doc
,
snapshot
);
if
(
TranslationUnit
*
unit
=
doc
->
translationUnit
())
{
CheckUndefinedSymbols
checkUndefinedSymbols
(
unit
,
context
);
...
...
@@ -2102,6 +2103,7 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source)
semanticInfo
.
forced
=
source
.
force
;
semanticInfo
.
diagnosticMessages
=
diagnosticMessages
;
semanticInfo
.
typeUsages
=
typeUsages
;
semanticInfo
.
context
=
context
;
return
semanticInfo
;
}
src/plugins/cppeditor/cppeditor.h
View file @
e9c43b3e
...
...
@@ -33,6 +33,7 @@
#include
"cppeditorenums.h"
#include
"cppquickfix.h"
#include
<cplusplus/CppDocument.h>
#include
<cplusplus/LookupContext.h>
#include
<texteditor/basetexteditor.h>
#include
<QtCore/QThread>
...
...
@@ -86,8 +87,9 @@ public:
bool
hasQ
:
1
;
bool
hasD
:
1
;
bool
forced
:
1
;
CPlusPlus
::
Snapshot
snapshot
;
CPlusPlus
::
Document
::
Ptr
doc
;
CPlusPlus
::
Snapshot
snapshot
;
// ### remove
CPlusPlus
::
Document
::
Ptr
doc
;
// ### remove
CPlusPlus
::
LookupContext
context
;
LocalUseMap
localUses
;
// ### rename
QList
<
Use
>
typeUsages
;
QList
<
CPlusPlus
::
Document
::
DiagnosticMessage
>
diagnosticMessages
;
...
...
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