From 10b2503195dc0d8a98f365e59c7acb602ae4ab3a Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 25 Oct 2012 10:55:00 +0200 Subject: [PATCH] Fix qmake's pro file cache to interact correctly with write_file When writing a file with write_file() we have to inform the pro file parser cache to discard the file if it's existant in the cache, to ensure that calling include() after write_file() always works. Change-Id: I7d09269a57de55ca30b0e11dd40770de9f919f64 Reviewed-by: Oswald Buddenhagen (cherry picked from qtbase/f45d6414ad6ef1d75f049a61411cd954bcae29c3) Reviewed-by: Simon Hausmann Reviewed-by: Joerg Bornemann --- src/linguist/shared/qmakebuiltins.cpp | 1 + src/linguist/shared/qmakeparser.cpp | 6 ++++++ src/linguist/shared/qmakeparser.h | 2 ++ 3 files changed, 9 insertions(+) diff --git a/src/linguist/shared/qmakebuiltins.cpp b/src/linguist/shared/qmakebuiltins.cpp index b63646d..d5f9cac 100644 --- a/src/linguist/shared/qmakebuiltins.cpp +++ b/src/linguist/shared/qmakebuiltins.cpp @@ -323,6 +323,7 @@ QMakeEvaluator::writeFile(const QString &ctx, const QString &fn, QIODevice::Open .arg(ctx, QDir::toNativeSeparators(qfi.filePath()), errStr)); return ReturnFalse; } + m_parser->discardFileFromCache(qfi.filePath()); return ReturnTrue; } diff --git a/src/linguist/shared/qmakeparser.cpp b/src/linguist/shared/qmakeparser.cpp index f9b47d6..5deb6b6 100644 --- a/src/linguist/shared/qmakeparser.cpp +++ b/src/linguist/shared/qmakeparser.cpp @@ -216,6 +216,12 @@ ProFile *QMakeParser::parsedProBlock( return pro; } +void QMakeParser::discardFileFromCache(const QString &fileName) +{ + if (m_cache) + m_cache->discardFile(fileName); +} + bool QMakeParser::read(ProFile *pro) { QFile file(pro->fileName()); diff --git a/src/linguist/shared/qmakeparser.h b/src/linguist/shared/qmakeparser.h index 36daa0a..a5f118f 100644 --- a/src/linguist/shared/qmakeparser.h +++ b/src/linguist/shared/qmakeparser.h @@ -94,6 +94,8 @@ public: ProFile *parsedProBlock(const QString &contents, const QString &name, int line = 0, SubGrammar grammar = FullGrammar); + void discardFileFromCache(const QString &fileName); + private: struct BlockScope { BlockScope() : start(0), braceLevel(0), special(false), inBranch(false) {} -- 2.7.4