forked from qt-creator/qt-creator
CppTools: Auto-include pre-compiled headers
So far the pre-compiled headers were processed (thus defines from those headers were visible), but the actual includes for the documents were not added, which is necessary for lookup/completion. Note that this will be only done if pre-compiled headers are not ignored (Options > C++ > Code Model > [] Ignore pre-compiled headers). Change-Id: I54a8e6b00597af164d958e3e9f2a1075ea187788 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -148,9 +148,10 @@ void CppSourceProcessor::addFrameworkPath(const ProjectPart::HeaderPath &framewo
|
||||
void CppSourceProcessor::setTodo(const QStringList &files)
|
||||
{ m_todo = QSet<QString>::fromList(files); }
|
||||
|
||||
void CppSourceProcessor::run(const QString &fileName)
|
||||
void CppSourceProcessor::run(const QString &fileName,
|
||||
const QStringList &initialIncludes)
|
||||
{
|
||||
sourceNeeded(0, fileName, IncludeGlobal);
|
||||
sourceNeeded(0, fileName, IncludeGlobal, initialIncludes);
|
||||
}
|
||||
|
||||
void CppSourceProcessor::removeFromCache(const QString &fileName)
|
||||
@@ -377,7 +378,8 @@ void CppSourceProcessor::stopSkippingBlocks(unsigned utf16charsOffset)
|
||||
m_currentDoc->stopSkippingBlocks(utf16charsOffset);
|
||||
}
|
||||
|
||||
void CppSourceProcessor::sourceNeeded(unsigned line, const QString &fileName, IncludeType type)
|
||||
void CppSourceProcessor::sourceNeeded(unsigned line, const QString &fileName, IncludeType type,
|
||||
const QStringList &initialIncludes)
|
||||
{
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
@@ -417,6 +419,11 @@ void CppSourceProcessor::sourceNeeded(unsigned line, const QString &fileName, In
|
||||
Document::Ptr document = Document::create(absoluteFileName);
|
||||
document->setRevision(m_revision);
|
||||
document->setEditorRevision(editorRevision);
|
||||
foreach (const QString &include, initialIncludes) {
|
||||
m_included.insert(include);
|
||||
Document::Include inc(include, include, 0, IncludeLocal);
|
||||
document->addIncludeFile(inc);
|
||||
}
|
||||
const QFileInfo info(absoluteFileName);
|
||||
if (info.exists())
|
||||
document->setLastModified(info.lastModified());
|
||||
|
||||
Reference in New Issue
Block a user