summaryrefslogtreecommitdiffstats
path: root/qmake/generators/win32/msvc_objectmodel.cpp
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@digia.com>2014-09-23 18:44:02 +0200
committerJoerg Bornemann <joerg.bornemann@digia.com>2014-09-29 16:08:54 +0200
commit55027c23df76444a128411cfb3ef011f65b40a64 (patch)
treee468ca32d14c8cd8afdba3aaaf2ce14ec756c0a4 /qmake/generators/win32/msvc_objectmodel.cpp
parenta8aad121a2f8450c77d314542722a0b57e411c10 (diff)
introduce VCFilter::findFile
Move common code into a function and exit early from simple search loop. Change-Id: I88d1227653e28badc213fbe4ebe1e2a19f6e5793 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'qmake/generators/win32/msvc_objectmodel.cpp')
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index 75134d9182..f174b654d7 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -2241,6 +2241,19 @@ void VCFilter::modifyPCHstage(QString str)
CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)");
}
+VCFilterFile VCFilter::findFile(const QString &filePath, bool *found) const
+{
+ for (int i = 0; i < Files.count(); ++i) {
+ const VCFilterFile &f = Files.at(i);
+ if (f.file == filePath) {
+ *found = true;
+ return f;
+ }
+ }
+ *found = false;
+ return VCFilterFile();
+}
+
bool VCFilter::addExtraCompiler(const VCFilterFile &info)
{
const QStringList &extraCompilers = Project->extraCompilerSources.value(info.file);
@@ -2974,14 +2987,8 @@ void VCProjectWriter::outputFileConfig(VCFilter &filter, XmlOutput &xml, const Q
filter.CompilerTool.WarningLevel = warningLevelUnknown;
filter.CompilerTool.config = filter.Config;
- bool inBuild = false;
- VCFilterFile info;
- for (int i = 0; i < filter.Files.count(); ++i) {
- if (filter.Files.at(i).file == filename) {
- info = filter.Files.at(i);
- inBuild = true;
- }
- }
+ bool inBuild;
+ VCFilterFile info = filter.findFile(filename, &inBuild);
inBuild &= !info.excludeFromBuild;
if (inBuild) {