-
Nikolai Kosjar authored
...since it does quite a bit more than only preprocessing, as the name suggests. We use that class to process source files in general. The output is not a preprocessed source, but a set of CPlusPlus::Documents with symbols. Change-Id: I787d0f22f9f042ddf0c99e8c2f0bdb9aa7001735 Reviewed-by:
Erik Verbruggen <erik.verbruggen@digia.com>
Nikolai Kosjar authored...since it does quite a bit more than only preprocessing, as the name suggests. We use that class to process source files in general. The output is not a preprocessed source, but a set of CPlusPlus::Documents with symbols. Change-Id: I787d0f22f9f042ddf0c99e8c2f0bdb9aa7001735 Reviewed-by:
Erik Verbruggen <erik.verbruggen@digia.com>
builtinindexingsupport.cpp 7.48 KiB
#include "builtinindexingsupport.h"
#include "cppmodelmanager.h"
#include "cppsourceprocessor.h"
#include "searchsymbols.h"
#include "cpptoolsconstants.h"
#include "cpptoolsplugin.h"
#include "cppprojectfile.h"
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <utils/runextensions.h>
#include <QCoreApplication>
using namespace CppTools;
using namespace CppTools::Internal;
static const bool DumpFileNameWhileParsing = qgetenv("QTC_DUMP_FILENAME_WHILE_PARSING") == "1";
namespace {
static void parse(QFutureInterface<void> &future,
CppSourceProcessor *sourceProcessor,
QStringList files)
{
if (files.isEmpty())
return;
QStringList sources;
QStringList headers;
foreach (const QString &file, files) {
sourceProcessor->removeFromCache(file);
if (ProjectFile::isSource(ProjectFile::classify(file)))
sources.append(file);
else
headers.append(file);
}
const int sourceCount = sources.size();
files = sources;
files += headers;
sourceProcessor->setTodo(files);
future.setProgressRange(0, files.size());
const QString conf = CppModelManagerInterface::configurationFileName();
bool processingHeaders = false;
CppModelManager *cmm = CppModelManager::instance();
const QStringList fallbackIncludePaths = cmm->includePaths();
for (int i = 0; i < files.size(); ++i) {
if (future.isPaused())
future.waitForResume();
if (future.isCanceled())
break;
const QString fileName = files.at(i);
const bool isSourceFile = i < sourceCount;
if (isSourceFile) {
(void) sourceProcessor->run(conf);
} else if (!processingHeaders) {
(void) sourceProcessor->run(conf);
processingHeaders = true;