Commit c388c05b authored by Erik Verbruggen's avatar Erik Verbruggen Committed by Nikolai Kosjar

C++: fix the quick-exit for already parsed files.

When the preprocessor is asked to process a file which it has already
seen before, it can skip it, but it still has to add the file to the
list of included files for the current document.

Task-number: QTCREATORBUG-9107
Change-Id: I30cac61c1da20da7fe925168ecccb429584e9746
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent 8ba344a5
......@@ -511,17 +511,17 @@ void CppPreprocessor::sourceNeeded(unsigned line, const QString &fileName, Inclu
return;
QString absoluteFileName = resolveFile(fileName, type);
absoluteFileName = QDir::cleanPath(absoluteFileName);
if (m_currentDoc && !absoluteFileName.isEmpty())
m_currentDoc->addIncludeFile(absoluteFileName, line);
if (m_included.contains(absoluteFileName))
return; // we've already seen this file.
m_included.insert(absoluteFileName);
absoluteFileName = QDir::cleanPath(absoluteFileName);
unsigned editorRevision = 0;
QString contents;
getFileContents(absoluteFileName, &contents, &editorRevision);
if (m_currentDoc) {
m_currentDoc->addIncludeFile(absoluteFileName, line);
if (contents.isEmpty() && ! QFileInfo(absoluteFileName).isAbsolute()) {
QString msg = QCoreApplication::translate(
"CppPreprocessor", "%1: No such file or directory").arg(fileName);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment