forked from qt-creator/qt-creator
C++: Remove hard-coded configuration file name.
Change-Id: Ibe4cc69eafd14dab7707862b1068ce1e21b1d8e0 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "ModelManagerInterface.h"
|
||||
#include "pp-engine.h"
|
||||
|
||||
#include <QtCore/QSet>
|
||||
|
||||
@@ -35,6 +36,9 @@ using namespace CPlusPlus;
|
||||
|
||||
static CppModelManagerInterface *g_instance = 0;
|
||||
|
||||
const QString CppModelManagerInterface::configurationFileName()
|
||||
{ return Preprocessor::configurationFileName; }
|
||||
|
||||
CppModelManagerInterface::CppModelManagerInterface(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
|
||||
@@ -180,6 +180,9 @@ public:
|
||||
CppSemanticsDiagnostic
|
||||
};
|
||||
|
||||
public:
|
||||
static const QString configurationFileName();
|
||||
|
||||
public:
|
||||
CppModelManagerInterface(QObject *parent = 0);
|
||||
virtual ~CppModelManagerInterface();
|
||||
|
||||
@@ -16,8 +16,7 @@ namespace {
|
||||
|
||||
static void parse(QFutureInterface<void> &future,
|
||||
CppPreprocessor *preproc,
|
||||
QStringList files,
|
||||
const char *pp_configuration_file)
|
||||
QStringList files)
|
||||
{
|
||||
if (files.isEmpty())
|
||||
return;
|
||||
@@ -53,8 +52,7 @@ static void parse(QFutureInterface<void> &future,
|
||||
|
||||
future.setProgressRange(0, files.size());
|
||||
|
||||
QString conf = QLatin1String(pp_configuration_file);
|
||||
|
||||
const QString conf = CPlusPlus::CppModelManagerInterface::configurationFileName();
|
||||
bool processingHeaders = false;
|
||||
|
||||
for (int i = 0; i < files.size(); ++i) {
|
||||
@@ -163,9 +161,8 @@ private:
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
BuiltinIndexingSupport::BuiltinIndexingSupport(const char *pp_configuration_file)
|
||||
: m_pp_configuration_file(pp_configuration_file)
|
||||
, m_revision(0)
|
||||
BuiltinIndexingSupport::BuiltinIndexingSupport()
|
||||
: m_revision(0)
|
||||
{
|
||||
m_synchronizer.setCancelOnWait(true);
|
||||
m_dumpFileNameWhileParsing = !qgetenv("QTCREATOR_DUMP_FILENAME_WHILE_PARSING").isNull();
|
||||
@@ -186,7 +183,7 @@ QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(const QStringList &sour
|
||||
preproc->setFrameworkPaths(mgr->frameworkPaths());
|
||||
preproc->setWorkingCopy(workingCopy);
|
||||
|
||||
QFuture<void> result = QtConcurrent::run(&parse, preproc, sourceFiles, m_pp_configuration_file);
|
||||
QFuture<void> result = QtConcurrent::run(&parse, preproc, sourceFiles);
|
||||
|
||||
if (m_synchronizer.futures().size() > 10) {
|
||||
QList<QFuture<void> > futures = m_synchronizer.futures();
|
||||
|
||||
@@ -14,14 +14,13 @@ public:
|
||||
typedef CPlusPlus::CppModelManagerInterface::WorkingCopy WorkingCopy;
|
||||
|
||||
public:
|
||||
BuiltinIndexingSupport(const char *m_pp_configuration_file);
|
||||
BuiltinIndexingSupport();
|
||||
~BuiltinIndexingSupport();
|
||||
|
||||
virtual QFuture<void> refreshSourceFiles(const QStringList &sourceFiles);
|
||||
virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters, QSet<QString> fileNames);
|
||||
|
||||
private:
|
||||
const char *m_pp_configuration_file;
|
||||
QFutureSynchronizer<void> m_synchronizer;
|
||||
unsigned m_revision;
|
||||
bool m_dumpFileNameWhileParsing;
|
||||
|
||||
@@ -1418,7 +1418,7 @@ void CppCompletionAssistProcessor::globalCompletion(CPlusPlus::Scope *currentSco
|
||||
completeNamespace(b);
|
||||
|
||||
addKeywords();
|
||||
addMacros(QLatin1String("<configuration>"), context.snapshot());
|
||||
addMacros(CppModelManagerInterface::configurationFileName(), context.snapshot());
|
||||
addMacros(context.thisDocument()->fileName(), context.snapshot());
|
||||
addSnippets();
|
||||
}
|
||||
|
||||
@@ -164,8 +164,6 @@ protected:
|
||||
|
||||
#endif // QTCREATOR_WITH_DUMP_AST
|
||||
|
||||
static const char pp_configuration_file[] = "<configuration>";
|
||||
|
||||
static const char pp_configuration[] =
|
||||
"# 1 \"<configuration>\"\n"
|
||||
"#define __cplusplus 1\n"
|
||||
@@ -396,7 +394,7 @@ static inline void appendDirSeparatorIfNeeded(QString &path)
|
||||
QString CppPreprocessor::tryIncludeFile_helper(QString &fileName, IncludeType type, unsigned *revision)
|
||||
{
|
||||
QFileInfo fileInfo(fileName);
|
||||
if (fileName == QLatin1String(pp_configuration_file) || fileInfo.isAbsolute()) {
|
||||
if (fileName == Preprocessor::configurationFileName || fileInfo.isAbsolute()) {
|
||||
QString contents;
|
||||
includeFile(fileName, &contents, revision);
|
||||
return contents;
|
||||
@@ -741,7 +739,7 @@ CppModelManager::CppModelManager(QObject *parent)
|
||||
ExtensionSystem::PluginManager::addObject(m_completionAssistProvider);
|
||||
m_highlightingFallback = new CppHighlightingSupportInternalFactory;
|
||||
m_highlightingFactory = m_highlightingFallback;
|
||||
m_internalIndexingSupport = new BuiltinIndexingSupport(pp_configuration_file);
|
||||
m_internalIndexingSupport = new BuiltinIndexingSupport;
|
||||
}
|
||||
|
||||
CppModelManager::~CppModelManager()
|
||||
@@ -940,7 +938,7 @@ CppModelManager::WorkingCopy CppModelManager::buildWorkingCopyList()
|
||||
// add the project configuration file
|
||||
QByteArray conf(pp_configuration);
|
||||
conf += definedMacros();
|
||||
workingCopy.insert(QLatin1String(pp_configuration_file), QString::fromUtf8(conf));
|
||||
workingCopy.insert(configurationFileName(), QString::fromUtf8(conf));
|
||||
|
||||
return workingCopy;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user