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
a444cdc7
Commit
a444cdc7
authored
Jan 11, 2011
by
con
Browse files
Limit depth of include scanning to avoid performance problems.
Reviewed-by: Thorbjørn Lindeijer
parent
d1023c76
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/cpptools/cppmodelmanager.cpp
View file @
a444cdc7
...
...
@@ -1211,6 +1211,13 @@ void CppModelManager::updateIncludesInPaths(QFutureInterface<void> &future,
future
.
setProgressRange
(
0
,
paths
.
size
());
static
const
int
MAX_DEPTH
=
3
;
QList
<
int
>
pathDepths
;
pathDepths
.
reserve
(
paths
.
size
());
for
(
int
i
=
0
;
i
<
paths
.
size
();
++
i
)
{
pathDepths
.
append
(
0
);
}
// Add framework header directories to path list
QStringList
frameworkFilter
;
frameworkFilter
<<
QLatin1String
(
"*.framework"
);
...
...
@@ -1223,6 +1230,7 @@ void CppModelManager::updateIncludesInPaths(QFutureInterface<void> &future,
while
(
fwIt
.
hasNext
())
{
QString
framework
=
fwIt
.
next
();
paths
.
append
(
fwPath
+
QLatin1Char
(
'/'
)
+
framework
+
QLatin1String
(
"/Headers"
));
pathDepths
.
append
(
0
);
framework
.
chop
(
10
);
// remove the ".framework"
entriesInFrameworkPath
.
append
(
framework
+
QLatin1Char
(
'/'
));
}
...
...
@@ -1237,9 +1245,7 @@ void CppModelManager::updateIncludesInPaths(QFutureInterface<void> &future,
return
;
const
QString
path
=
paths
.
takeFirst
();
if
(
path
==
QLatin1String
(
"/"
))
continue
;
const
int
depth
=
pathDepths
.
takeFirst
();
// Skip non-existing paths
if
(
!
QFile
::
exists
(
path
))
...
...
@@ -1256,7 +1262,7 @@ void CppModelManager::updateIncludesInPaths(QFutureInterface<void> &future,
const
QString
fileName
=
i
.
next
();
const
QFileInfo
fileInfo
=
i
.
fileInfo
();
QString
text
=
fileInfo
.
fileName
();
if
(
fileInfo
.
isDir
())
{
if
(
depth
<
MAX_DEPTH
&&
fileInfo
.
isDir
())
{
text
+=
QLatin1Char
(
'/'
);
// Also scan subdirectory, but avoid endless recursion with symbolic links
...
...
@@ -1272,10 +1278,12 @@ void CppModelManager::updateIncludesInPaths(QFutureInterface<void> &future,
entriesInPaths
.
insert
(
fileName
,
result
.
value
());
}
else
{
paths
.
append
(
target
);
pathDepths
.
append
(
depth
+
1
);
symlinks
.
append
(
SymLink
(
fileName
,
target
));
}
}
else
{
paths
.
append
(
fileName
);
pathDepths
.
append
(
depth
+
1
);
}
entries
.
append
(
text
);
}
else
{
...
...
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