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 existent in the cache, to ensure that
calling include() after write_file() always works.

Change-Id: I7d09269a57de55ca30b0e11dd40770de9f919f64
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
(cherry picked from qtbase/f45d6414ad6ef1d75f049a61411cd954bcae29c3)
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Oswald Buddenhagen
2013-05-16 18:11:46 +02:00
parent a64eac0a74
commit aa2508ba41
3 changed files with 9 additions and 0 deletions

View File

@@ -308,6 +308,7 @@ QMakeEvaluator::writeFile(const QString &ctx, const QString &fn, QIODevice::Open
.arg(ctx, QDir::toNativeSeparators(qfi.filePath()), errStr)); .arg(ctx, QDir::toNativeSeparators(qfi.filePath()), errStr));
return ReturnFalse; return ReturnFalse;
} }
m_parser->discardFileFromCache(qfi.filePath());
return ReturnTrue; return ReturnTrue;
} }

View File

@@ -210,6 +210,12 @@ ProFile *QMakeParser::parsedProBlock(
return pro; return pro;
} }
void QMakeParser::discardFileFromCache(const QString &fileName)
{
if (m_cache)
m_cache->discardFile(fileName);
}
bool QMakeParser::read(ProFile *pro) bool QMakeParser::read(ProFile *pro)
{ {
QFile file(pro->fileName()); QFile file(pro->fileName());

View File

@@ -82,6 +82,8 @@ public:
ProFile *parsedProBlock(const QString &contents, const QString &name, int line = 0, ProFile *parsedProBlock(const QString &contents, const QString &name, int line = 0,
SubGrammar grammar = FullGrammar); SubGrammar grammar = FullGrammar);
void discardFileFromCache(const QString &fileName);
private: private:
enum ScopeNesting { enum ScopeNesting {
NestNone = 0, NestNone = 0,