summaryrefslogtreecommitdiffstats
path: root/qmake/library/qmakeparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qmake/library/qmakeparser.cpp')
-rw-r--r--qmake/library/qmakeparser.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp
index 78350c76c4..b5d89c1ba6 100644
--- a/qmake/library/qmakeparser.cpp
+++ b/qmake/library/qmakeparser.cpp
@@ -167,7 +167,7 @@ QMakeParser::QMakeParser(ProFileCache *cache, QMakeVfs *vfs, QMakeParserHandler
ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags)
{
ProFile *pro;
- if ((flags & (ParseUseCache|ParseOnlyCached)) && m_cache) {
+ if ((flags & ParseUseCache) && m_cache) {
ProFileCache::Entry *ent;
#ifdef PROPARSER_THREAD_SAFE
QMutexLocker locker(&m_cache->mutex);
@@ -189,13 +189,13 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags)
#endif
if ((pro = ent->pro))
pro->ref();
- } else if (!(flags & ParseOnlyCached)) {
+ } else {
ent = &m_cache->parsed_files[fileName];
#ifdef PROPARSER_THREAD_SAFE
ent->locker = new ProFileCache::Entry::Locker;
locker.unlock();
#endif
- pro = new ProFile(fileName);
+ pro = new ProFile(idForFileName(fileName), fileName);
if (!read(pro, flags)) {
delete pro;
pro = 0;
@@ -214,17 +214,13 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags)
ent->locker = 0;
}
#endif
- } else {
- pro = 0;
}
- } else if (!(flags & ParseOnlyCached)) {
- pro = new ProFile(fileName);
+ } else {
+ pro = new ProFile(idForFileName(fileName), fileName);
if (!read(pro, flags)) {
delete pro;
pro = 0;
}
- } else {
- pro = 0;
}
return pro;
}
@@ -232,11 +228,22 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags)
ProFile *QMakeParser::parsedProBlock(
const QStringRef &contents, const QString &name, int line, SubGrammar grammar)
{
- ProFile *pro = new ProFile(name);
+ ProFile *pro = new ProFile(0, name);
read(pro, contents, line, grammar);
return pro;
}
+int QMakeParser::idForFileName(const QString &fileName)
+{
+#ifdef PROPARSER_THREAD_SAFE
+ QMutexLocker lck(&fileIdMutex);
+#endif
+ int &place = fileIdMap[fileName];
+ if (!place)
+ place = ++fileIdCounter;
+ return place;
+}
+
void QMakeParser::discardFileFromCache(const QString &fileName)
{
if (m_cache)