Skip to content
GitLab
Menu
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
cb9cc8dc
Commit
cb9cc8dc
authored
Feb 04, 2011
by
Leandro Melo
Browse files
C++ editor: Better control to stop the semantic highlighter
Done-by: Roberto Raggi Reviewed-by: Leandro Melo Reviewed-by: mae
parent
3c8ff2be
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/plugins/cppeditor/cppeditor.cpp
View file @
cb9cc8dc
...
...
@@ -2182,6 +2182,7 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source)
const
QByteArray
preprocessedCode
=
snapshot
.
preprocessedCode
(
source
.
code
,
source
.
fileName
);
doc
=
snapshot
.
documentFromSource
(
preprocessedCode
,
source
.
fileName
);
doc
->
control
()
->
setTopLevelDeclarationProcessor
(
this
);
doc
->
check
();
#if 0
...
...
src/plugins/cppeditor/cppeditor.h
View file @
cb9cc8dc
...
...
@@ -73,7 +73,7 @@ namespace Internal {
class
CPPEditor
;
class
SemanticHighlighter
:
public
QThread
class
SemanticHighlighter
:
public
QThread
,
CPlusPlus
::
TopLevelDeclarationProcessor
{
Q_OBJECT
...
...
@@ -81,6 +81,8 @@ public:
SemanticHighlighter
(
QObject
*
parent
=
0
);
virtual
~
SemanticHighlighter
();
virtual
bool
processDeclaration
(
CPlusPlus
::
DeclarationAST
*
)
{
return
m_done
;
}
void
abort
();
struct
Source
...
...
src/shared/cplusplus/Control.cpp
View file @
cb9cc8dc
...
...
@@ -244,6 +244,7 @@ public:
,
objcRetainId
(
0
)
,
objcCopyId
(
0
)
,
objcNonatomicId
(
0
)
,
processor
(
0
)
{}
~
Data
()
...
...
@@ -531,6 +532,7 @@ public:
const
Identifier
*
objcRetainId
;
const
Identifier
*
objcCopyId
;
const
Identifier
*
objcNonatomicId
;
TopLevelDeclarationProcessor
*
processor
;
};
Control
::
Control
()
...
...
@@ -809,3 +811,13 @@ void Control::squeeze()
{
d
->
numericLiterals
.
reset
();
}
TopLevelDeclarationProcessor
*
Control
::
topLevelDeclarationProcessor
()
const
{
return
d
->
processor
;
}
void
Control
::
setTopLevelDeclarationProcessor
(
CPlusPlus
::
TopLevelDeclarationProcessor
*
processor
)
{
d
->
processor
=
processor
;
}
src/shared/cplusplus/Control.h
View file @
cb9cc8dc
...
...
@@ -54,10 +54,18 @@
#define CPLUSPLUS_CONTROL_H
#include "CPlusPlusForwardDeclarations.h"
#include "ASTfwd.h"
#include "Names.h"
namespace
CPlusPlus
{
class
CPLUSPLUS_EXPORT
TopLevelDeclarationProcessor
{
public:
virtual
~
TopLevelDeclarationProcessor
()
{}
virtual
bool
processDeclaration
(
DeclarationAST
*
ast
)
=
0
;
};
class
CPLUSPLUS_EXPORT
Control
{
public:
...
...
@@ -67,6 +75,9 @@ public:
TranslationUnit
*
translationUnit
()
const
;
TranslationUnit
*
switchTranslationUnit
(
TranslationUnit
*
unit
);
TopLevelDeclarationProcessor
*
topLevelDeclarationProcessor
()
const
;
void
setTopLevelDeclarationProcessor
(
TopLevelDeclarationProcessor
*
processor
);
DiagnosticClient
*
diagnosticClient
()
const
;
void
setDiagnosticClient
(
DiagnosticClient
*
diagnosticClient
);
...
...
src/shared/cplusplus/Parser.cpp
View file @
cb9cc8dc
...
...
@@ -566,6 +566,12 @@ bool Parser::parseTranslationUnit(TranslationUnitAST *&node)
skipUntilDeclaration
();
}
if
(
TopLevelDeclarationProcessor
*
processor
=
_control
->
topLevelDeclarationProcessor
())
{
if
(
processor
->
processDeclaration
(
declaration
))
break
;
}
_templateArgumentList
.
clear
();
}
...
...
@@ -6032,3 +6038,4 @@ void Parser::fatal(unsigned index, const char *format, ...)
va_end
(
ap
);
va_end
(
args
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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