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
67227437
Commit
67227437
authored
Aug 05, 2010
by
Roberto Raggi
Browse files
Use the most recent snapshot when searching for the usages of a symbol.
parent
ccf32449
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/cppeditor/cppeditor.cpp
View file @
67227437
...
...
@@ -619,7 +619,9 @@ const Macro *CPPEditor::findCanonicalMacro(const QTextCursor &cursor, Document::
void
CPPEditor
::
findUsages
()
{
const
SemanticInfo
info
=
m_lastSemanticInfo
;
SemanticInfo
info
=
m_lastSemanticInfo
;
info
.
snapshot
=
CppTools
::
CppModelManagerInterface
::
instance
()
->
snapshot
();
info
.
snapshot
.
insert
(
info
.
doc
);
CanonicalSymbol
cs
(
this
,
info
);
Symbol
*
canonicalSymbol
=
cs
(
textCursor
());
...
...
@@ -630,6 +632,28 @@ void CPPEditor::findUsages()
}
}
void
CPPEditor
::
renameUsagesNow
(
const
QString
&
replacement
)
{
SemanticInfo
info
=
m_lastSemanticInfo
;
info
.
snapshot
=
CppTools
::
CppModelManagerInterface
::
instance
()
->
snapshot
();
info
.
snapshot
.
insert
(
info
.
doc
);
CanonicalSymbol
cs
(
this
,
info
);
if
(
Symbol
*
canonicalSymbol
=
cs
(
textCursor
()))
{
if
(
canonicalSymbol
->
identifier
()
!=
0
)
{
if
(
showWarningMessage
())
{
Core
::
EditorManager
::
instance
()
->
showEditorInfoBar
(
QLatin1String
(
"CppEditor.Rename"
),
tr
(
"This change cannot be undone."
),
tr
(
"Yes, I know what I am doing."
),
this
,
SLOT
(
hideRenameNotification
()));
}
m_modelManager
->
renameUsages
(
canonicalSymbol
,
cs
.
context
(),
replacement
);
}
}
}
void
CPPEditor
::
renameUsages
()
{
renameUsagesNow
();
...
...
@@ -664,25 +688,6 @@ void CPPEditor::hideRenameNotification()
Core
::
EditorManager
::
instance
()
->
hideEditorInfoBar
(
QLatin1String
(
"CppEditor.Rename"
));
}
void
CPPEditor
::
renameUsagesNow
(
const
QString
&
replacement
)
{
const
SemanticInfo
info
=
m_lastSemanticInfo
;
CanonicalSymbol
cs
(
this
,
info
);
if
(
Symbol
*
canonicalSymbol
=
cs
(
textCursor
()))
{
if
(
canonicalSymbol
->
identifier
()
!=
0
)
{
if
(
showWarningMessage
())
{
Core
::
EditorManager
::
instance
()
->
showEditorInfoBar
(
QLatin1String
(
"CppEditor.Rename"
),
tr
(
"This change cannot be undone."
),
tr
(
"Yes, I know what I am doing."
),
this
,
SLOT
(
hideRenameNotification
()));
}
m_modelManager
->
renameUsages
(
canonicalSymbol
,
cs
.
context
(),
replacement
);
}
}
}
void
CPPEditor
::
markSymbolsNow
()
{
if
(
m_references
.
isCanceled
())
...
...
src/plugins/cpptools/cppfindreferences.cpp
View file @
67227437
...
...
@@ -176,9 +176,6 @@ static void find_helper(QFutureInterface<Usage> &future,
const
DependencyTable
dependencyTable
,
Symbol
*
symbol
)
{
QTime
tm
;
tm
.
start
();
const
Identifier
*
symbolId
=
symbol
->
identifier
();
Q_ASSERT
(
symbolId
!=
0
);
...
...
@@ -200,7 +197,6 @@ static void find_helper(QFutureInterface<Usage> &future,
files
+=
dependencyTable
.
filesDependingOn
(
sourceFile
);
}
files
.
removeDuplicates
();
//qDebug() << "done in:" << tm.elapsed() << "number of files to parse:" << files.size();
future
.
setProgressRange
(
0
,
files
.
size
());
...
...
@@ -212,7 +208,7 @@ static void find_helper(QFutureInterface<Usage> &future,
future
.
setProgressValue
(
files
.
size
());
}
static
CPlusPlus
::
DependencyTable
dependencyTable
(
DependencyTable
previous
,
CPlusPlus
::
Snapshot
snapshot
)
static
CPlusPlus
::
DependencyTable
dependencyTable
(
DependencyTable
previous
,
const
CPlusPlus
::
Snapshot
&
snapshot
)
{
if
(
previous
.
isValidFor
(
snapshot
))
return
previous
;
...
...
@@ -264,7 +260,6 @@ void CppFindReferences::findAll_helper(Symbol *symbol, const LookupContext &cont
_resultWindow
->
popup
(
true
);
const
Snapshot
snapshot
=
_modelManager
->
snapshot
();
const
CppTools
::
CppModelManagerInterface
::
WorkingCopy
workingCopy
=
_modelManager
->
workingCopy
();
Core
::
ProgressManager
*
progressManager
=
Core
::
ICore
::
instance
()
->
progressManager
();
...
...
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