Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tobias Hunger
qt-creator
Commits
fefd72b2
Commit
fefd72b2
authored
Oct 27, 2009
by
Roberto Raggi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduced CPlusPlus::FindUsages.
parent
83a7e0f5
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
583 additions
and
447 deletions
+583
-447
src/libs/cplusplus/FindUsages.cpp
src/libs/cplusplus/FindUsages.cpp
+444
-0
src/libs/cplusplus/FindUsages.h
src/libs/cplusplus/FindUsages.h
+121
-0
src/libs/cplusplus/cplusplus-lib.pri
src/libs/cplusplus/cplusplus-lib.pri
+2
-0
src/plugins/cpptools/cppfindreferences.cpp
src/plugins/cpptools/cppfindreferences.cpp
+11
-446
src/plugins/cpptools/cppfindreferences.h
src/plugins/cpptools/cppfindreferences.h
+5
-1
No files found.
src/libs/cplusplus/FindUsages.cpp
0 → 100644
View file @
fefd72b2
This diff is collapsed.
Click to expand it.
src/libs/cplusplus/FindUsages.h
0 → 100644
View file @
fefd72b2
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef FINDUSAGES_H
#define FINDUSAGES_H
#include "LookupContext.h"
#include "CppDocument.h"
#include "CppBindings.h"
#include "Semantic.h"
#include <ASTVisitor.h>
#include <QtCore/QFutureInterface>
namespace
CPlusPlus
{
class
CPLUSPLUS_EXPORT
Usage
{
public:
Usage
()
:
line
(
0
),
col
(
0
),
len
(
0
)
{}
Usage
(
const
QString
&
path
,
int
line
,
const
QString
&
lineText
,
int
col
,
int
len
)
:
path
(
path
),
line
(
line
),
lineText
(
lineText
),
col
(
col
),
len
(
len
)
{}
public:
QString
path
;
int
line
;
QString
lineText
;
int
col
;
int
len
;
};
class
CPLUSPLUS_EXPORT
FindUsages
:
protected
ASTVisitor
{
public:
FindUsages
(
Document
::
Ptr
doc
,
const
Snapshot
&
snapshot
,
QFutureInterface
<
Usage
>
*
future
);
void
setGlobalNamespaceBinding
(
NamespaceBindingPtr
globalNamespaceBinding
);
QList
<
int
>
operator
()(
Symbol
*
symbol
,
Identifier
*
id
,
AST
*
ast
);
protected:
using
ASTVisitor
::
visit
;
using
ASTVisitor
::
endVisit
;
QString
matchingLine
(
const
Token
&
tk
)
const
;
void
reportResult
(
unsigned
tokenIndex
,
const
QList
<
Symbol
*>
&
candidates
);
void
reportResult
(
unsigned
tokenIndex
);
bool
checkSymbol
(
Symbol
*
symbol
)
const
;
bool
checkCandidates
(
const
QList
<
Symbol
*>
&
candidates
)
const
;
bool
checkScope
(
Symbol
*
symbol
,
Symbol
*
otherSymbol
)
const
;
void
checkExpression
(
unsigned
startToken
,
unsigned
endToken
);
LookupContext
currentContext
(
AST
*
ast
);
void
ensureNameIsValid
(
NameAST
*
ast
);
virtual
bool
visit
(
MemInitializerAST
*
ast
);
virtual
bool
visit
(
PostfixExpressionAST
*
ast
);
virtual
void
endVisit
(
PostfixExpressionAST
*
);
virtual
bool
visit
(
MemberAccessAST
*
ast
);
virtual
bool
visit
(
QualifiedNameAST
*
ast
);
virtual
bool
visit
(
EnumeratorAST
*
ast
);
virtual
bool
visit
(
SimpleNameAST
*
ast
);
virtual
bool
visit
(
DestructorNameAST
*
ast
);
virtual
bool
visit
(
TemplateIdAST
*
ast
);
virtual
bool
visit
(
ParameterDeclarationAST
*
ast
);
virtual
bool
visit
(
ExpressionOrDeclarationStatementAST
*
ast
);
virtual
bool
visit
(
FunctionDeclaratorAST
*
ast
);
virtual
bool
visit
(
SimpleDeclarationAST
*
);
virtual
void
endVisit
(
SimpleDeclarationAST
*
);
private:
QFutureInterface
<
Usage
>
*
_future
;
Identifier
*
_id
;
Symbol
*
_declSymbol
;
Document
::
Ptr
_doc
;
Snapshot
_snapshot
;
QByteArray
_source
;
Document
::
Ptr
_exprDoc
;
Semantic
_sem
;
NamespaceBindingPtr
_globalNamespaceBinding
;
QList
<
PostfixExpressionAST
*>
_postfixExpressionStack
;
QList
<
QualifiedNameAST
*>
_qualifiedNameStack
;
QList
<
int
>
_references
;
LookupContext
_previousContext
;
int
_inSimpleDeclaration
;
};
}
// end of namespace CPlusPlus
#endif // FINDUSAGES_H
src/libs/cplusplus/cplusplus-lib.pri
View file @
fefd72b2
...
...
@@ -38,6 +38,7 @@ HEADERS += \
$$PWD/CppBindings.h \
$$PWD/ASTParent.h \
$$PWD/GenTemplateInstance.h \
$$PWD/FindUsages.h \
$$PWD/CheckUndefinedSymbols.h \
$$PWD/PreprocessorClient.h \
$$PWD/PreprocessorEnvironment.h \
...
...
@@ -61,6 +62,7 @@ SOURCES += \
$$PWD/CppBindings.cpp \
$$PWD/ASTParent.cpp \
$$PWD/GenTemplateInstance.cpp \
$$PWD/FindUsages.cpp \
$$PWD/CheckUndefinedSymbols.cpp \
$$PWD/PreprocessorClient.cpp \
$$PWD/PreprocessorEnvironment.cpp \
...
...
src/plugins/cpptools/cppfindreferences.cpp
View file @
fefd72b2
This diff is collapsed.
Click to expand it.
src/plugins/cpptools/cppfindreferences.h
View file @
fefd72b2
...
...
@@ -42,6 +42,10 @@ namespace Find {
struct
SearchResultItem
;
}
// end of namespace Find
namespace
CPlusPlus
{
class
Usage
;
}
// end of namespace CPlusPlus
namespace
CppTools
{
class
CppModelManagerInterface
;
...
...
@@ -78,7 +82,7 @@ private:
private:
QPointer
<
CppModelManagerInterface
>
_modelManager
;
Find
::
SearchResultWindow
*
_resultWindow
;
QFutureWatcher
<
Utils
::
FileSearchResult
>
m_watcher
;
QFutureWatcher
<
CPlusPlus
::
Usage
>
m_watcher
;
};
}
// end of namespace Internal
...
...
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