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:
Nikolai Kosjar
2014-07-16 11:25:15 +02:00
parent 4e9d3b044e
commit 6a9ae7e25f
11 changed files with 51 additions and 20 deletions

View File

@@ -66,9 +66,10 @@ QByteArray FastPreprocessor::run(Document::Ptr newDoc, const QByteArray &source)
return preprocessed;
}
void FastPreprocessor::sourceNeeded(unsigned line, const QString &fileName,
IncludeType mode)
void FastPreprocessor::sourceNeeded(unsigned line, const QString &fileName, IncludeType mode,
const QStringList &initialIncludes)
{
Q_UNUSED(initialIncludes)
Q_ASSERT(_currentDoc);
// CHECKME: Is that cleanName needed?
QString cleanName = QDir::cleanPath(fileName);

View File

@@ -57,7 +57,8 @@ public:
QByteArray run(Document::Ptr newDoc, const QByteArray &source);
// CPlusPlus::Client
virtual void sourceNeeded(unsigned line, const QString &fileName, IncludeType mode);
virtual void sourceNeeded(unsigned line, const QString &fileName, IncludeType mode,
const QStringList &initialIncludes = QStringList());
virtual void macroAdded(const Macro &);

View File

@@ -32,7 +32,7 @@
#include <cplusplus/CPlusPlusForwardDeclarations.h>
#include <QString>
#include <QStringList>
#include <QVector>
QT_BEGIN_NAMESPACE
@@ -100,7 +100,8 @@ public:
virtual void startSkippingBlocks(unsigned utf16charsOffset) = 0;
virtual void stopSkippingBlocks(unsigned utf16charsOffset) = 0;
virtual void sourceNeeded(unsigned line, const QString &fileName, IncludeType mode) = 0;
virtual void sourceNeeded(unsigned line, const QString &fileName, IncludeType mode,
const QStringList &initialIncludes = QStringList()) = 0;
static inline bool isInjectedFile(const QString &fileName)
{