summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-07-24 19:28:33 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-20 22:55:59 +0200
commit0a1faaa9eb7807bf11d796c2eca624e2f3b378a7 (patch)
tree9852be17658bccce6395b805c5b58dfeb544024a /qmake
parent725bdc3fd2f88c7f49f59a151579fd128cf543dc (diff)
avoid boolean argument trap: introduce QMakeParser::ParseFlag
Change-Id: I26ce032a1aa044e9a4da0c8708a4490b07374992 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> (cherry picked from qttools/066b08fc62c67d586996ea4e272ef05dd3865fac) (cherry picked from qttools/226f013441990aa4a58f7c82e284057cff659959)
Diffstat (limited to 'qmake')
-rw-r--r--qmake/library/qmakeevaluator.cpp2
-rw-r--r--qmake/library/qmakeparser.cpp4
-rw-r--r--qmake/library/qmakeparser.h10
3 files changed, 12 insertions, 4 deletions
diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp
index 7c20bb8492..386bd6cc40 100644
--- a/qmake/library/qmakeevaluator.cpp
+++ b/qmake/library/qmakeevaluator.cpp
@@ -1819,7 +1819,7 @@ ProString QMakeEvaluator::first(const ProKey &variableName) const
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFile(
const QString &fileName, QMakeHandler::EvalFileType type, LoadFlags flags)
{
- if (ProFile *pro = m_parser->parsedProFile(fileName, true)) {
+ if (ProFile *pro = m_parser->parsedProFile(fileName, QMakeParser::ParseUseCache)) {
m_locationStack.push(m_current);
VisitReturn ok = visitProFile(pro, type, flags);
m_current = m_locationStack.pop();
diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp
index 35533864eb..67594625dc 100644
--- a/qmake/library/qmakeparser.cpp
+++ b/qmake/library/qmakeparser.cpp
@@ -152,10 +152,10 @@ QMakeParser::QMakeParser(ProFileCache *cache, QMakeVfs *vfs, QMakeParserHandler
initialize();
}
-ProFile *QMakeParser::parsedProFile(const QString &fileName, bool cache)
+ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags)
{
ProFile *pro;
- if (cache && m_cache) {
+ if ((flags & ParseUseCache) && m_cache) {
ProFileCache::Entry *ent;
#ifdef PROPARSER_THREAD_SAFE
QMutexLocker locker(&m_cache->mutex);
diff --git a/qmake/library/qmakeparser.h b/qmake/library/qmakeparser.h
index e3da05cc9e..e9b0b76b3c 100644
--- a/qmake/library/qmakeparser.h
+++ b/qmake/library/qmakeparser.h
@@ -87,11 +87,17 @@ public:
// Call this from a concurrency-free context
static void initialize();
+ enum ParseFlag {
+ ParseDefault = 0,
+ ParseUseCache = 1
+ };
+ Q_DECLARE_FLAGS(ParseFlags, ParseFlag)
+
QMakeParser(ProFileCache *cache, QMakeVfs *vfs, QMakeParserHandler *handler);
enum SubGrammar { FullGrammar, TestGrammar, ValueGrammar };
// fileName is expected to be absolute and cleanPath()ed.
- ProFile *parsedProFile(const QString &fileName, bool cache = false);
+ ProFile *parsedProFile(const QString &fileName, ParseFlags flags = ParseDefault);
ProFile *parsedProBlock(const QString &contents, const QString &name, int line = 0,
SubGrammar grammar = FullGrammar);
@@ -184,6 +190,8 @@ private:
friend class ProFileCache;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QMakeParser::ParseFlags)
+
class QMAKE_EXPORT ProFileCache
{
public: