Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
3e440ec2
Commit
3e440ec2
authored
May 10, 2010
by
Roberto Raggi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache the resolved file names.
parent
2e7e4fc9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
6 deletions
+24
-6
src/plugins/cpptools/cppmodelmanager.cpp
src/plugins/cpptools/cppmodelmanager.cpp
+22
-6
src/plugins/cpptools/cppmodelmanager.h
src/plugins/cpptools/cppmodelmanager.h
+2
-0
No files found.
src/plugins/cpptools/cppmodelmanager.cpp
View file @
3e440ec2
...
...
@@ -397,6 +397,28 @@ bool CppPreprocessor::includeFile(const QString &absoluteFilePath, QString *resu
}
QString
CppPreprocessor
::
tryIncludeFile
(
QString
&
fileName
,
IncludeType
type
,
unsigned
*
revision
)
{
if
(
type
==
IncludeGlobal
)
{
const
QString
fn
=
m_fileNameCache
.
value
(
fileName
);
if
(
!
fn
.
isEmpty
())
{
fileName
=
fn
;
if
(
revision
)
*
revision
=
0
;
return
QString
();
}
}
const
QString
originalFileName
=
fileName
;
const
QString
contents
=
tryIncludeFile_helper
(
fileName
,
type
,
revision
);
if
(
type
==
IncludeGlobal
)
m_fileNameCache
.
insert
(
originalFileName
,
fileName
);
return
contents
;
}
QString
CppPreprocessor
::
tryIncludeFile_helper
(
QString
&
fileName
,
IncludeType
type
,
unsigned
*
revision
)
{
QFileInfo
fileInfo
(
fileName
);
if
(
fileName
==
QLatin1String
(
pp_configuration_file
)
||
fileInfo
.
isAbsolute
())
{
...
...
@@ -1375,9 +1397,6 @@ void CppModelManager::parse(QFutureInterface<void> &future,
if
(
future
.
isCanceled
())
break
;
// Change the priority of the background parser thread to idle.
QThread
::
currentThread
()
->
setPriority
(
QThread
::
IdlePriority
);
const
QString
fileName
=
files
.
at
(
i
);
const
bool
isSourceFile
=
i
<
sourceCount
;
...
...
@@ -1396,9 +1415,6 @@ void CppModelManager::parse(QFutureInterface<void> &future,
if
(
isSourceFile
)
preproc
->
resetEnvironment
();
// Restore the previous thread priority.
QThread
::
currentThread
()
->
setPriority
(
QThread
::
NormalPriority
);
}
future
.
setProgressValue
(
files
.
size
());
...
...
src/plugins/cpptools/cppmodelmanager.h
View file @
3e440ec2
...
...
@@ -270,6 +270,7 @@ protected:
bool
includeFile
(
const
QString
&
absoluteFilePath
,
QString
*
result
,
unsigned
*
revision
);
QString
tryIncludeFile
(
QString
&
fileName
,
IncludeType
type
,
unsigned
*
revision
);
QString
tryIncludeFile_helper
(
QString
&
fileName
,
IncludeType
type
,
unsigned
*
revision
);
void
mergeEnvironment
(
CPlusPlus
::
Document
::
Ptr
doc
);
...
...
@@ -303,6 +304,7 @@ private:
QSet
<
QString
>
m_todo
;
QSet
<
QString
>
m_processed
;
unsigned
m_revision
;
QHash
<
QString
,
QString
>
m_fileNameCache
;
};
}
// 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