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
Marco Bubke
flatpak-qt-creator
Commits
3d656df2
Commit
3d656df2
authored
Jul 13, 2010
by
Roberto Raggi
Browse files
Renamed CheckUndefinedSymbols.
parent
e8c0d0c1
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/plugins/cppeditor/cppcheck
undefined
symbols.cpp
→
src/plugins/cppeditor/cppchecksymbols.cpp
View file @
3d656df2
...
...
@@ -27,7 +27,7 @@
**
**************************************************************************/
#include "cppcheck
undefined
symbols.h"
#include "cppchecksymbols.h"
#include <cplusplus/Overview.h>
#include <Names.h>
...
...
@@ -255,13 +255,13 @@ protected:
}
// end of anonymous namespace
Check
Undefined
Symbols
::
Future
Check
Undefined
Symbols
::
go
(
Document
::
Ptr
doc
,
const
LookupContext
&
context
)
CheckSymbols
::
Future
CheckSymbols
::
go
(
Document
::
Ptr
doc
,
const
LookupContext
&
context
)
{
Q_ASSERT
(
doc
);
return
(
new
Check
Undefined
Symbols
(
doc
,
context
))
->
start
();
return
(
new
CheckSymbols
(
doc
,
context
))
->
start
();
}
Check
Undefined
Symbols
::
Check
Undefined
Symbols
(
Document
::
Ptr
doc
,
const
LookupContext
&
context
)
CheckSymbols
::
CheckSymbols
(
Document
::
Ptr
doc
,
const
LookupContext
&
context
)
:
ASTVisitor
(
doc
->
translationUnit
()),
_doc
(
doc
),
_context
(
context
)
{
_fileName
=
doc
->
fileName
();
...
...
@@ -270,10 +270,10 @@ CheckUndefinedSymbols::CheckUndefinedSymbols(Document::Ptr doc, const LookupCont
_scopes
=
collectTypes
.
scopes
();
}
Check
Undefined
Symbols
::~
Check
Undefined
Symbols
()
CheckSymbols
::~
CheckSymbols
()
{
}
void
Check
Undefined
Symbols
::
run
()
void
CheckSymbols
::
run
()
{
if
(
!
isCanceled
())
runFunctor
();
...
...
@@ -281,7 +281,7 @@ void CheckUndefinedSymbols::run()
reportFinished
();
}
void
Check
Undefined
Symbols
::
runFunctor
()
void
CheckSymbols
::
runFunctor
()
{
_diagnosticMessages
.
clear
();
...
...
@@ -291,14 +291,14 @@ void CheckUndefinedSymbols::runFunctor()
}
}
bool
Check
Undefined
Symbols
::
warning
(
unsigned
line
,
unsigned
column
,
const
QString
&
text
,
unsigned
length
)
bool
CheckSymbols
::
warning
(
unsigned
line
,
unsigned
column
,
const
QString
&
text
,
unsigned
length
)
{
Document
::
DiagnosticMessage
m
(
Document
::
DiagnosticMessage
::
Warning
,
_fileName
,
line
,
column
,
text
,
length
);
_diagnosticMessages
.
append
(
m
);
return
false
;
}
bool
Check
Undefined
Symbols
::
warning
(
AST
*
ast
,
const
QString
&
text
)
bool
CheckSymbols
::
warning
(
AST
*
ast
,
const
QString
&
text
)
{
const
Token
&
firstToken
=
tokenAt
(
ast
->
firstToken
());
const
Token
&
lastToken
=
tokenAt
(
ast
->
lastToken
()
-
1
);
...
...
@@ -311,7 +311,7 @@ bool CheckUndefinedSymbols::warning(AST *ast, const QString &text)
return
false
;
}
bool
Check
Undefined
Symbols
::
preVisit
(
AST
*
)
bool
CheckSymbols
::
preVisit
(
AST
*
)
{
if
(
isCanceled
())
return
false
;
...
...
@@ -319,7 +319,7 @@ bool CheckUndefinedSymbols::preVisit(AST *)
return
true
;
}
bool
Check
Undefined
Symbols
::
visit
(
NamespaceAST
*
ast
)
bool
CheckSymbols
::
visit
(
NamespaceAST
*
ast
)
{
if
(
ast
->
identifier_token
)
{
const
Token
&
tok
=
tokenAt
(
ast
->
identifier_token
);
...
...
@@ -334,22 +334,22 @@ bool CheckUndefinedSymbols::visit(NamespaceAST *ast)
return
true
;
}
bool
Check
Undefined
Symbols
::
visit
(
UsingDirectiveAST
*
)
bool
CheckSymbols
::
visit
(
UsingDirectiveAST
*
)
{
return
true
;
}
bool
Check
Undefined
Symbols
::
visit
(
SimpleDeclarationAST
*
)
bool
CheckSymbols
::
visit
(
SimpleDeclarationAST
*
)
{
return
true
;
}
bool
Check
Undefined
Symbols
::
visit
(
NamedTypeSpecifierAST
*
)
bool
CheckSymbols
::
visit
(
NamedTypeSpecifierAST
*
)
{
return
true
;
}
void
Check
Undefined
Symbols
::
checkNamespace
(
NameAST
*
name
)
void
CheckSymbols
::
checkNamespace
(
NameAST
*
name
)
{
if
(
!
name
)
return
;
...
...
@@ -369,7 +369,7 @@ void CheckUndefinedSymbols::checkNamespace(NameAST *name)
warning
(
line
,
column
,
QCoreApplication
::
translate
(
"CheckUndefinedSymbols"
,
"Expected a namespace-name"
),
length
);
}
void
Check
Undefined
Symbols
::
checkName
(
NameAST
*
ast
)
void
CheckSymbols
::
checkName
(
NameAST
*
ast
)
{
if
(
ast
&&
ast
->
name
)
{
if
(
const
Identifier
*
ident
=
ast
->
name
->
identifier
())
{
...
...
@@ -383,25 +383,25 @@ void CheckUndefinedSymbols::checkName(NameAST *ast)
}
}
bool
Check
Undefined
Symbols
::
visit
(
SimpleNameAST
*
ast
)
bool
CheckSymbols
::
visit
(
SimpleNameAST
*
ast
)
{
checkName
(
ast
);
return
true
;
}
bool
Check
Undefined
Symbols
::
visit
(
TemplateIdAST
*
ast
)
bool
CheckSymbols
::
visit
(
TemplateIdAST
*
ast
)
{
checkName
(
ast
);
return
true
;
}
bool
Check
Undefined
Symbols
::
visit
(
DestructorNameAST
*
ast
)
bool
CheckSymbols
::
visit
(
DestructorNameAST
*
ast
)
{
checkName
(
ast
);
return
true
;
}
bool
Check
Undefined
Symbols
::
visit
(
QualifiedNameAST
*
ast
)
bool
CheckSymbols
::
visit
(
QualifiedNameAST
*
ast
)
{
if
(
ast
->
name
)
{
Scope
*
scope
=
findScope
(
ast
);
...
...
@@ -439,7 +439,7 @@ bool CheckUndefinedSymbols::visit(QualifiedNameAST *ast)
return
false
;
}
bool
Check
Undefined
Symbols
::
visit
(
TypenameTypeParameterAST
*
ast
)
bool
CheckSymbols
::
visit
(
TypenameTypeParameterAST
*
ast
)
{
if
(
ast
->
name
&&
ast
->
name
->
name
)
{
if
(
const
Identifier
*
templId
=
ast
->
name
->
name
->
identifier
())
{
...
...
@@ -454,24 +454,24 @@ bool CheckUndefinedSymbols::visit(TypenameTypeParameterAST *ast)
return
true
;
}
bool
Check
Undefined
Symbols
::
visit
(
TemplateTypeParameterAST
*
ast
)
bool
CheckSymbols
::
visit
(
TemplateTypeParameterAST
*
ast
)
{
checkName
(
ast
->
name
);
return
true
;
}
bool
Check
Undefined
Symbols
::
visit
(
TemplateDeclarationAST
*
ast
)
bool
CheckSymbols
::
visit
(
TemplateDeclarationAST
*
ast
)
{
_templateDeclarationStack
.
append
(
ast
);
return
true
;
}
void
Check
Undefined
Symbols
::
endVisit
(
TemplateDeclarationAST
*
)
void
CheckSymbols
::
endVisit
(
TemplateDeclarationAST
*
)
{
_templateDeclarationStack
.
takeFirst
();
}
void
Check
Undefined
Symbols
::
addTypeUsage
(
const
Use
&
use
)
void
CheckSymbols
::
addTypeUsage
(
const
Use
&
use
)
{
_typeUsages
.
append
(
use
);
...
...
@@ -479,7 +479,7 @@ void CheckUndefinedSymbols::addTypeUsage(const Use &use)
flush
();
}
void
Check
Undefined
Symbols
::
addTypeUsage
(
ClassOrNamespace
*
b
,
NameAST
*
ast
)
void
CheckSymbols
::
addTypeUsage
(
ClassOrNamespace
*
b
,
NameAST
*
ast
)
{
if
(
!
b
)
return
;
...
...
@@ -500,7 +500,7 @@ void CheckUndefinedSymbols::addTypeUsage(ClassOrNamespace *b, NameAST *ast)
//qDebug() << "added use" << oo(ast->name) << line << column << length;
}
void
Check
Undefined
Symbols
::
addTypeUsage
(
const
QList
<
Symbol
*>
&
candidates
,
NameAST
*
ast
)
void
CheckSymbols
::
addTypeUsage
(
const
QList
<
Symbol
*>
&
candidates
,
NameAST
*
ast
)
{
unsigned
startToken
=
ast
->
firstToken
();
if
(
DestructorNameAST
*
dtor
=
ast
->
asDestructorName
())
...
...
@@ -530,7 +530,7 @@ void CheckUndefinedSymbols::addTypeUsage(const QList<Symbol *> &candidates, Name
}
}
unsigned
Check
Undefined
Symbols
::
startOfTemplateDeclaration
(
TemplateDeclarationAST
*
ast
)
const
unsigned
CheckSymbols
::
startOfTemplateDeclaration
(
TemplateDeclarationAST
*
ast
)
const
{
if
(
ast
->
declaration
)
{
if
(
TemplateDeclarationAST
*
templ
=
ast
->
declaration
->
asTemplateDeclaration
())
...
...
@@ -542,7 +542,7 @@ unsigned CheckUndefinedSymbols::startOfTemplateDeclaration(TemplateDeclarationAS
return
ast
->
firstToken
();
}
Scope
*
Check
Undefined
Symbols
::
findScope
(
AST
*
ast
)
const
Scope
*
CheckSymbols
::
findScope
(
AST
*
ast
)
const
{
Scope
*
scope
=
0
;
...
...
@@ -561,7 +561,7 @@ Scope *CheckUndefinedSymbols::findScope(AST *ast) const
return
scope
;
}
void
Check
Undefined
Symbols
::
flush
()
void
CheckSymbols
::
flush
()
{
if
(
_typeUsages
.
isEmpty
())
return
;
...
...
src/plugins/cppeditor/cppcheck
undefined
symbols.h
→
src/plugins/cppeditor/cppchecksymbols.h
View file @
3d656df2
...
...
@@ -27,8 +27,8 @@
**
**************************************************************************/
#ifndef CPLUSPLUS_CHECK
UNDEFINED
SYMBOLS_H
#define CPLUSPLUS_CHECK
UNDEFINED
SYMBOLS_H
#ifndef CPLUSPLUS_CHECKSYMBOLS_H
#define CPLUSPLUS_CHECKSYMBOLS_H
#include "cppsemanticinfo.h"
...
...
@@ -41,12 +41,12 @@
namespace
CPlusPlus
{
class
Check
Undefined
Symbols
:
class
CheckSymbols
:
protected
ASTVisitor
,
public
QtConcurrent
::
RunFunctionTaskBase
<
CppEditor
::
Internal
::
SemanticInfo
::
Use
>
{
public:
virtual
~
Check
Undefined
Symbols
();
virtual
~
CheckSymbols
();
typedef
CppEditor
::
Internal
::
SemanticInfo
::
Use
Use
;
...
...
@@ -76,7 +76,7 @@ protected:
using
ASTVisitor
::
visit
;
using
ASTVisitor
::
endVisit
;
Check
Undefined
Symbols
(
Document
::
Ptr
doc
,
const
LookupContext
&
context
);
CheckSymbols
(
Document
::
Ptr
doc
,
const
LookupContext
&
context
);
bool
warning
(
unsigned
line
,
unsigned
column
,
const
QString
&
text
,
unsigned
length
=
0
);
bool
warning
(
AST
*
ast
,
const
QString
&
text
);
...
...
@@ -123,4 +123,4 @@ private:
}
// end of namespace CPlusPlus
#endif // CPLUSPLUS_CHECK
UNDEFINED
SYMBOLS_H
#endif // CPLUSPLUS_CHECKSYMBOLS_H
src/plugins/cppeditor/cppeditor.cpp
View file @
3d656df2
...
...
@@ -31,10 +31,8 @@
#include "cppeditorconstants.h"
#include "cppplugin.h"
#include "cpphighlighter.h"
#include "cppcheckundefinedsymbols.h"
#include "cppchecksymbols.h"
#include "cppquickfix.h"
#include <cpptools/cpptoolsplugin.h>
#include <AST.h>
#include <Control.h>
...
...
@@ -57,6 +55,7 @@
#include <cplusplus/BackwardsScanner.h>
#include <cplusplus/FastPreprocessor.h>
#include <cpptools/cpptoolsplugin.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cpptoolsconstants.h>
#include <cpptools/cppcodeformatter.h>
...
...
@@ -1128,7 +1127,7 @@ void CPPEditor::highlightTypeUsages(int from, int to)
if
(
m_nextHighlightBlockNumber
>=
doc
->
blockCount
())
return
;
QMap
<
int
,
QVector
<
SemanticInfo
::
Use
>
>
chunks
=
Check
Undefined
Symbols
::
chunks
(
m_highlighter
,
from
,
to
);
QMap
<
int
,
QVector
<
SemanticInfo
::
Use
>
>
chunks
=
CheckSymbols
::
chunks
(
m_highlighter
,
from
,
to
);
Q_ASSERT
(
!
chunks
.
isEmpty
());
QTextBlock
b
=
doc
->
findBlockByNumber
(
m_nextHighlightBlockNumber
);
...
...
@@ -1977,7 +1976,7 @@ void CPPEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
if
(
semanticInfo
.
doc
)
{
LookupContext
context
(
semanticInfo
.
doc
,
semanticInfo
.
snapshot
);
Check
Undefined
Symbols
::
Future
f
=
Check
Undefined
Symbols
::
go
(
semanticInfo
.
doc
,
context
);
CheckSymbols
::
Future
f
=
CheckSymbols
::
go
(
semanticInfo
.
doc
,
context
);
m_highlighter
=
f
;
m_highlightRevision
=
semanticInfo
.
revision
;
m_nextHighlightBlockNumber
=
0
;
...
...
src/plugins/cppeditor/cppeditor.pro
View file @
3d656df2
...
...
@@ -17,7 +17,7 @@ HEADERS += cppplugin.h \
cppclasswizard
.
h
\
cppquickfix
.
h
\
cpprefactoringchanges
.
h
\
cppcheck
undefined
symbols
.
h
\
cppchecksymbols
.
h
\
cppsemanticinfo
.
h
\
cppoutline
.
h
\
cppdeclfromdef
.
h
...
...
@@ -30,7 +30,7 @@ SOURCES += cppplugin.cpp \
cppclasswizard
.
cpp
\
cppquickfix
.
cpp
\
cpprefactoringchanges
.
cpp
\
cppcheck
undefined
symbols
.
cpp
\
cppchecksymbols
.
cpp
\
cppsemanticinfo
.
cpp
\
cppoutline
.
cpp
\
cppdeclfromdef
.
cpp
...
...
Write
Preview
Supports
Markdown
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