Clang: Remove some needless bools

Change-Id: Ia845c803fce85ad0e29e2cf6b64820b86599bac6
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Nikolai Kosjar
2016-09-15 11:08:13 +02:00
parent 9ff15c1a8e
commit ae92b68154
5 changed files with 20 additions and 23 deletions

View File

@@ -301,15 +301,15 @@ void Document::incorporateUpdaterResult(const TranslationUnitUpdateResult &resul
return;
}
if (result.parseTimePointIsSet)
if (result.hasParsed())
d->lastProjectPartChangeTimePoint = result.parseTimePoint;
if (result.parseTimePointIsSet || result.reparsed)
if (result.hasParsed() || result.hasReparsed())
d->dependedFilePaths = result.dependedOnFilePaths;
d->documents.addWatchedFiles(d->dependedFilePaths);
if (result.reparsed
if (result.hasReparsed()
&& result.needsToBeReparsedChangeTimePoint == d->needsToBeReparsedChangeTimePoint) {
d->needsToBeReparsed = false;
}

View File

@@ -122,7 +122,7 @@ void TranslationUnitUpdater::createTranslationUnitIfNeeded()
if (parseWasSuccessful()) {
updateIncludeFilePaths();
updateLastProjectPartChangeTimePoint();
m_out.parseTimePoint = std::chrono::steady_clock::now();
} else {
qWarning() << "Parsing" << m_in.filePath << "failed:"
<< errorCodeToText(m_parseErrorCode);
@@ -151,7 +151,7 @@ void TranslationUnitUpdater::reparse()
if (reparseWasSuccessful()) {
updateIncludeFilePaths();
m_out.reparsed = true;
m_out.reparseTimePoint = std::chrono::steady_clock::now();
m_out.needsToBeReparsedChangeTimePoint = m_in.needsToBeReparsedChangeTimePoint;
} else {
qWarning() << "Reparsing" << m_in.filePath << "failed:" << m_reparseErrorCode;
@@ -185,12 +185,6 @@ void TranslationUnitUpdater::createIndexIfNeeded()
}
}
void TranslationUnitUpdater::updateLastProjectPartChangeTimePoint()
{
m_out.parseTimePointIsSet = true;
m_out.parseTimePoint = std::chrono::steady_clock::now();
}
void TranslationUnitUpdater::includeCallback(CXFile included_file,
CXSourceLocation *,
unsigned, CXClientData clientData)

View File

@@ -55,14 +55,19 @@ public:
};
class TranslationUnitUpdateResult {
public:
bool hasParsed() const
{ return parseTimePoint != time_point(); }
bool hasReparsed() const
{ return reparseTimePoint != time_point(); }
public:
bool hasParseOrReparseFailed = false;
bool parseTimePointIsSet = false;
time_point parseTimePoint;
time_point reparseTimePoint;
time_point needsToBeReparsedChangeTimePoint;
bool reparsed = false;
QSet<Utf8String> dependedOnFilePaths;
};
@@ -93,8 +98,6 @@ private:
void recreateAndParseIfNeeded();
void reparse();
void updateLastProjectPartChangeTimePoint();
void updateIncludeFilePaths();
static void includeCallback(CXFile included_file,
CXSourceLocation *,