Commit 31fc4c41 authored by Erik Verbruggen's avatar Erik Verbruggen

[C++] Added env. var. to show file name that is being parsed.

When setting the environment variable
QTCREATOR_DUMP_FILENAME_WHILE_PARSING, the indexer will write the file
name of the file it is processing to stderr.

Change-Id: Iaed582512b87fd0584feb4e459a4094be32d5745
Reviewed-by: default avatarRoberto Raggi <roberto.raggi@nokia.com>
parent 2ee1d10d
......@@ -201,9 +201,10 @@ static const char pp_configuration[] =
"#define __forceinline inline\n";
#ifndef ICHECK_BUILD
CppPreprocessor::CppPreprocessor(QPointer<CppModelManager> modelManager)
CppPreprocessor::CppPreprocessor(QPointer<CppModelManager> modelManager, bool dumpFileNameWhileParsing)
: snapshot(modelManager->snapshot()),
m_modelManager(modelManager),
m_dumpFileNameWhileParsing(dumpFileNameWhileParsing),
preprocess(this, &env),
m_revision(0)
{
......@@ -214,6 +215,7 @@ CppPreprocessor::CppPreprocessor(QPointer<CppModelManager> modelManager)
CppPreprocessor::CppPreprocessor(QPointer<CPlusPlus::ParseManager> modelManager)
: preprocess(this, &env),
m_dumpFileNameWhileParsing(false),
m_revision(0)
{
}
......@@ -599,9 +601,11 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type, unsigned
}
}
// qDebug() << "parse file:" << fileName
if (m_dumpFileNameWhileParsing) {
qDebug() << "Parsing file:" << fileName
// << "contents:" << contents.size()
// ;
;
}
Document::Ptr doc = snapshot.document(fileName);
if (doc) {
......@@ -695,6 +699,7 @@ CppModelManager::CppModelManager(QObject *parent)
{
m_findReferences = new CppFindReferences(this);
m_indexerEnabled = qgetenv("QTCREATOR_NO_CODE_INDEXER").isNull();
m_dumpFileNameWhileParsing = !qgetenv("QTCREATOR_DUMP_FILENAME_WHILE_PARSING").isNull();
m_revision = 0;
m_synchronizer.setCancelOnWait(true);
......@@ -984,7 +989,7 @@ QFuture<void> CppModelManager::refreshSourceFiles(const QStringList &sourceFiles
if (! sourceFiles.isEmpty() && m_indexerEnabled) {
const WorkingCopy workingCopy = buildWorkingCopyList();
CppPreprocessor *preproc = new CppPreprocessor(this);
CppPreprocessor *preproc = new CppPreprocessor(this, m_dumpFileNameWhileParsing);
preproc->setRevision(++m_revision);
preproc->setProjectFiles(projectFiles());
preproc->setIncludePaths(includePaths());
......
......@@ -244,6 +244,7 @@ private:
CppFindReferences *m_findReferences;
bool m_indexerEnabled;
bool m_dumpFileNameWhileParsing;
mutable QMutex protectExtraDiagnostics;
QHash<QString, QHash<int, QList<CPlusPlus::Document::DiagnosticMessage> > > m_extraDiagnostics;
......@@ -261,7 +262,7 @@ class CPPTOOLS_EXPORT CppPreprocessor: public CPlusPlus::Client
{
public:
#ifndef ICHECK_BUILD
CppPreprocessor(QPointer<CppModelManager> modelManager);
CppPreprocessor(QPointer<CppModelManager> modelManager, bool dumpFileNameWhileParsing = false);
#else
CppPreprocessor(QPointer<CPlusPlus::ParseManager> modelManager);
#endif
......@@ -314,6 +315,7 @@ private:
#ifndef ICHECK_BUILD
QPointer<CppModelManager> m_modelManager;
#endif
bool m_dumpFileNameWhileParsing;
CPlusPlus::Environment env;
CPlusPlus::Preprocessor preprocess;
QStringList m_includePaths;
......
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