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
Marco Bubke
flatpak-qt-creator
Commits
2a0f901e
Commit
2a0f901e
authored
May 25, 2010
by
Roberto Raggi
Browse files
Use the document in the snapshot when available.
parent
3141edd2
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/CheckUndefinedSymbols.cpp
View file @
2a0f901e
...
...
@@ -42,10 +42,10 @@
using
namespace
CPlusPlus
;
CheckUndefinedSymbols
::
CheckUndefinedSymbols
(
Document
::
Ptr
doc
,
const
Snapshot
&
snapsho
t
)
:
ASTVisitor
(
doc
->
translationU
nit
()
),
_context
(
doc
,
snapsho
t
)
CheckUndefinedSymbols
::
CheckUndefinedSymbols
(
TranslationUnit
*
unit
,
const
LookupContext
&
contex
t
)
:
ASTVisitor
(
u
nit
),
_context
(
contex
t
)
{
_fileName
=
doc
->
fileName
();
_fileName
=
context
.
thisDocument
()
->
fileName
();
}
CheckUndefinedSymbols
::~
CheckUndefinedSymbols
()
...
...
src/libs/cplusplus/CheckUndefinedSymbols.h
View file @
2a0f901e
...
...
@@ -39,7 +39,7 @@ namespace CPlusPlus {
class
CPLUSPLUS_EXPORT
CheckUndefinedSymbols
:
protected
ASTVisitor
{
public:
CheckUndefinedSymbols
(
Document
::
Ptr
doc
,
const
Snapshot
&
snapsho
t
);
CheckUndefinedSymbols
(
TranslationUnit
*
unit
,
const
LookupContext
&
contex
t
);
virtual
~
CheckUndefinedSymbols
();
QList
<
Document
::
DiagnosticMessage
>
operator
()(
AST
*
ast
);
...
...
src/plugins/cppeditor/cppeditor.cpp
View file @
2a0f901e
...
...
@@ -1997,15 +1997,24 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source)
}
if
(
!
doc
)
{
const
QByteArray
preprocessedCode
=
source
.
snapshot
.
preprocessedCode
(
source
.
code
,
source
.
fileName
);
snapshot
=
source
.
snapshot
;
doc
=
source
.
snapshot
.
documentFromSource
(
preprocessedCode
,
source
.
fileName
);
const
QByteArray
preprocessedCode
=
snapshot
.
preprocessedCode
(
source
.
code
,
source
.
fileName
);
doc
=
snapshot
.
documentFromSource
(
preprocessedCode
,
source
.
fileName
);
doc
->
check
();
// ### check undefined symbols.
CheckUndefinedSymbols
checkUndefinedSymbols
(
doc
,
snapshot
);
diagnosticMessages
=
checkUndefinedSymbols
(
doc
->
translationUnit
()
->
ast
());
Document
::
Ptr
documentInSnapshot
=
snapshot
.
document
(
source
.
fileName
);
if
(
!
documentInSnapshot
)
{
// use the newly parsed document.
documentInSnapshot
=
doc
;
}
LookupContext
context
(
doc
,
snapshot
);
if
(
TranslationUnit
*
unit
=
doc
->
translationUnit
())
{
CheckUndefinedSymbols
checkUndefinedSymbols
(
unit
,
context
);
diagnosticMessages
=
checkUndefinedSymbols
(
unit
->
ast
());
}
}
TranslationUnit
*
translationUnit
=
doc
->
translationUnit
();
...
...
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