forked from qt-creator/qt-creator
CppTools: Use namespace CppTools consistently
There were quite a few classes using CPlusPlus namespace in the CppTools plugin. Rename them and do some other small namespace related coding style fixups. Change-Id: I093fc1f3fc394fd9923e3f18d5f66522e288f21d Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -82,7 +82,7 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor()
|
|||||||
const int pos = tc.position();
|
const int pos = tc.position();
|
||||||
editorWidget->convertPosition(pos, &line, &column);
|
editorWidget->convertPosition(pos, &line, &column);
|
||||||
|
|
||||||
const CPlusPlus::Snapshot &snapshot = CPlusPlus::CppModelManagerInterface::instance()->snapshot();
|
const CPlusPlus::Snapshot &snapshot = CppTools::CppModelManagerInterface::instance()->snapshot();
|
||||||
CPlusPlus::Document::Ptr doc = snapshot.document(editor->document()->fileName());
|
CPlusPlus::Document::Ptr doc = snapshot.document(editor->document()->fileName());
|
||||||
QTC_ASSERT(doc, return 0);
|
QTC_ASSERT(doc, return 0);
|
||||||
|
|
||||||
|
|||||||
@@ -406,8 +406,8 @@ QList<Node *> AutotoolsProject::nodes(FolderNode *parent) const
|
|||||||
|
|
||||||
void AutotoolsProject::updateCppCodeModel()
|
void AutotoolsProject::updateCppCodeModel()
|
||||||
{
|
{
|
||||||
CPlusPlus::CppModelManagerInterface *modelManager =
|
CppTools::CppModelManagerInterface *modelManager =
|
||||||
CPlusPlus::CppModelManagerInterface::instance();
|
CppTools::CppModelManagerInterface::instance();
|
||||||
|
|
||||||
if (!modelManager)
|
if (!modelManager)
|
||||||
return;
|
return;
|
||||||
@@ -435,7 +435,7 @@ void AutotoolsProject::updateCppCodeModel()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CPlusPlus::CppModelManagerInterface::ProjectInfo pinfo = modelManager->projectInfo(this);
|
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelManager->projectInfo(this);
|
||||||
|
|
||||||
const bool update = (pinfo.includePaths() != allIncludePaths)
|
const bool update = (pinfo.includePaths() != allIncludePaths)
|
||||||
|| (pinfo.sourceFiles() != m_files)
|
|| (pinfo.sourceFiles() != m_files)
|
||||||
@@ -443,15 +443,15 @@ void AutotoolsProject::updateCppCodeModel()
|
|||||||
|| (pinfo.frameworkPaths() != allFrameworkPaths);
|
|| (pinfo.frameworkPaths() != allFrameworkPaths);
|
||||||
if (update) {
|
if (update) {
|
||||||
pinfo.clearProjectParts();
|
pinfo.clearProjectParts();
|
||||||
CPlusPlus::ProjectPart::Ptr part(new CPlusPlus::ProjectPart);
|
CppTools::ProjectPart::Ptr part(new CppTools::ProjectPart);
|
||||||
part->includePaths = allIncludePaths;
|
part->includePaths = allIncludePaths;
|
||||||
foreach (const QString &file, m_files)
|
foreach (const QString &file, m_files)
|
||||||
part->files << CPlusPlus::ProjectFile(file, CPlusPlus::ProjectFile::CXXSource);
|
part->files << CppTools::ProjectFile(file, CppTools::ProjectFile::CXXSource);
|
||||||
|
|
||||||
part->defines = macros;
|
part->defines = macros;
|
||||||
part->frameworkPaths = allFrameworkPaths;
|
part->frameworkPaths = allFrameworkPaths;
|
||||||
part->cVersion = CPlusPlus::ProjectPart::C99;
|
part->cVersion = CppTools::ProjectPart::C99;
|
||||||
part->cxxVersion = CPlusPlus::ProjectPart::CXX11;
|
part->cxxVersion = CppTools::ProjectPart::CXX11;
|
||||||
pinfo.appendProjectPart(part);
|
pinfo.appendProjectPart(part);
|
||||||
|
|
||||||
modelManager->updateProjectInfo(pinfo);
|
modelManager->updateProjectInfo(pinfo);
|
||||||
|
|||||||
@@ -182,8 +182,8 @@ void Manager::initialize()
|
|||||||
&d->parser, SLOT(setFlatMode(bool)), Qt::QueuedConnection);
|
&d->parser, SLOT(setFlatMode(bool)), Qt::QueuedConnection);
|
||||||
|
|
||||||
// connect to the cpp model manager for signals about document updates
|
// connect to the cpp model manager for signals about document updates
|
||||||
CPlusPlus::CppModelManagerInterface *codeModelManager
|
CppTools::CppModelManagerInterface *codeModelManager
|
||||||
= CPlusPlus::CppModelManagerInterface::instance();
|
= CppTools::CppModelManagerInterface::instance();
|
||||||
|
|
||||||
// when code manager signals that document is updated - handle it by ourselves
|
// when code manager signals that document is updated - handle it by ourselves
|
||||||
connect(codeModelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)),
|
connect(codeModelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)),
|
||||||
|
|||||||
@@ -568,7 +568,7 @@ void Parser::resetData(const CPlusPlus::Snapshot &snapshot)
|
|||||||
void Parser::resetDataToCurrentState()
|
void Parser::resetDataToCurrentState()
|
||||||
{
|
{
|
||||||
// get latest data
|
// get latest data
|
||||||
CPlusPlus::CppModelManagerInterface *codeModel = CPlusPlus::CppModelManagerInterface::instance();
|
CppTools::CppModelManagerInterface *codeModel = CppTools::CppModelManagerInterface::instance();
|
||||||
if (codeModel)
|
if (codeModel)
|
||||||
resetData(codeModel->snapshot());
|
resetData(codeModel->snapshot());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,8 +123,8 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
|||||||
CMakeProject::~CMakeProject()
|
CMakeProject::~CMakeProject()
|
||||||
{
|
{
|
||||||
// Remove CodeModel support
|
// Remove CodeModel support
|
||||||
CPlusPlus::CppModelManagerInterface *modelManager
|
CppTools::CppModelManagerInterface *modelManager
|
||||||
= CPlusPlus::CppModelManagerInterface::instance();
|
= CppTools::CppModelManagerInterface::instance();
|
||||||
QMap<QString, CMakeUiCodeModelSupport *>::const_iterator it, end;
|
QMap<QString, CMakeUiCodeModelSupport *>::const_iterator it, end;
|
||||||
it = m_uiCodeModelSupport.constBegin();
|
it = m_uiCodeModelSupport.constBegin();
|
||||||
end = m_uiCodeModelSupport.constEnd();
|
end = m_uiCodeModelSupport.constEnd();
|
||||||
@@ -367,29 +367,29 @@ bool CMakeProject::parseCMakeLists()
|
|||||||
allIncludePaths.append(headerPath.path());
|
allIncludePaths.append(headerPath.path());
|
||||||
}
|
}
|
||||||
|
|
||||||
CPlusPlus::CppModelManagerInterface *modelmanager =
|
CppTools::CppModelManagerInterface *modelmanager =
|
||||||
CPlusPlus::CppModelManagerInterface::instance();
|
CppTools::CppModelManagerInterface::instance();
|
||||||
if (modelmanager) {
|
if (modelmanager) {
|
||||||
CPlusPlus::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
||||||
if (pinfo.includePaths() != allIncludePaths
|
if (pinfo.includePaths() != allIncludePaths
|
||||||
|| pinfo.sourceFiles() != m_files
|
|| pinfo.sourceFiles() != m_files
|
||||||
|| pinfo.defines() != allDefines
|
|| pinfo.defines() != allDefines
|
||||||
|| pinfo.frameworkPaths() != allFrameworkPaths) {
|
|| pinfo.frameworkPaths() != allFrameworkPaths) {
|
||||||
pinfo.clearProjectParts();
|
pinfo.clearProjectParts();
|
||||||
CPlusPlus::ProjectPart::Ptr part(new CPlusPlus::ProjectPart);
|
CppTools::ProjectPart::Ptr part(new CppTools::ProjectPart);
|
||||||
part->includePaths = allIncludePaths;
|
part->includePaths = allIncludePaths;
|
||||||
CPlusPlus::ProjectFileAdder adder(part->files);
|
CppTools::ProjectFileAdder adder(part->files);
|
||||||
foreach (const QString &file, m_files)
|
foreach (const QString &file, m_files)
|
||||||
adder.maybeAdd(file);
|
adder.maybeAdd(file);
|
||||||
part->defines = allDefines;
|
part->defines = allDefines;
|
||||||
part->frameworkPaths = allFrameworkPaths;
|
part->frameworkPaths = allFrameworkPaths;
|
||||||
part->cVersion = CPlusPlus::ProjectPart::C99;
|
part->cVersion = CppTools::ProjectPart::C99;
|
||||||
if (tc)
|
if (tc)
|
||||||
part->cxxVersion = tc->compilerFlags(cxxflags) == ToolChain::STD_CXX11
|
part->cxxVersion = tc->compilerFlags(cxxflags) == ToolChain::STD_CXX11
|
||||||
? CPlusPlus::ProjectPart::CXX11
|
? CppTools::ProjectPart::CXX11
|
||||||
: CPlusPlus::ProjectPart::CXX98;
|
: CppTools::ProjectPart::CXX98;
|
||||||
else
|
else
|
||||||
part->cxxVersion = CPlusPlus::ProjectPart::CXX11;
|
part->cxxVersion = CppTools::ProjectPart::CXX11;
|
||||||
pinfo.appendProjectPart(part);
|
pinfo.appendProjectPart(part);
|
||||||
modelmanager->updateProjectInfo(pinfo);
|
modelmanager->updateProjectInfo(pinfo);
|
||||||
m_codeModelFuture.cancel();
|
m_codeModelFuture.cancel();
|
||||||
@@ -787,8 +787,8 @@ void CMakeProject::updateRunConfigurations(Target *t)
|
|||||||
void CMakeProject::createUiCodeModelSupport()
|
void CMakeProject::createUiCodeModelSupport()
|
||||||
{
|
{
|
||||||
// qDebug()<<"creatUiCodeModelSupport()";
|
// qDebug()<<"creatUiCodeModelSupport()";
|
||||||
CPlusPlus::CppModelManagerInterface *modelManager
|
CppTools::CppModelManagerInterface *modelManager
|
||||||
= CPlusPlus::CppModelManagerInterface::instance();
|
= CppTools::CppModelManagerInterface::instance();
|
||||||
|
|
||||||
// First move all to
|
// First move all to
|
||||||
QMap<QString, CMakeUiCodeModelSupport *> oldCodeModelSupport;
|
QMap<QString, CMakeUiCodeModelSupport *> oldCodeModelSupport;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
using namespace CMakeProjectManager;
|
using namespace CMakeProjectManager;
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
CMakeUiCodeModelSupport::CMakeUiCodeModelSupport(CPlusPlus::CppModelManagerInterface *modelmanager,
|
CMakeUiCodeModelSupport::CMakeUiCodeModelSupport(CppTools::CppModelManagerInterface *modelmanager,
|
||||||
CMakeProject *project,
|
CMakeProject *project,
|
||||||
const QString &source,
|
const QString &source,
|
||||||
const QString &uiHeaderFile)
|
const QString &uiHeaderFile)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class CMakeProject;
|
|||||||
class CMakeUiCodeModelSupport : public CppTools::UiCodeModelSupport
|
class CMakeUiCodeModelSupport : public CppTools::UiCodeModelSupport
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMakeUiCodeModelSupport(CPlusPlus::CppModelManagerInterface *modelmanager,
|
CMakeUiCodeModelSupport(CppTools::CppModelManagerInterface *modelmanager,
|
||||||
CMakeProject *project,
|
CMakeProject *project,
|
||||||
const QString &sourceFile,
|
const QString &sourceFile,
|
||||||
const QString &uiHeaderFile);
|
const QString &uiHeaderFile);
|
||||||
|
|||||||
@@ -84,11 +84,11 @@ TestCase::TestCase(const QByteArray &input)
|
|||||||
Utils::FileSaver srcSaver(fileName);
|
Utils::FileSaver srcSaver(fileName);
|
||||||
srcSaver.write(originalText);
|
srcSaver.write(originalText);
|
||||||
srcSaver.finalize();
|
srcSaver.finalize();
|
||||||
CPlusPlus::CppModelManagerInterface::instance()->updateSourceFiles(QStringList()<<fileName);
|
CppTools::CppModelManagerInterface::instance()->updateSourceFiles(QStringList()<<fileName);
|
||||||
|
|
||||||
// Wait for the parser in the future to give us the document
|
// Wait for the parser in the future to give us the document
|
||||||
while (true) {
|
while (true) {
|
||||||
Snapshot s = CPlusPlus::CppModelManagerInterface::instance()->snapshot();
|
Snapshot s = CppTools::CppModelManagerInterface::instance()->snapshot();
|
||||||
if (s.contains(fileName))
|
if (s.contains(fileName))
|
||||||
break;
|
break;
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
@@ -120,7 +120,7 @@ TestCase::~TestCase()
|
|||||||
QCoreApplication::processEvents(); // process any pending events
|
QCoreApplication::processEvents(); // process any pending events
|
||||||
|
|
||||||
// Remove the test file from the code-model
|
// Remove the test file from the code-model
|
||||||
CppModelManagerInterface *mmi = CPlusPlus::CppModelManagerInterface::instance();
|
CppTools::CppModelManagerInterface *mmi = CppTools::CppModelManagerInterface::instance();
|
||||||
mmi->GC();
|
mmi->GC();
|
||||||
QCOMPARE(mmi->snapshot().size(), 0);
|
QCOMPARE(mmi->snapshot().size(), 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1282,7 +1282,7 @@ void CPPEditorWidget::finishHighlightSymbolUsages()
|
|||||||
|
|
||||||
if (m_modelManager)
|
if (m_modelManager)
|
||||||
m_modelManager->setExtraDiagnostics(m_lastSemanticInfo.doc->fileName(),
|
m_modelManager->setExtraDiagnostics(m_lastSemanticInfo.doc->fileName(),
|
||||||
CPlusPlus::CppModelManagerInterface::CppSemanticsDiagnostic,
|
CppTools::CppModelManagerInterface::CppSemanticsDiagnostic,
|
||||||
m_lastSemanticInfo.doc->diagnosticMessages());
|
m_lastSemanticInfo.doc->diagnosticMessages());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,17 +59,15 @@ QT_END_NAMESPACE
|
|||||||
namespace CPlusPlus {
|
namespace CPlusPlus {
|
||||||
class OverviewModel;
|
class OverviewModel;
|
||||||
class Symbol;
|
class Symbol;
|
||||||
class CppModelManagerInterface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
class CppCodeStyleSettings;
|
class CppCodeStyleSettings;
|
||||||
|
class CppModelManagerInterface;
|
||||||
class CppRefactoringFile;
|
class CppRefactoringFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor { class FontSettings; }
|
||||||
class FontSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -185,7 +183,7 @@ public:
|
|||||||
virtual void cut(); // reimplemented from BaseTextEditorWidget
|
virtual void cut(); // reimplemented from BaseTextEditorWidget
|
||||||
virtual void selectAll(); // reimplemented from BaseTextEditorWidget
|
virtual void selectAll(); // reimplemented from BaseTextEditorWidget
|
||||||
|
|
||||||
CPlusPlus::CppModelManagerInterface *modelManager() const;
|
CppTools::CppModelManagerInterface *modelManager() const;
|
||||||
|
|
||||||
virtual void setMimeType(const QString &mt);
|
virtual void setMimeType(const QString &mt);
|
||||||
|
|
||||||
@@ -293,7 +291,7 @@ private:
|
|||||||
bool handleDocumentationComment(QKeyEvent *e);
|
bool handleDocumentationComment(QKeyEvent *e);
|
||||||
bool isStartOfDoxygenComment(const QTextCursor &cursor) const;
|
bool isStartOfDoxygenComment(const QTextCursor &cursor) const;
|
||||||
|
|
||||||
CPlusPlus::CppModelManagerInterface *m_modelManager;
|
CppTools::CppModelManagerInterface *m_modelManager;
|
||||||
|
|
||||||
QComboBox *m_outlineCombo;
|
QComboBox *m_outlineCombo;
|
||||||
CPlusPlus::OverviewModel *m_outlineModel;
|
CPlusPlus::OverviewModel *m_outlineModel;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace {
|
|||||||
|
|
||||||
CppElementEvaluator::CppElementEvaluator(CPPEditorWidget *editor) :
|
CppElementEvaluator::CppElementEvaluator(CPPEditorWidget *editor) :
|
||||||
m_editor(editor),
|
m_editor(editor),
|
||||||
m_modelManager(CppModelManagerInterface::instance()),
|
m_modelManager(CppTools::CppModelManagerInterface::instance()),
|
||||||
m_tc(editor->textCursor()),
|
m_tc(editor->textCursor()),
|
||||||
m_lookupBaseClasses(false),
|
m_lookupBaseClasses(false),
|
||||||
m_lookupDerivedClasses(false)
|
m_lookupDerivedClasses(false)
|
||||||
@@ -348,18 +348,18 @@ void CppClass::lookupBases(Symbol *declaration, const CPlusPlus::LookupContext &
|
|||||||
|
|
||||||
void CppClass::lookupDerived(CPlusPlus::Symbol *declaration, const CPlusPlus::Snapshot &snapshot)
|
void CppClass::lookupDerived(CPlusPlus::Symbol *declaration, const CPlusPlus::Snapshot &snapshot)
|
||||||
{
|
{
|
||||||
typedef QPair<CppClass *, TypeHierarchy> Data;
|
typedef QPair<CppClass *, CppTools::TypeHierarchy> Data;
|
||||||
|
|
||||||
TypeHierarchyBuilder builder(declaration, snapshot);
|
CppTools::TypeHierarchyBuilder builder(declaration, snapshot);
|
||||||
const TypeHierarchy &completeHierarchy = builder.buildDerivedTypeHierarchy();
|
const CppTools::TypeHierarchy &completeHierarchy = builder.buildDerivedTypeHierarchy();
|
||||||
|
|
||||||
QQueue<Data> q;
|
QQueue<Data> q;
|
||||||
q.enqueue(qMakePair(this, completeHierarchy));
|
q.enqueue(qMakePair(this, completeHierarchy));
|
||||||
while (!q.isEmpty()) {
|
while (!q.isEmpty()) {
|
||||||
const Data ¤t = q.dequeue();
|
const Data ¤t = q.dequeue();
|
||||||
CppClass *clazz = current.first;
|
CppClass *clazz = current.first;
|
||||||
const TypeHierarchy &classHierarchy = current.second;
|
const CppTools::TypeHierarchy &classHierarchy = current.second;
|
||||||
foreach (const TypeHierarchy &derivedHierarchy, classHierarchy.hierarchy()) {
|
foreach (const CppTools::TypeHierarchy &derivedHierarchy, classHierarchy.hierarchy()) {
|
||||||
clazz->derived.append(CppClass(derivedHierarchy.symbol()));
|
clazz->derived.append(CppClass(derivedHierarchy.symbol()));
|
||||||
q.enqueue(qMakePair(&clazz->derived.last(), derivedHierarchy));
|
q.enqueue(qMakePair(&clazz->derived.last(), derivedHierarchy));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,9 +49,7 @@ class LookupItem;
|
|||||||
class LookupContext;
|
class LookupContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools { class CppModelManagerInterface; }
|
||||||
class CppModelManagerInterface;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -84,7 +82,7 @@ private:
|
|||||||
const CPlusPlus::LookupContext &lookupContext);
|
const CPlusPlus::LookupContext &lookupContext);
|
||||||
|
|
||||||
CPPEditorWidget *m_editor;
|
CPPEditorWidget *m_editor;
|
||||||
CPlusPlus::CppModelManagerInterface *m_modelManager;
|
CppTools::CppModelManagerInterface *m_modelManager;
|
||||||
QTextCursor m_tc;
|
QTextCursor m_tc;
|
||||||
bool m_lookupBaseClasses;
|
bool m_lookupBaseClasses;
|
||||||
bool m_lookupDerivedClasses;
|
bool m_lookupDerivedClasses;
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
|
|||||||
cppToolsMenu->addSeparator(globalContext);
|
cppToolsMenu->addSeparator(globalContext);
|
||||||
m_updateCodeModelAction = new QAction(tr("Update Code Model"), this);
|
m_updateCodeModelAction = new QAction(tr("Update Code Model"), this);
|
||||||
cmd = Core::ActionManager::registerAction(m_updateCodeModelAction, Core::Id(Constants::UPDATE_CODEMODEL), globalContext);
|
cmd = Core::ActionManager::registerAction(m_updateCodeModelAction, Core::Id(Constants::UPDATE_CODEMODEL), globalContext);
|
||||||
CPlusPlus::CppModelManagerInterface *cppModelManager = CPlusPlus::CppModelManagerInterface::instance();
|
CppTools::CppModelManagerInterface *cppModelManager = CppTools::CppModelManagerInterface::instance();
|
||||||
connect(m_updateCodeModelAction, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles()));
|
connect(m_updateCodeModelAction, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles()));
|
||||||
cppToolsMenu->addAction(cmd);
|
cppToolsMenu->addAction(cmd);
|
||||||
|
|
||||||
|
|||||||
@@ -34,10 +34,7 @@
|
|||||||
|
|
||||||
#include <texteditor/quickfix.h>
|
#include <texteditor/quickfix.h>
|
||||||
|
|
||||||
namespace CPlusPlus {
|
namespace CPlusPlus { class Snapshot; }
|
||||||
class CppModelManagerInterface;
|
|
||||||
class Snapshot;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
namespace Internal { class CppQuickFixAssistInterface; }
|
namespace Internal { class CppQuickFixAssistInterface; }
|
||||||
|
|||||||
@@ -207,12 +207,12 @@ void TestCase::init()
|
|||||||
QStringList filePaths;
|
QStringList filePaths;
|
||||||
foreach (const TestDocumentPtr &testFile, testFiles)
|
foreach (const TestDocumentPtr &testFile, testFiles)
|
||||||
filePaths << testFile->filePath();
|
filePaths << testFile->filePath();
|
||||||
CPlusPlus::CppModelManagerInterface::instance()->updateSourceFiles(filePaths);
|
CppTools::CppModelManagerInterface::instance()->updateSourceFiles(filePaths);
|
||||||
|
|
||||||
// Wait for the parser in the future to give us the document
|
// Wait for the parser in the future to give us the document
|
||||||
QStringList filePathsNotYetInSnapshot(filePaths);
|
QStringList filePathsNotYetInSnapshot(filePaths);
|
||||||
forever {
|
forever {
|
||||||
Snapshot snapshot = CPlusPlus::CppModelManagerInterface::instance()->snapshot();
|
Snapshot snapshot = CppTools::CppModelManagerInterface::instance()->snapshot();
|
||||||
foreach (const QString &filePath, filePathsNotYetInSnapshot) {
|
foreach (const QString &filePath, filePathsNotYetInSnapshot) {
|
||||||
if (snapshot.contains(filePath))
|
if (snapshot.contains(filePath))
|
||||||
filePathsNotYetInSnapshot.removeOne(filePath);
|
filePathsNotYetInSnapshot.removeOne(filePath);
|
||||||
@@ -267,7 +267,7 @@ TestCase::~TestCase()
|
|||||||
QCoreApplication::processEvents(); // process any pending events
|
QCoreApplication::processEvents(); // process any pending events
|
||||||
|
|
||||||
// Remove the test files from the code-model
|
// Remove the test files from the code-model
|
||||||
CppModelManagerInterface *mmi = CPlusPlus::CppModelManagerInterface::instance();
|
CppModelManagerInterface *mmi = CppTools::CppModelManagerInterface::instance();
|
||||||
mmi->GC();
|
mmi->GC();
|
||||||
QCOMPARE(mmi->snapshot().size(), 0);
|
QCOMPARE(mmi->snapshot().size(), 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ CppQuickFixAssistInterface::CppQuickFixAssistInterface(CPPEditorWidget *editor,
|
|||||||
editor->editorDocument()->fileName(), reason)
|
editor->editorDocument()->fileName(), reason)
|
||||||
, m_editor(editor)
|
, m_editor(editor)
|
||||||
, m_semanticInfo(editor->semanticInfo())
|
, m_semanticInfo(editor->semanticInfo())
|
||||||
, m_snapshot(CPlusPlus::CppModelManagerInterface::instance()->snapshot())
|
, m_snapshot(CppTools::CppModelManagerInterface::instance()->snapshot())
|
||||||
, m_currentFile(CppRefactoringChanges::file(editor, m_semanticInfo.doc))
|
, m_currentFile(CppRefactoringChanges::file(editor, m_semanticInfo.doc))
|
||||||
, m_context(m_semanticInfo.doc, m_snapshot)
|
, m_context(m_semanticInfo.doc, m_snapshot)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <QtCore/QSet>
|
#include <QtCore/QSet>
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\enum CPlusPlus::CppModelManagerInterface::QtVersion
|
\enum CppTools::CppModelManagerInterface::QtVersion
|
||||||
Allows C++ parser engine to inject headers or change inner settings as
|
Allows C++ parser engine to inject headers or change inner settings as
|
||||||
needed to parse Qt language extensions for concrete major Qt version
|
needed to parse Qt language extensions for concrete major Qt version
|
||||||
\value UnknownQt
|
\value UnknownQt
|
||||||
@@ -47,12 +47,12 @@
|
|||||||
Parser may enable tricks for Qt v5.x
|
Parser may enable tricks for Qt v5.x
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CppTools;
|
||||||
|
|
||||||
static CppModelManagerInterface *g_instance = 0;
|
static CppModelManagerInterface *g_instance = 0;
|
||||||
|
|
||||||
const QString CppModelManagerInterface::configurationFileName()
|
const QString CppModelManagerInterface::configurationFileName()
|
||||||
{ return Preprocessor::configurationFileName; }
|
{ return CPlusPlus::Preprocessor::configurationFileName; }
|
||||||
|
|
||||||
CppModelManagerInterface::CppModelManagerInterface(QObject *parent)
|
CppModelManagerInterface::CppModelManagerInterface(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
|
|||||||
@@ -42,17 +42,9 @@
|
|||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core { class IEditor; }
|
||||||
class IEditor;
|
namespace CPlusPlus { class LookupContext; }
|
||||||
}
|
namespace ProjectExplorer { class Project; }
|
||||||
|
|
||||||
namespace CPlusPlus {
|
|
||||||
class LookupContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
|
||||||
class Project;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
class AbstractEditorSupport;
|
class AbstractEditorSupport;
|
||||||
@@ -61,9 +53,6 @@ namespace CppTools {
|
|||||||
class CppHighlightingSupport;
|
class CppHighlightingSupport;
|
||||||
class CppHighlightingSupportFactory;
|
class CppHighlightingSupportFactory;
|
||||||
class CppIndexingSupport;
|
class CppIndexingSupport;
|
||||||
}
|
|
||||||
|
|
||||||
namespace CPlusPlus {
|
|
||||||
|
|
||||||
class CPPTOOLS_EXPORT ProjectPart
|
class CPPTOOLS_EXPORT ProjectPart
|
||||||
{
|
{
|
||||||
@@ -268,6 +257,6 @@ public Q_SLOTS:
|
|||||||
virtual void GC() = 0;
|
virtual void GC() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CPlusPlus
|
} // namespace CppTools
|
||||||
|
|
||||||
#endif // CPPMODELMANAGERINTERFACE_H
|
#endif // CPPMODELMANAGERINTERFACE_H
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
#include <cplusplus/Symbols.h>
|
#include <cplusplus/Symbols.h>
|
||||||
#include <cplusplus/TranslationUnit.h>
|
#include <cplusplus/TranslationUnit.h>
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CppTools;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ QString unqualifyName(const QString &qualifiedName)
|
|||||||
return qualifiedName.right(qualifiedName.length() - index - 2);
|
return qualifiedName.right(qualifiedName.length() - index - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
class DerivedHierarchyVisitor : public SymbolVisitor
|
class DerivedHierarchyVisitor : public CPlusPlus::SymbolVisitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DerivedHierarchyVisitor(const QString &qualifiedName)
|
DerivedHierarchyVisitor(const QString &qualifiedName)
|
||||||
@@ -58,47 +58,48 @@ public:
|
|||||||
, _unqualifiedName(unqualifyName(qualifiedName))
|
, _unqualifiedName(unqualifyName(qualifiedName))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void execute(const Document::Ptr &doc, const Snapshot &snapshot);
|
void execute(const CPlusPlus::Document::Ptr &doc, const CPlusPlus::Snapshot &snapshot);
|
||||||
|
|
||||||
virtual bool visit(Class *);
|
virtual bool visit(CPlusPlus::Class *);
|
||||||
|
|
||||||
const QList<Symbol *> &derived() { return _derived; }
|
const QList<CPlusPlus::Symbol *> &derived() { return _derived; }
|
||||||
const QStringList otherBases() { return _otherBases; }
|
const QStringList otherBases() { return _otherBases; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LookupContext _context;
|
CPlusPlus::LookupContext _context;
|
||||||
QString _qualifiedName;
|
QString _qualifiedName;
|
||||||
QString _unqualifiedName;
|
QString _unqualifiedName;
|
||||||
Overview _overview;
|
CPlusPlus::Overview _overview;
|
||||||
QHash<Symbol *, QString> _actualBases;
|
QHash<CPlusPlus::Symbol *, QString> _actualBases;
|
||||||
QStringList _otherBases;
|
QStringList _otherBases;
|
||||||
QList<Symbol *> _derived;
|
QList<CPlusPlus::Symbol *> _derived;
|
||||||
};
|
};
|
||||||
|
|
||||||
void DerivedHierarchyVisitor::execute(const Document::Ptr &doc, const Snapshot &snapshot)
|
void DerivedHierarchyVisitor::execute(const CPlusPlus::Document::Ptr &doc,
|
||||||
|
const CPlusPlus::Snapshot &snapshot)
|
||||||
{
|
{
|
||||||
_derived.clear();
|
_derived.clear();
|
||||||
_otherBases.clear();
|
_otherBases.clear();
|
||||||
_context = LookupContext(doc, snapshot);
|
_context = CPlusPlus::LookupContext(doc, snapshot);
|
||||||
|
|
||||||
for (unsigned i = 0; i < doc->globalSymbolCount(); ++i)
|
for (unsigned i = 0; i < doc->globalSymbolCount(); ++i)
|
||||||
accept(doc->globalSymbolAt(i));
|
accept(doc->globalSymbolAt(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DerivedHierarchyVisitor::visit(Class *symbol)
|
bool DerivedHierarchyVisitor::visit(CPlusPlus::Class *symbol)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < symbol->baseClassCount(); ++i) {
|
for (unsigned i = 0; i < symbol->baseClassCount(); ++i) {
|
||||||
BaseClass *baseSymbol = symbol->baseClassAt(i);
|
CPlusPlus::BaseClass *baseSymbol = symbol->baseClassAt(i);
|
||||||
|
|
||||||
QString baseName = _actualBases.value(baseSymbol);
|
QString baseName = _actualBases.value(baseSymbol);
|
||||||
if (baseName.isEmpty()) {
|
if (baseName.isEmpty()) {
|
||||||
QList<LookupItem> items = _context.lookup(baseSymbol->name(), symbol->enclosingScope());
|
QList<CPlusPlus::LookupItem> items = _context.lookup(baseSymbol->name(), symbol->enclosingScope());
|
||||||
if (items.isEmpty() || !items.first().declaration())
|
if (items.isEmpty() || !items.first().declaration())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Symbol *actualBaseSymbol = items.first().declaration();
|
CPlusPlus::Symbol *actualBaseSymbol = items.first().declaration();
|
||||||
if (actualBaseSymbol->isTypedef()) {
|
if (actualBaseSymbol->isTypedef()) {
|
||||||
NamedType *namedType = actualBaseSymbol->type()->asNamedType();
|
CPlusPlus::NamedType *namedType = actualBaseSymbol->type()->asNamedType();
|
||||||
if (!namedType) {
|
if (!namedType) {
|
||||||
// Anonymous aggregate such as: typedef struct {} Empty;
|
// Anonymous aggregate such as: typedef struct {} Empty;
|
||||||
continue;
|
continue;
|
||||||
@@ -112,7 +113,8 @@ bool DerivedHierarchyVisitor::visit(Class *symbol)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const QList<const Name *> &full = LookupContext::fullyQualifiedName(actualBaseSymbol);
|
const QList<const CPlusPlus::Name *> &full
|
||||||
|
= CPlusPlus::LookupContext::fullyQualifiedName(actualBaseSymbol);
|
||||||
baseName = _overview.prettyName(full);
|
baseName = _overview.prettyName(full);
|
||||||
_actualBases.insert(baseSymbol, baseName);
|
_actualBases.insert(baseSymbol, baseName);
|
||||||
}
|
}
|
||||||
@@ -126,15 +128,15 @@ bool DerivedHierarchyVisitor::visit(Class *symbol)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
TypeHierarchy::TypeHierarchy() : _symbol(0)
|
TypeHierarchy::TypeHierarchy() : _symbol(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
TypeHierarchy::TypeHierarchy(Symbol *symbol) : _symbol(symbol)
|
TypeHierarchy::TypeHierarchy(CPlusPlus::Symbol *symbol) : _symbol(symbol)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Symbol *TypeHierarchy::symbol() const
|
CPlusPlus::Symbol *TypeHierarchy::symbol() const
|
||||||
{
|
{
|
||||||
return _symbol;
|
return _symbol;
|
||||||
}
|
}
|
||||||
@@ -144,12 +146,12 @@ const QList<TypeHierarchy> &TypeHierarchy::hierarchy() const
|
|||||||
return _hierarchy;
|
return _hierarchy;
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeHierarchyBuilder::TypeHierarchyBuilder(Symbol *symbol, const Snapshot &snapshot)
|
TypeHierarchyBuilder::TypeHierarchyBuilder(CPlusPlus::Symbol *symbol, const CPlusPlus::Snapshot &snapshot)
|
||||||
: _symbol(symbol)
|
: _symbol(symbol)
|
||||||
, _snapshot(snapshot)
|
, _snapshot(snapshot)
|
||||||
, _dependencies(QString::fromUtf8(symbol->fileName(), symbol->fileNameLength()))
|
, _dependencies(QString::fromUtf8(symbol->fileName(), symbol->fileNameLength()))
|
||||||
{
|
{
|
||||||
DependencyTable dependencyTable;
|
CPlusPlus::DependencyTable dependencyTable;
|
||||||
dependencyTable.build(_snapshot);
|
dependencyTable.build(_snapshot);
|
||||||
_dependencies.append(dependencyTable.filesDependingOn(_dependencies.first()));
|
_dependencies.append(dependencyTable.filesDependingOn(_dependencies.first()));
|
||||||
}
|
}
|
||||||
@@ -170,17 +172,17 @@ TypeHierarchy TypeHierarchyBuilder::buildDerivedTypeHierarchy()
|
|||||||
|
|
||||||
void TypeHierarchyBuilder::buildDerived(TypeHierarchy *typeHierarchy)
|
void TypeHierarchyBuilder::buildDerived(TypeHierarchy *typeHierarchy)
|
||||||
{
|
{
|
||||||
Symbol *symbol = typeHierarchy->_symbol;
|
CPlusPlus::Symbol *symbol = typeHierarchy->_symbol;
|
||||||
if (_visited.contains(symbol))
|
if (_visited.contains(symbol))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_visited.insert(symbol);
|
_visited.insert(symbol);
|
||||||
|
|
||||||
const QString &symbolName = _overview.prettyName(LookupContext::fullyQualifiedName(symbol));
|
const QString &symbolName = _overview.prettyName(CPlusPlus::LookupContext::fullyQualifiedName(symbol));
|
||||||
DerivedHierarchyVisitor visitor(symbolName);
|
DerivedHierarchyVisitor visitor(symbolName);
|
||||||
|
|
||||||
foreach (const QString &fileName, _dependencies) {
|
foreach (const QString &fileName, _dependencies) {
|
||||||
Document::Ptr doc = _snapshot.document(fileName);
|
CPlusPlus::Document::Ptr doc = _snapshot.document(fileName);
|
||||||
if ((_candidates.contains(fileName) && !_candidates.value(fileName).contains(symbolName))
|
if ((_candidates.contains(fileName) && !_candidates.value(fileName).contains(symbolName))
|
||||||
|| !doc->control()->findIdentifier(symbol->identifier()->chars(),
|
|| !doc->control()->findIdentifier(symbol->identifier()->chars(),
|
||||||
symbol->identifier()->size())) {
|
symbol->identifier()->size())) {
|
||||||
@@ -193,7 +195,7 @@ void TypeHierarchyBuilder::buildDerived(TypeHierarchy *typeHierarchy)
|
|||||||
foreach (const QString &candidate, visitor.otherBases())
|
foreach (const QString &candidate, visitor.otherBases())
|
||||||
_candidates[fileName].insert(candidate);
|
_candidates[fileName].insert(candidate);
|
||||||
|
|
||||||
foreach (Symbol *s, visitor.derived()) {
|
foreach (CPlusPlus::Symbol *s, visitor.derived()) {
|
||||||
TypeHierarchy derivedHierarchy(s);
|
TypeHierarchy derivedHierarchy(s);
|
||||||
buildDerived(&derivedHierarchy);
|
buildDerived(&derivedHierarchy);
|
||||||
typeHierarchy->_hierarchy.append(derivedHierarchy);
|
typeHierarchy->_hierarchy.append(derivedHierarchy);
|
||||||
|
|||||||
@@ -27,8 +27,8 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef TYPEHIERARCHYBUILDER_H
|
#ifndef CPPTOOLS_TYPEHIERARCHYBUILDER_H
|
||||||
#define TYPEHIERARCHYBUILDER_H
|
#define CPPTOOLS_TYPEHIERARCHYBUILDER_H
|
||||||
|
|
||||||
#include "cpptools_global.h"
|
#include "cpptools_global.h"
|
||||||
#include "ModelManagerInterface.h"
|
#include "ModelManagerInterface.h"
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
|
||||||
namespace CPlusPlus {
|
namespace CppTools {
|
||||||
|
|
||||||
class CPPTOOLS_EXPORT TypeHierarchy
|
class CPPTOOLS_EXPORT TypeHierarchy
|
||||||
{
|
{
|
||||||
@@ -48,20 +48,20 @@ class CPPTOOLS_EXPORT TypeHierarchy
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
TypeHierarchy();
|
TypeHierarchy();
|
||||||
TypeHierarchy(Symbol *symbol);
|
TypeHierarchy(CPlusPlus::Symbol *symbol);
|
||||||
|
|
||||||
Symbol *symbol() const;
|
CPlusPlus::Symbol *symbol() const;
|
||||||
const QList<TypeHierarchy> &hierarchy() const;
|
const QList<TypeHierarchy> &hierarchy() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Symbol *_symbol;
|
CPlusPlus::Symbol *_symbol;
|
||||||
QList<TypeHierarchy> _hierarchy;
|
QList<TypeHierarchy> _hierarchy;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPPTOOLS_EXPORT TypeHierarchyBuilder
|
class CPPTOOLS_EXPORT TypeHierarchyBuilder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TypeHierarchyBuilder(Symbol *symbol, const Snapshot &snapshot);
|
TypeHierarchyBuilder(CPlusPlus::Symbol *symbol, const CPlusPlus::Snapshot &snapshot);
|
||||||
|
|
||||||
TypeHierarchy buildDerivedTypeHierarchy();
|
TypeHierarchy buildDerivedTypeHierarchy();
|
||||||
|
|
||||||
@@ -69,14 +69,14 @@ private:
|
|||||||
void reset();
|
void reset();
|
||||||
void buildDerived(TypeHierarchy *typeHierarchy);
|
void buildDerived(TypeHierarchy *typeHierarchy);
|
||||||
|
|
||||||
Symbol *_symbol;
|
CPlusPlus::Symbol *_symbol;
|
||||||
Snapshot _snapshot;
|
CPlusPlus::Snapshot _snapshot;
|
||||||
QStringList _dependencies;
|
QStringList _dependencies;
|
||||||
QSet<Symbol *> _visited;
|
QSet<CPlusPlus::Symbol *> _visited;
|
||||||
QHash<QString, QSet<QString> > _candidates;
|
QHash<QString, QSet<QString> > _candidates;
|
||||||
Overview _overview;
|
CPlusPlus::Overview _overview;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // CPlusPlus
|
} // CppTools
|
||||||
|
|
||||||
#endif // TYPEHIERARCHYBUILDER_H
|
#endif // CPPTOOLS_TYPEHIERARCHYBUILDER_H
|
||||||
|
|||||||
@@ -45,8 +45,6 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
|
||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
|
|
||||||
AbstractEditorSupport::AbstractEditorSupport(CppModelManagerInterface *modelmanager) :
|
AbstractEditorSupport::AbstractEditorSupport(CppModelManagerInterface *modelmanager) :
|
||||||
@@ -97,5 +95,6 @@ QString AbstractEditorSupport::licenseTemplate(const QString &file, const QStrin
|
|||||||
{
|
{
|
||||||
return Internal::CppFileSettings::licenseTemplate(file, className);
|
return Internal::CppFileSettings::licenseTemplate(file, className);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
} // namespace CppTools
|
||||||
|
|
||||||
|
|||||||
@@ -34,16 +34,13 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
namespace CPlusPlus {
|
|
||||||
class CppModelManagerInterface;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
|
class CppModelManagerInterface;
|
||||||
|
|
||||||
class CPPTOOLS_EXPORT AbstractEditorSupport
|
class CPPTOOLS_EXPORT AbstractEditorSupport
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit AbstractEditorSupport(CPlusPlus::CppModelManagerInterface *modelmanager);
|
explicit AbstractEditorSupport(CppModelManagerInterface *modelmanager);
|
||||||
virtual ~AbstractEditorSupport();
|
virtual ~AbstractEditorSupport();
|
||||||
|
|
||||||
virtual QByteArray contents() const = 0;
|
virtual QByteArray contents() const = 0;
|
||||||
@@ -52,16 +49,16 @@ public:
|
|||||||
void updateDocument();
|
void updateDocument();
|
||||||
|
|
||||||
// TODO: find a better place for common utility functions
|
// TODO: find a better place for common utility functions
|
||||||
static QString functionAt(const CPlusPlus::CppModelManagerInterface *mm,
|
static QString functionAt(const CppModelManagerInterface *mm,
|
||||||
const QString &fileName,
|
const QString &fileName,
|
||||||
int line, int column);
|
int line, int column);
|
||||||
|
|
||||||
static QString licenseTemplate(const QString &file = QString(), const QString &className = QString());
|
static QString licenseTemplate(const QString &file = QString(), const QString &className = QString());
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CPlusPlus::CppModelManagerInterface *m_modelmanager;
|
CppModelManagerInterface *m_modelmanager;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace CppTools
|
||||||
|
|
||||||
#endif // ABSTRACTEDITORSUPPORT_H
|
#endif // ABSTRACTEDITORSUPPORT_H
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ static void parse(QFutureInterface<void> &future,
|
|||||||
|
|
||||||
future.setProgressRange(0, files.size());
|
future.setProgressRange(0, files.size());
|
||||||
|
|
||||||
const QString conf = CPlusPlus::CppModelManagerInterface::configurationFileName();
|
const QString conf = CppModelManagerInterface::configurationFileName();
|
||||||
bool processingHeaders = false;
|
bool processingHeaders = false;
|
||||||
|
|
||||||
for (int i = 0; i < files.size(); ++i) {
|
for (int i = 0; i < files.size(); ++i) {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace Internal {
|
|||||||
|
|
||||||
class BuiltinIndexingSupport: public CppIndexingSupport {
|
class BuiltinIndexingSupport: public CppIndexingSupport {
|
||||||
public:
|
public:
|
||||||
typedef CPlusPlus::CppModelManagerInterface::WorkingCopy WorkingCopy;
|
typedef CppModelManagerInterface::WorkingCopy WorkingCopy;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BuiltinIndexingSupport();
|
BuiltinIndexingSupport();
|
||||||
|
|||||||
@@ -44,10 +44,10 @@
|
|||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
#include <QtConcurrentRun>
|
#include <QtConcurrentRun>
|
||||||
|
|
||||||
namespace CPlusPlus {
|
namespace CppTools {
|
||||||
|
|
||||||
class CPPTOOLS_EXPORT CheckSymbols:
|
class CPPTOOLS_EXPORT CheckSymbols:
|
||||||
protected ASTVisitor,
|
protected CPlusPlus::ASTVisitor,
|
||||||
public QRunnable,
|
public QRunnable,
|
||||||
public QFutureInterface<TextEditor::SemanticHighlighter::Result>
|
public QFutureInterface<TextEditor::SemanticHighlighter::Result>
|
||||||
{
|
{
|
||||||
@@ -70,7 +70,9 @@ public:
|
|||||||
return future;
|
return future;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future go(Document::Ptr doc, const LookupContext &context, const QList<Use> ¯oUses);
|
static Future go(CPlusPlus::Document::Ptr doc,
|
||||||
|
const CPlusPlus::LookupContext &context,
|
||||||
|
const QList<Use> ¯oUses);
|
||||||
|
|
||||||
static QMap<int, QVector<Use> > chunks(const QFuture<Use> &future, int from, int to)
|
static QMap<int, QVector<Use> > chunks(const QFuture<Use> &future, int from, int to)
|
||||||
{
|
{
|
||||||
@@ -92,93 +94,98 @@ protected:
|
|||||||
using ASTVisitor::visit;
|
using ASTVisitor::visit;
|
||||||
using ASTVisitor::endVisit;
|
using ASTVisitor::endVisit;
|
||||||
|
|
||||||
CheckSymbols(Document::Ptr doc, const LookupContext &context, const QList<Use> ¯oUses);
|
CheckSymbols(CPlusPlus::Document::Ptr doc,
|
||||||
|
const CPlusPlus::LookupContext &context,
|
||||||
|
const QList<Use> ¯oUses);
|
||||||
|
|
||||||
bool hasVirtualDestructor(Class *klass) const;
|
bool hasVirtualDestructor(CPlusPlus::Class *klass) const;
|
||||||
bool hasVirtualDestructor(ClassOrNamespace *binding) const;
|
bool hasVirtualDestructor(CPlusPlus::ClassOrNamespace *binding) const;
|
||||||
|
|
||||||
bool warning(unsigned line, unsigned column, const QString &text, unsigned length = 0);
|
bool warning(unsigned line, unsigned column, const QString &text, unsigned length = 0);
|
||||||
bool warning(AST *ast, const QString &text);
|
bool warning(CPlusPlus::AST *ast, const QString &text);
|
||||||
|
|
||||||
QByteArray textOf(AST *ast) const;
|
QByteArray textOf(CPlusPlus::AST *ast) const;
|
||||||
|
|
||||||
bool maybeType(const Name *name) const;
|
bool maybeType(const CPlusPlus::Name *name) const;
|
||||||
bool maybeField(const Name *name) const;
|
bool maybeField(const CPlusPlus::Name *name) const;
|
||||||
bool maybeStatic(const Name *name) const;
|
bool maybeStatic(const CPlusPlus::Name *name) const;
|
||||||
bool maybeFunction(const Name *name) const;
|
bool maybeFunction(const CPlusPlus::Name *name) const;
|
||||||
|
|
||||||
void checkNamespace(NameAST *name);
|
void checkNamespace(CPlusPlus::NameAST *name);
|
||||||
void checkName(NameAST *ast, Scope *scope = 0);
|
void checkName(CPlusPlus::NameAST *ast, CPlusPlus::Scope *scope = 0);
|
||||||
ClassOrNamespace *checkNestedName(QualifiedNameAST *ast);
|
CPlusPlus::ClassOrNamespace *checkNestedName(CPlusPlus::QualifiedNameAST *ast);
|
||||||
|
|
||||||
void addUse(const Use &use);
|
void addUse(const Use &use);
|
||||||
void addUse(unsigned tokenIndex, UseKind kind);
|
void addUse(unsigned tokenIndex, UseKind kind);
|
||||||
void addUse(NameAST *name, UseKind kind);
|
void addUse(CPlusPlus::NameAST *name, UseKind kind);
|
||||||
|
|
||||||
void addType(ClassOrNamespace *b, NameAST *ast);
|
void addType(CPlusPlus::ClassOrNamespace *b, CPlusPlus::NameAST *ast);
|
||||||
|
|
||||||
bool maybeAddTypeOrStatic(const QList<LookupItem> &candidates, NameAST *ast);
|
bool maybeAddTypeOrStatic(const QList<CPlusPlus::LookupItem> &candidates,
|
||||||
bool maybeAddField(const QList<LookupItem> &candidates, NameAST *ast);
|
CPlusPlus::NameAST *ast);
|
||||||
bool maybeAddFunction(const QList<LookupItem> &candidates, NameAST *ast, unsigned argumentCount);
|
bool maybeAddField(const QList<CPlusPlus::LookupItem> &candidates,
|
||||||
|
CPlusPlus::NameAST *ast);
|
||||||
|
bool maybeAddFunction(const QList<CPlusPlus::LookupItem> &candidates,
|
||||||
|
CPlusPlus::NameAST *ast, unsigned argumentCount);
|
||||||
|
|
||||||
bool isTemplateClass(Symbol *s) const;
|
bool isTemplateClass(CPlusPlus::Symbol *s) const;
|
||||||
|
|
||||||
Scope *enclosingScope() const;
|
CPlusPlus::Scope *enclosingScope() const;
|
||||||
FunctionDefinitionAST *enclosingFunctionDefinition(bool skipTopOfStack = false) const;
|
CPlusPlus::FunctionDefinitionAST *enclosingFunctionDefinition(bool skipTopOfStack = false) const;
|
||||||
TemplateDeclarationAST *enclosingTemplateDeclaration() const;
|
CPlusPlus::TemplateDeclarationAST *enclosingTemplateDeclaration() const;
|
||||||
|
|
||||||
virtual bool preVisit(AST *);
|
virtual bool preVisit(CPlusPlus::AST *);
|
||||||
virtual void postVisit(AST *);
|
virtual void postVisit(CPlusPlus::AST *);
|
||||||
|
|
||||||
virtual bool visit(NamespaceAST *);
|
virtual bool visit(CPlusPlus::NamespaceAST *);
|
||||||
virtual bool visit(UsingDirectiveAST *);
|
virtual bool visit(CPlusPlus::UsingDirectiveAST *);
|
||||||
virtual bool visit(SimpleDeclarationAST *);
|
virtual bool visit(CPlusPlus::SimpleDeclarationAST *);
|
||||||
virtual bool visit(TypenameTypeParameterAST *ast);
|
virtual bool visit(CPlusPlus::TypenameTypeParameterAST *ast);
|
||||||
virtual bool visit(TemplateTypeParameterAST *ast);
|
virtual bool visit(CPlusPlus::TemplateTypeParameterAST *ast);
|
||||||
virtual bool visit(FunctionDefinitionAST *ast);
|
virtual bool visit(CPlusPlus::FunctionDefinitionAST *ast);
|
||||||
virtual bool visit(ParameterDeclarationAST *ast);
|
virtual bool visit(CPlusPlus::ParameterDeclarationAST *ast);
|
||||||
|
|
||||||
virtual bool visit(ElaboratedTypeSpecifierAST *ast);
|
virtual bool visit(CPlusPlus::ElaboratedTypeSpecifierAST *ast);
|
||||||
|
|
||||||
virtual bool visit(SimpleNameAST *ast);
|
virtual bool visit(CPlusPlus::SimpleNameAST *ast);
|
||||||
virtual bool visit(DestructorNameAST *ast);
|
virtual bool visit(CPlusPlus::DestructorNameAST *ast);
|
||||||
virtual bool visit(QualifiedNameAST *ast);
|
virtual bool visit(CPlusPlus::QualifiedNameAST *ast);
|
||||||
virtual bool visit(TemplateIdAST *ast);
|
virtual bool visit(CPlusPlus::TemplateIdAST *ast);
|
||||||
|
|
||||||
virtual bool visit(MemberAccessAST *ast);
|
virtual bool visit(CPlusPlus::MemberAccessAST *ast);
|
||||||
virtual bool visit(CallAST *ast);
|
virtual bool visit(CPlusPlus::CallAST *ast);
|
||||||
virtual bool visit(NewExpressionAST *ast);
|
virtual bool visit(CPlusPlus::NewExpressionAST *ast);
|
||||||
|
|
||||||
virtual bool visit(GotoStatementAST *ast);
|
virtual bool visit(CPlusPlus::GotoStatementAST *ast);
|
||||||
virtual bool visit(LabeledStatementAST *ast);
|
virtual bool visit(CPlusPlus::LabeledStatementAST *ast);
|
||||||
virtual bool visit(SimpleSpecifierAST *ast);
|
virtual bool visit(CPlusPlus::SimpleSpecifierAST *ast);
|
||||||
virtual bool visit(ClassSpecifierAST *ast);
|
virtual bool visit(CPlusPlus::ClassSpecifierAST *ast);
|
||||||
|
|
||||||
virtual bool visit(MemInitializerAST *ast);
|
virtual bool visit(CPlusPlus::MemInitializerAST *ast);
|
||||||
virtual bool visit(EnumeratorAST *ast);
|
virtual bool visit(CPlusPlus::EnumeratorAST *ast);
|
||||||
|
|
||||||
NameAST *declaratorId(DeclaratorAST *ast) const;
|
CPlusPlus::NameAST *declaratorId(CPlusPlus::DeclaratorAST *ast) const;
|
||||||
|
|
||||||
static unsigned referenceToken(NameAST *name);
|
static unsigned referenceToken(CPlusPlus::NameAST *name);
|
||||||
|
|
||||||
void flush();
|
void flush();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Document::Ptr _doc;
|
CPlusPlus::Document::Ptr _doc;
|
||||||
LookupContext _context;
|
CPlusPlus::LookupContext _context;
|
||||||
TypeOfExpression typeOfExpression;
|
CPlusPlus::TypeOfExpression typeOfExpression;
|
||||||
QString _fileName;
|
QString _fileName;
|
||||||
QSet<QByteArray> _potentialTypes;
|
QSet<QByteArray> _potentialTypes;
|
||||||
QSet<QByteArray> _potentialFields;
|
QSet<QByteArray> _potentialFields;
|
||||||
QSet<QByteArray> _potentialFunctions;
|
QSet<QByteArray> _potentialFunctions;
|
||||||
QSet<QByteArray> _potentialStatics;
|
QSet<QByteArray> _potentialStatics;
|
||||||
QList<AST *> _astStack;
|
QList<CPlusPlus::AST *> _astStack;
|
||||||
QVector<Use> _usages;
|
QVector<Use> _usages;
|
||||||
int _chunkSize;
|
int _chunkSize;
|
||||||
unsigned _lineOfLastUsage;
|
unsigned _lineOfLastUsage;
|
||||||
QList<Use> _macroUses;
|
QList<Use> _macroUses;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CPlusPlus
|
} // namespace CppTools
|
||||||
|
|
||||||
#endif // CPLUSPLUSCHECKSYMBOLS_H
|
#endif // CPLUSPLUSCHECKSYMBOLS_H
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class LookupItem;
|
|||||||
class ClassOrNamespace;
|
class ClassOrNamespace;
|
||||||
class Function;
|
class Function;
|
||||||
class LookupContext;
|
class LookupContext;
|
||||||
}
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|||||||
@@ -70,6 +70,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
using namespace CppTools::Internal;
|
using namespace CppTools::Internal;
|
||||||
|
using namespace CppTools;
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
static QString getSource(const QString &fileName,
|
static QString getSource(const QString &fileName,
|
||||||
|
|||||||
@@ -50,11 +50,9 @@ namespace Find {
|
|||||||
class SearchResult;
|
class SearchResult;
|
||||||
} // namespace Find
|
} // namespace Find
|
||||||
|
|
||||||
namespace CPlusPlus {
|
|
||||||
class CppModelManagerInterface;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
|
class CppModelManagerInterface;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class CppFindReferencesParameters
|
class CppFindReferencesParameters
|
||||||
@@ -69,7 +67,7 @@ class CppFindReferences: public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CppFindReferences(CPlusPlus::CppModelManagerInterface *modelManager);
|
CppFindReferences(CppModelManagerInterface *modelManager);
|
||||||
virtual ~CppFindReferences();
|
virtual ~CppFindReferences();
|
||||||
|
|
||||||
QList<int> references(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context) const;
|
QList<int> references(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context) const;
|
||||||
@@ -106,7 +104,7 @@ private:
|
|||||||
const CPlusPlus::Snapshot &snapshot);
|
const CPlusPlus::Snapshot &snapshot);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer<CPlusPlus::CppModelManagerInterface> _modelManager;
|
QPointer<CppModelManagerInterface> _modelManager;
|
||||||
QMap<QFutureWatcher<CPlusPlus::Usage> *, QPointer<Find::SearchResult> > m_watchers;
|
QMap<QFutureWatcher<CPlusPlus::Usage> *, QPointer<Find::SearchResult> > m_watchers;
|
||||||
|
|
||||||
mutable QMutex m_depsLock;
|
mutable QMutex m_depsLock;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
namespace CPlusPlus {
|
namespace CppTools {
|
||||||
|
|
||||||
uint qHash(const ProjectPart &p)
|
uint qHash(const ProjectPart &p)
|
||||||
{
|
{
|
||||||
@@ -119,7 +119,7 @@ bool operator==(const ProjectPart &p1,
|
|||||||
return p1.frameworkPaths == p2.frameworkPaths;
|
return p1.frameworkPaths == p2.frameworkPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CPlusPlus
|
} // namespace CppTools
|
||||||
|
|
||||||
using namespace CppTools;
|
using namespace CppTools;
|
||||||
using namespace CppTools::Internal;
|
using namespace CppTools::Internal;
|
||||||
|
|||||||
@@ -49,22 +49,16 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QTextEdit> // for QTextEdit::ExtraSelection
|
#include <QTextEdit> // for QTextEdit::ExtraSelection
|
||||||
|
|
||||||
namespace Core {
|
namespace Core { class IEditor; }
|
||||||
class IEditor;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
class ITextEditor;
|
class ITextEditor;
|
||||||
class BaseTextEditorWidget;
|
class BaseTextEditorWidget;
|
||||||
}
|
} // namespace TextEditor
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer { class ProjectExplorerPlugin; }
|
||||||
class ProjectExplorerPlugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace CPlusPlus {
|
namespace CPlusPlus { class ParseManager; }
|
||||||
class ParseManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
|
|
||||||
@@ -77,7 +71,7 @@ class CppEditorSupport;
|
|||||||
class CppPreprocessor;
|
class CppPreprocessor;
|
||||||
class CppFindReferences;
|
class CppFindReferences;
|
||||||
|
|
||||||
class CPPTOOLS_EXPORT CppModelManager : public CPlusPlus::CppModelManagerInterface
|
class CPPTOOLS_EXPORT CppModelManager : public CppTools::CppModelManagerInterface
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -96,7 +90,7 @@ public:
|
|||||||
virtual QList<ProjectInfo> projectInfos() const;
|
virtual QList<ProjectInfo> projectInfos() const;
|
||||||
virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const;
|
virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const;
|
||||||
virtual void updateProjectInfo(const ProjectInfo &pinfo);
|
virtual void updateProjectInfo(const ProjectInfo &pinfo);
|
||||||
virtual QList<CPlusPlus::ProjectPart::Ptr> projectPart(const QString &fileName) const;
|
virtual QList<CppTools::ProjectPart::Ptr> projectPart(const QString &fileName) const;
|
||||||
|
|
||||||
virtual CPlusPlus::Snapshot snapshot() const;
|
virtual CPlusPlus::Snapshot snapshot() const;
|
||||||
virtual Document::Ptr document(const QString &fileName) const;
|
virtual Document::Ptr document(const QString &fileName) const;
|
||||||
@@ -246,7 +240,7 @@ private:
|
|||||||
mutable QMutex m_protectExtraDiagnostics;
|
mutable QMutex m_protectExtraDiagnostics;
|
||||||
QHash<QString, QHash<int, QList<Document::DiagnosticMessage> > > m_extraDiagnostics;
|
QHash<QString, QHash<int, QList<Document::DiagnosticMessage> > > m_extraDiagnostics;
|
||||||
|
|
||||||
QMap<QString, QList<CPlusPlus::ProjectPart::Ptr> > m_srcToProjectPart;
|
QMap<QString, QList<CppTools::ProjectPart::Ptr> > m_srcToProjectPart;
|
||||||
|
|
||||||
CppCompletionAssistProvider *m_completionAssistProvider;
|
CppCompletionAssistProvider *m_completionAssistProvider;
|
||||||
CppCompletionAssistProvider *m_completionFallback;
|
CppCompletionAssistProvider *m_completionFallback;
|
||||||
@@ -265,7 +259,7 @@ public:
|
|||||||
virtual ~CppPreprocessor();
|
virtual ~CppPreprocessor();
|
||||||
|
|
||||||
void setRevision(unsigned revision);
|
void setRevision(unsigned revision);
|
||||||
void setWorkingCopy(const CPlusPlus::CppModelManagerInterface::WorkingCopy &workingCopy);
|
void setWorkingCopy(const CppTools::CppModelManagerInterface::WorkingCopy &workingCopy);
|
||||||
void setIncludePaths(const QStringList &includePaths);
|
void setIncludePaths(const QStringList &includePaths);
|
||||||
void setFrameworkPaths(const QStringList &frameworkPaths);
|
void setFrameworkPaths(const QStringList &frameworkPaths);
|
||||||
void addFrameworkPath(const QString &frameworkPath);
|
void addFrameworkPath(const QString &frameworkPath);
|
||||||
@@ -316,7 +310,7 @@ private:
|
|||||||
CPlusPlus::Environment m_env;
|
CPlusPlus::Environment m_env;
|
||||||
CPlusPlus::Preprocessor m_preprocess;
|
CPlusPlus::Preprocessor m_preprocess;
|
||||||
QStringList m_includePaths;
|
QStringList m_includePaths;
|
||||||
CPlusPlus::CppModelManagerInterface::WorkingCopy m_workingCopy;
|
CppTools::CppModelManagerInterface::WorkingCopy m_workingCopy;
|
||||||
QStringList m_frameworkPaths;
|
QStringList m_frameworkPaths;
|
||||||
QSet<QString> m_included;
|
QSet<QString> m_included;
|
||||||
CPlusPlus::Document::Ptr m_currentDoc;
|
CPlusPlus::Document::Ptr m_currentDoc;
|
||||||
|
|||||||
@@ -40,9 +40,9 @@
|
|||||||
using namespace CppTools::Internal;
|
using namespace CppTools::Internal;
|
||||||
|
|
||||||
typedef CPlusPlus::Document Document;
|
typedef CPlusPlus::Document Document;
|
||||||
typedef CPlusPlus::CppModelManagerInterface::ProjectInfo ProjectInfo;
|
typedef CppTools::CppModelManagerInterface::ProjectInfo ProjectInfo;
|
||||||
typedef CPlusPlus::ProjectPart ProjectPart;
|
typedef CppTools::ProjectPart ProjectPart;
|
||||||
typedef CPlusPlus::ProjectFile ProjectFile;
|
typedef CppTools::ProjectFile ProjectFile;
|
||||||
typedef ProjectExplorer::Project Project;
|
typedef ProjectExplorer::Project Project;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
namespace CPlusPlus {
|
namespace CppTools {
|
||||||
|
|
||||||
ProjectFile::ProjectFile()
|
ProjectFile::ProjectFile()
|
||||||
: kind(CHeader)
|
: kind(CHeader)
|
||||||
@@ -81,24 +81,24 @@ void ProjectFileAdder::addMapping(const char *mimeName, ProjectFile::Kind kind)
|
|||||||
m_mapping.append(Pair(mimeType, kind));
|
m_mapping.append(Pair(mimeType, kind));
|
||||||
}
|
}
|
||||||
|
|
||||||
QDebug operator<<(QDebug stream, const CPlusPlus::ProjectFile &cxxFile)
|
QDebug operator<<(QDebug stream, const CppTools::ProjectFile &cxxFile)
|
||||||
{
|
{
|
||||||
const char *kind;
|
const char *kind;
|
||||||
switch (cxxFile.kind) {
|
switch (cxxFile.kind) {
|
||||||
case CPlusPlus::ProjectFile::CHeader: kind = "CHeader"; break;
|
case CppTools::ProjectFile::CHeader: kind = "CHeader"; break;
|
||||||
case CPlusPlus::ProjectFile::CSource: kind = "CSource"; break;
|
case CppTools::ProjectFile::CSource: kind = "CSource"; break;
|
||||||
case CPlusPlus::ProjectFile::CXXHeader: kind = "CXXHeader"; break;
|
case CppTools::ProjectFile::CXXHeader: kind = "CXXHeader"; break;
|
||||||
case CPlusPlus::ProjectFile::CXXSource: kind = "CXXSource"; break;
|
case CppTools::ProjectFile::CXXSource: kind = "CXXSource"; break;
|
||||||
case CPlusPlus::ProjectFile::ObjCHeader: kind = "ObjCHeader"; break;
|
case CppTools::ProjectFile::ObjCHeader: kind = "ObjCHeader"; break;
|
||||||
case CPlusPlus::ProjectFile::ObjCSource: kind = "ObjCSource"; break;
|
case CppTools::ProjectFile::ObjCSource: kind = "ObjCSource"; break;
|
||||||
case CPlusPlus::ProjectFile::ObjCXXHeader: kind = "ObjCXXHeader"; break;
|
case CppTools::ProjectFile::ObjCXXHeader: kind = "ObjCXXHeader"; break;
|
||||||
case CPlusPlus::ProjectFile::ObjCXXSource: kind = "ObjCXXSource"; break;
|
case CppTools::ProjectFile::ObjCXXSource: kind = "ObjCXXSource"; break;
|
||||||
case CPlusPlus::ProjectFile::CudaSource: kind = "CudaSource"; break;
|
case CppTools::ProjectFile::CudaSource: kind = "CudaSource"; break;
|
||||||
case CPlusPlus::ProjectFile::OpenCLSource: kind = "OpenCLSource"; break;
|
case CppTools::ProjectFile::OpenCLSource: kind = "OpenCLSource"; break;
|
||||||
default: kind = "INVALID"; break;
|
default: kind = "INVALID"; break;
|
||||||
}
|
}
|
||||||
stream << cxxFile.path << QLatin1String(", ") << kind;
|
stream << cxxFile.path << QLatin1String(", ") << kind;
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CPlusPlus
|
} // namespace CppTools
|
||||||
|
|||||||
@@ -27,8 +27,8 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef CPLUSPLUS_CPPPROJECTFILE_H
|
#ifndef CPPTOOLS_CPPPROJECTFILE_H
|
||||||
#define CPLUSPLUS_CPPPROJECTFILE_H
|
#define CPPTOOLS_CPPPROJECTFILE_H
|
||||||
|
|
||||||
#include "cpptools_global.h"
|
#include "cpptools_global.h"
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|
||||||
namespace CPlusPlus {
|
namespace CppTools {
|
||||||
|
|
||||||
class CPPTOOLS_EXPORT ProjectFile
|
class CPPTOOLS_EXPORT ProjectFile
|
||||||
{
|
{
|
||||||
@@ -81,8 +81,8 @@ private:
|
|||||||
QFileInfo m_fileInfo;
|
QFileInfo m_fileInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
QDebug operator<<(QDebug stream, const CPlusPlus::ProjectFile &cxxFile);
|
QDebug operator<<(QDebug stream, const CppTools::ProjectFile &cxxFile);
|
||||||
|
|
||||||
} // namespace CPlusPlus
|
} // namespace CppTools
|
||||||
|
|
||||||
#endif // CPLUSPLUS_CPPPROJECTFILE_H
|
#endif // CPPTOOLS_CPPPROJECTFILE_H
|
||||||
|
|||||||
@@ -87,9 +87,9 @@ public:
|
|||||||
m_modelManager->updateSourceFiles(QStringList(fileName));
|
m_modelManager->updateSourceFiles(QStringList(fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
CPlusPlus::Snapshot m_snapshot;
|
Snapshot m_snapshot;
|
||||||
CPlusPlus::CppModelManagerInterface *m_modelManager;
|
CppModelManagerInterface *m_modelManager;
|
||||||
CPlusPlus::CppModelManagerInterface::WorkingCopy m_workingCopy;
|
CppModelManagerInterface::WorkingCopy m_workingCopy;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -43,9 +43,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
class QTimer;
|
class QTimer;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace CPlusPlus {
|
namespace CPlusPlus { class AST; }
|
||||||
class AST;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
class ITextEditor;
|
class ITextEditor;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ QT_FORWARD_DECLARE_CLASS(QStringRef)
|
|||||||
namespace CPlusPlus {
|
namespace CPlusPlus {
|
||||||
class Symbol;
|
class Symbol;
|
||||||
class LookupContext;
|
class LookupContext;
|
||||||
}
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
|
|
||||||
|
|||||||
@@ -37,9 +37,7 @@
|
|||||||
#include <QLatin1String>
|
#include <QLatin1String>
|
||||||
#include <QTextCursor>
|
#include <QTextCursor>
|
||||||
|
|
||||||
namespace CPlusPlus {
|
namespace CPlusPlus { class DeclarationAST; }
|
||||||
class DeclarationAST;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
|
|
||||||
@@ -97,6 +95,6 @@ private:
|
|||||||
QString m_commentOffset;
|
QString m_commentOffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // CppTools
|
} // namespace CppTools
|
||||||
|
|
||||||
#endif // DOXYGENGENERATOR_H
|
#endif // DOXYGENGENERATOR_H
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class ModelManagerTestHelper: public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef CPlusPlus::CppModelManagerInterface::ProjectInfo ProjectInfo;
|
typedef CppModelManagerInterface::ProjectInfo ProjectInfo;
|
||||||
typedef ProjectExplorer::Project Project;
|
typedef ProjectExplorer::Project Project;
|
||||||
|
|
||||||
explicit ModelManagerTestHelper(QObject *parent = 0);
|
explicit ModelManagerTestHelper(QObject *parent = 0);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace CppTools {
|
|||||||
class CPPTOOLS_EXPORT UiCodeModelSupport : public AbstractEditorSupport
|
class CPPTOOLS_EXPORT UiCodeModelSupport : public AbstractEditorSupport
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
UiCodeModelSupport(CPlusPlus::CppModelManagerInterface *modelmanager,
|
UiCodeModelSupport(CppTools::CppModelManagerInterface *modelmanager,
|
||||||
const QString &sourceFile,
|
const QString &sourceFile,
|
||||||
const QString &uiHeaderFile);
|
const QString &uiHeaderFile);
|
||||||
~UiCodeModelSupport();
|
~UiCodeModelSupport();
|
||||||
|
|||||||
@@ -2611,18 +2611,18 @@ class BreakpointCorrectionContext
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit BreakpointCorrectionContext(const CPlusPlus::Snapshot &s,
|
explicit BreakpointCorrectionContext(const CPlusPlus::Snapshot &s,
|
||||||
const CPlusPlus::CppModelManagerInterface::WorkingCopy &workingCopy) :
|
const CppTools::CppModelManagerInterface::WorkingCopy &workingCopy) :
|
||||||
m_snapshot(s), m_workingCopy(workingCopy) {}
|
m_snapshot(s), m_workingCopy(workingCopy) {}
|
||||||
|
|
||||||
unsigned fixLineNumber(const QString &fileName, unsigned lineNumber) const;
|
unsigned fixLineNumber(const QString &fileName, unsigned lineNumber) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const CPlusPlus::Snapshot m_snapshot;
|
const CPlusPlus::Snapshot m_snapshot;
|
||||||
CPlusPlus::CppModelManagerInterface::WorkingCopy m_workingCopy;
|
CppTools::CppModelManagerInterface::WorkingCopy m_workingCopy;
|
||||||
};
|
};
|
||||||
|
|
||||||
static CPlusPlus::Document::Ptr getParsedDocument(const QString &fileName,
|
static CPlusPlus::Document::Ptr getParsedDocument(const QString &fileName,
|
||||||
const CPlusPlus::CppModelManagerInterface::WorkingCopy &workingCopy,
|
const CppTools::CppModelManagerInterface::WorkingCopy &workingCopy,
|
||||||
const CPlusPlus::Snapshot &snapshot)
|
const CPlusPlus::Snapshot &snapshot)
|
||||||
{
|
{
|
||||||
QString src;
|
QString src;
|
||||||
@@ -2729,7 +2729,7 @@ void CdbEngine::attemptBreakpointSynchronization()
|
|||||||
&& m_options->breakpointCorrection) {
|
&& m_options->breakpointCorrection) {
|
||||||
if (lineCorrection.isNull())
|
if (lineCorrection.isNull())
|
||||||
lineCorrection.reset(new BreakpointCorrectionContext(debuggerCore()->cppCodeModelSnapshot(),
|
lineCorrection.reset(new BreakpointCorrectionContext(debuggerCore()->cppCodeModelSnapshot(),
|
||||||
CPlusPlus::CppModelManagerInterface::instance()->workingCopy()));
|
CppTools::CppModelManagerInterface::instance()->workingCopy()));
|
||||||
response.lineNumber = lineCorrection->fixLineNumber(parameters.fileName, parameters.lineNumber);
|
response.lineNumber = lineCorrection->fixLineNumber(parameters.fileName, parameters.lineNumber);
|
||||||
postCommand(cdbAddBreakpointCommand(response, m_sourcePathMappings, id, false), 0);
|
postCommand(cdbAddBreakpointCommand(response, m_sourcePathMappings, id, false), 0);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -2489,7 +2489,7 @@ void DebuggerPluginPrivate::coreShutdown()
|
|||||||
const CPlusPlus::Snapshot &DebuggerPluginPrivate::cppCodeModelSnapshot() const
|
const CPlusPlus::Snapshot &DebuggerPluginPrivate::cppCodeModelSnapshot() const
|
||||||
{
|
{
|
||||||
if (m_codeModelSnapshot.isEmpty() && action(UseCodeModel)->isChecked())
|
if (m_codeModelSnapshot.isEmpty() && action(UseCodeModel)->isChecked())
|
||||||
m_codeModelSnapshot = CPlusPlus::CppModelManagerInterface::instance()->snapshot();
|
m_codeModelSnapshot = CppTools::CppModelManagerInterface::instance()->snapshot();
|
||||||
return m_codeModelSnapshot;
|
return m_codeModelSnapshot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ bool navigateToSlot(const QString &uiFileName,
|
|||||||
*errorMessage = QCoreApplication::translate("Designer", "The generated header of the form '%1' could not be found.\nRebuilding the project might help.").arg(uiFileName);
|
*errorMessage = QCoreApplication::translate("Designer", "The generated header of the form '%1' could not be found.\nRebuilding the project might help.").arg(uiFileName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const CPlusPlus::Snapshot snapshot = CPlusPlus::CppModelManagerInterface::instance()->snapshot();
|
const CPlusPlus::Snapshot snapshot = CppTools::CppModelManagerInterface::instance()->snapshot();
|
||||||
const DocumentPtr generatedHeaderDoc = snapshot.document(generatedHeaderFile);
|
const DocumentPtr generatedHeaderDoc = snapshot.document(generatedHeaderFile);
|
||||||
if (!generatedHeaderDoc) {
|
if (!generatedHeaderDoc) {
|
||||||
*errorMessage = QCoreApplication::translate("Designer", "The generated header '%1' could not be found in the code model.\nRebuilding the project might help.").arg(generatedHeaderFile);
|
*errorMessage = QCoreApplication::translate("Designer", "The generated header '%1' could not be found in the code model.\nRebuilding the project might help.").arg(generatedHeaderFile);
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ QWidget *QtCreatorIntegration::containerWindow(QWidget * /*widget*/) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QList<Document::Ptr> findDocumentsIncluding(const CPlusPlus::Snapshot &docTable,
|
static QList<Document::Ptr> findDocumentsIncluding(const Snapshot &docTable,
|
||||||
const QString &fileName, bool checkFileNameOnly)
|
const QString &fileName, bool checkFileNameOnly)
|
||||||
{
|
{
|
||||||
QList<Document::Ptr> docList;
|
QList<Document::Ptr> docList;
|
||||||
@@ -176,7 +176,8 @@ static bool matchMemberClassName(const QString &needle, const QString &hayStack)
|
|||||||
// Find class definition in namespace (that is, the outer class
|
// Find class definition in namespace (that is, the outer class
|
||||||
// containing a member of the desired class type) or inheriting the desired class
|
// containing a member of the desired class type) or inheriting the desired class
|
||||||
// in case of forms using the Multiple Inheritance approach
|
// in case of forms using the Multiple Inheritance approach
|
||||||
static const Class *findClass(const Namespace *parentNameSpace, const QString &className, QString *namespaceName)
|
static const Class *findClass(const Namespace *parentNameSpace,
|
||||||
|
const QString &className, QString *namespaceName)
|
||||||
{
|
{
|
||||||
if (Designer::Constants::Internal::debug)
|
if (Designer::Constants::Internal::debug)
|
||||||
qDebug() << Q_FUNC_INFO << className;
|
qDebug() << Q_FUNC_INFO << className;
|
||||||
@@ -253,7 +254,7 @@ static Function *findDeclaration(const Class *cl, const QString &functionName)
|
|||||||
// TODO: remove me, this is taken from cppeditor.cpp. Find some common place for this method
|
// TODO: remove me, this is taken from cppeditor.cpp. Find some common place for this method
|
||||||
static Document::Ptr findDefinition(Function *functionDeclaration, int *line)
|
static Document::Ptr findDefinition(Function *functionDeclaration, int *line)
|
||||||
{
|
{
|
||||||
if (CppModelManagerInterface *cppModelManager = CppModelManagerInterface::instance()) {
|
if (CppTools::CppModelManagerInterface *cppModelManager = CppTools::CppModelManagerInterface::instance()) {
|
||||||
const Snapshot snapshot = cppModelManager->snapshot();
|
const Snapshot snapshot = cppModelManager->snapshot();
|
||||||
CppTools::SymbolFinder symbolFinder;
|
CppTools::SymbolFinder symbolFinder;
|
||||||
if (Symbol *def = symbolFinder.findMatchingDefinition(functionDeclaration, snapshot)) {
|
if (Symbol *def = symbolFinder.findMatchingDefinition(functionDeclaration, snapshot)) {
|
||||||
@@ -304,7 +305,7 @@ static void addDeclaration(const Snapshot &snapshot,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Document::Ptr addDefinition(const CPlusPlus::Snapshot &docTable,
|
static Document::Ptr addDefinition(const Snapshot &docTable,
|
||||||
const QString &headerFileName,
|
const QString &headerFileName,
|
||||||
const QString &className,
|
const QString &className,
|
||||||
const QString &functionName,
|
const QString &functionName,
|
||||||
@@ -439,7 +440,7 @@ static QString addParameterNames(const QString &functionSignature, const QString
|
|||||||
typedef QPair<const Class *, Document::Ptr> ClassDocumentPtrPair;
|
typedef QPair<const Class *, Document::Ptr> ClassDocumentPtrPair;
|
||||||
|
|
||||||
static ClassDocumentPtrPair
|
static ClassDocumentPtrPair
|
||||||
findClassRecursively(const CPlusPlus::Snapshot &docTable,
|
findClassRecursively(const Snapshot &docTable,
|
||||||
const Document::Ptr &doc, const QString &className,
|
const Document::Ptr &doc, const QString &className,
|
||||||
unsigned maxIncludeDepth, QString *namespaceName)
|
unsigned maxIncludeDepth, QString *namespaceName)
|
||||||
{
|
{
|
||||||
@@ -452,7 +453,7 @@ static ClassDocumentPtrPair
|
|||||||
// Check the includes
|
// Check the includes
|
||||||
const unsigned recursionMaxIncludeDepth = maxIncludeDepth - 1u;
|
const unsigned recursionMaxIncludeDepth = maxIncludeDepth - 1u;
|
||||||
foreach (const QString &include, doc->includedFiles()) {
|
foreach (const QString &include, doc->includedFiles()) {
|
||||||
const CPlusPlus::Snapshot::const_iterator it = docTable.find(include);
|
const Snapshot::const_iterator it = docTable.find(include);
|
||||||
if (it != docTable.end()) {
|
if (it != docTable.end()) {
|
||||||
const Document::Ptr includeDoc = it.value();
|
const Document::Ptr includeDoc = it.value();
|
||||||
const ClassDocumentPtrPair irc = findClassRecursively(docTable, it.value(), className, recursionMaxIncludeDepth, namespaceName);
|
const ClassDocumentPtrPair irc = findClassRecursively(docTable, it.value(), className, recursionMaxIncludeDepth, namespaceName);
|
||||||
@@ -483,7 +484,9 @@ static inline QString uiClassName(QString formObjectName)
|
|||||||
return formObjectName;
|
return formObjectName;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Document::Ptr getParsedDocument(const QString &fileName, CppModelManagerInterface::WorkingCopy &workingCopy, Snapshot &snapshot)
|
static Document::Ptr getParsedDocument(const QString &fileName,
|
||||||
|
CppTools::CppModelManagerInterface::WorkingCopy &workingCopy,
|
||||||
|
Snapshot &snapshot)
|
||||||
{
|
{
|
||||||
QString src;
|
QString src;
|
||||||
if (workingCopy.contains(fileName)) {
|
if (workingCopy.contains(fileName)) {
|
||||||
@@ -531,10 +534,10 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
|
|||||||
*errorMessage = tr("Internal error: No project could be found for %1.").arg(currentUiFile);
|
*errorMessage = tr("Internal error: No project could be found for %1.").arg(currentUiFile);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CPlusPlus::Snapshot docTable = CppModelManagerInterface::instance()->snapshot();
|
Snapshot docTable = CppTools::CppModelManagerInterface::instance()->snapshot();
|
||||||
CPlusPlus::Snapshot newDocTable;
|
Snapshot newDocTable;
|
||||||
|
|
||||||
for (CPlusPlus::Snapshot::iterator it = docTable.begin(); it != docTable.end(); ++it) {
|
for (Snapshot::iterator it = docTable.begin(); it != docTable.end(); ++it) {
|
||||||
const ProjectExplorer::Project *project = ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projectForFile(it.key());
|
const ProjectExplorer::Project *project = ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projectForFile(it.key());
|
||||||
if (project == uiProject)
|
if (project == uiProject)
|
||||||
newDocTable.insert(it.value());
|
newDocTable.insert(it.value());
|
||||||
@@ -607,8 +610,8 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// add function declaration to cl
|
// add function declaration to cl
|
||||||
CppModelManagerInterface::WorkingCopy workingCopy =
|
CppTools::CppModelManagerInterface::WorkingCopy workingCopy =
|
||||||
CppModelManagerInterface::instance()->workingCopy();
|
CppTools::CppModelManagerInterface::instance()->workingCopy();
|
||||||
const QString fileName = doc->fileName();
|
const QString fileName = doc->fileName();
|
||||||
getParsedDocument(fileName, workingCopy, docTable);
|
getParsedDocument(fileName, workingCopy, docTable);
|
||||||
addDeclaration(docTable, fileName, cl, functionNameWithParameterNames);
|
addDeclaration(docTable, fileName, cl, functionNameWithParameterNames);
|
||||||
|
|||||||
@@ -243,13 +243,13 @@ void GenericProject::refresh(RefreshOptions options)
|
|||||||
if (options & Files)
|
if (options & Files)
|
||||||
m_rootNode->refresh(oldFileList);
|
m_rootNode->refresh(oldFileList);
|
||||||
|
|
||||||
CPlusPlus::CppModelManagerInterface *modelManager =
|
CppTools::CppModelManagerInterface *modelManager =
|
||||||
CPlusPlus::CppModelManagerInterface::instance();
|
CppTools::CppModelManagerInterface::instance();
|
||||||
|
|
||||||
if (modelManager) {
|
if (modelManager) {
|
||||||
CPlusPlus::CppModelManagerInterface::ProjectInfo pinfo = modelManager->projectInfo(this);
|
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelManager->projectInfo(this);
|
||||||
pinfo.clearProjectParts();
|
pinfo.clearProjectParts();
|
||||||
CPlusPlus::ProjectPart::Ptr part(new CPlusPlus::ProjectPart);
|
CppTools::ProjectPart::Ptr part(new CppTools::ProjectPart);
|
||||||
|
|
||||||
Kit *k = activeTarget() ? activeTarget()->kit() : KitManager::instance()->defaultKit();
|
Kit *k = activeTarget() ? activeTarget()->kit() : KitManager::instance()->defaultKit();
|
||||||
if (ToolChain *tc = ToolChainKitInformation::toolChain(k)) {
|
if (ToolChain *tc = ToolChainKitInformation::toolChain(k)) {
|
||||||
@@ -271,22 +271,22 @@ void GenericProject::refresh(RefreshOptions options)
|
|||||||
// ### add _defines.
|
// ### add _defines.
|
||||||
|
|
||||||
// Add any C/C++ files to be parsed
|
// Add any C/C++ files to be parsed
|
||||||
CPlusPlus::ProjectFileAdder adder(part->files);
|
CppTools::ProjectFileAdder adder(part->files);
|
||||||
foreach (const QString &file, files())
|
foreach (const QString &file, files())
|
||||||
adder.maybeAdd(file);
|
adder.maybeAdd(file);
|
||||||
|
|
||||||
QStringList filesToUpdate;
|
QStringList filesToUpdate;
|
||||||
|
|
||||||
if (options & Configuration) {
|
if (options & Configuration) {
|
||||||
foreach (const CPlusPlus::ProjectFile &file, part->files)
|
foreach (const CppTools::ProjectFile &file, part->files)
|
||||||
filesToUpdate << file.path;
|
filesToUpdate << file.path;
|
||||||
filesToUpdate.append(CPlusPlus::CppModelManagerInterface::configurationFileName());
|
filesToUpdate.append(CppTools::CppModelManagerInterface::configurationFileName());
|
||||||
// Full update, if there's a code model update, cancel it
|
// Full update, if there's a code model update, cancel it
|
||||||
m_codeModelFuture.cancel();
|
m_codeModelFuture.cancel();
|
||||||
} else if (options & Files) {
|
} else if (options & Files) {
|
||||||
// Only update files that got added to the list
|
// Only update files that got added to the list
|
||||||
QSet<QString> newFileList;
|
QSet<QString> newFileList;
|
||||||
foreach (const CPlusPlus::ProjectFile &file, part->files)
|
foreach (const CppTools::ProjectFile &file, part->files)
|
||||||
newFileList.insert(file.path);
|
newFileList.insert(file.path);
|
||||||
newFileList.subtract(oldFileList);
|
newFileList.subtract(oldFileList);
|
||||||
filesToUpdate.append(newFileList.toList());
|
filesToUpdate.append(newFileList.toList());
|
||||||
|
|||||||
@@ -427,21 +427,21 @@ void QbsProject::updateCppCodeModel(const qbs::ProjectData *prj)
|
|||||||
qtVersion = QtSupport::QtKitInformation::qtVersion(k);
|
qtVersion = QtSupport::QtKitInformation::qtVersion(k);
|
||||||
tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
|
tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
|
||||||
|
|
||||||
CPlusPlus::CppModelManagerInterface *modelmanager =
|
CppTools::CppModelManagerInterface *modelmanager =
|
||||||
CPlusPlus::CppModelManagerInterface::instance();
|
CppTools::CppModelManagerInterface::instance();
|
||||||
|
|
||||||
if (!modelmanager)
|
if (!modelmanager)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CPlusPlus::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
||||||
pinfo.clearProjectParts();
|
pinfo.clearProjectParts();
|
||||||
CPlusPlus::ProjectPart::QtVersion qtVersionForPart
|
CppTools::ProjectPart::QtVersion qtVersionForPart
|
||||||
= CPlusPlus::ProjectPart::NoQt;
|
= CppTools::ProjectPart::NoQt;
|
||||||
if (qtVersion) {
|
if (qtVersion) {
|
||||||
if (qtVersion->qtVersion() < QtSupport::QtVersionNumber(5,0,0))
|
if (qtVersion->qtVersion() < QtSupport::QtVersionNumber(5,0,0))
|
||||||
qtVersionForPart = CPlusPlus::ProjectPart::Qt4;
|
qtVersionForPart = CppTools::ProjectPart::Qt4;
|
||||||
else
|
else
|
||||||
qtVersionForPart = CPlusPlus::ProjectPart::Qt5;
|
qtVersionForPart = CppTools::ProjectPart::Qt5;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList allFiles;
|
QStringList allFiles;
|
||||||
@@ -500,18 +500,18 @@ void QbsProject::updateCppCodeModel(const qbs::ProjectData *prj)
|
|||||||
const QString pch = props.getModuleProperty(QLatin1String(CONFIG_CPP_MODULE),
|
const QString pch = props.getModuleProperty(QLatin1String(CONFIG_CPP_MODULE),
|
||||||
QLatin1String(CONFIG_PRECOMPILEDHEADER)).toString();
|
QLatin1String(CONFIG_PRECOMPILEDHEADER)).toString();
|
||||||
|
|
||||||
CPlusPlus::ProjectPart::Ptr part(new CPlusPlus::ProjectPart);
|
CppTools::ProjectPart::Ptr part(new CppTools::ProjectPart);
|
||||||
CPlusPlus::ProjectFileAdder adder(part->files);
|
CppTools::ProjectFileAdder adder(part->files);
|
||||||
foreach (const QString &file, grp.allFilePaths())
|
foreach (const QString &file, grp.allFilePaths())
|
||||||
if (adder.maybeAdd(file))
|
if (adder.maybeAdd(file))
|
||||||
allFiles.append(file);
|
allFiles.append(file);
|
||||||
part->files << CPlusPlus::ProjectFile(QLatin1String(CONFIGURATION_PATH),
|
part->files << CppTools::ProjectFile(QLatin1String(CONFIGURATION_PATH),
|
||||||
CPlusPlus::ProjectFile::CXXHeader);
|
CppTools::ProjectFile::CXXHeader);
|
||||||
|
|
||||||
part->qtVersion = qtVersionForPart;
|
part->qtVersion = qtVersionForPart;
|
||||||
// TODO: qbs has separate variable for CFLAGS
|
// TODO: qbs has separate variable for CFLAGS
|
||||||
part->cVersion = CPlusPlus::ProjectPart::C99;
|
part->cVersion = CppTools::ProjectPart::C99;
|
||||||
part->cxxVersion = isCxx11 ? CPlusPlus::ProjectPart::CXX11 : CPlusPlus::ProjectPart::CXX98;
|
part->cxxVersion = isCxx11 ? CppTools::ProjectPart::CXX11 : CppTools::ProjectPart::CXX98;
|
||||||
// TODO: get the exact cxxExtensions from toolchain
|
// TODO: get the exact cxxExtensions from toolchain
|
||||||
part->includePaths = grpIncludePaths;
|
part->includePaths = grpIncludePaths;
|
||||||
part->frameworkPaths = grpFrameworkPaths;
|
part->frameworkPaths = grpFrameworkPaths;
|
||||||
|
|||||||
@@ -702,9 +702,9 @@ void FindExportedCppTypes::operator()(const CPlusPlus::Document::Ptr &document)
|
|||||||
|
|
||||||
FindExportsVisitor finder(document);
|
FindExportsVisitor finder(document);
|
||||||
finder();
|
finder();
|
||||||
if (CppModelManagerInterface *cppModelManager = CppModelManagerInterface::instance()) {
|
if (CppTools::CppModelManagerInterface *cppModelManager = CppTools::CppModelManagerInterface::instance()) {
|
||||||
cppModelManager->setExtraDiagnostics(
|
cppModelManager->setExtraDiagnostics(
|
||||||
document->fileName(), CppModelManagerInterface::ExportedQmlTypesDiagnostic,
|
document->fileName(), CppTools::CppModelManagerInterface::ExportedQmlTypesDiagnostic,
|
||||||
finder.messages());
|
finder.messages());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -254,8 +254,8 @@ ModelManager::~ModelManager()
|
|||||||
|
|
||||||
void ModelManager::delayedInitialization()
|
void ModelManager::delayedInitialization()
|
||||||
{
|
{
|
||||||
CPlusPlus::CppModelManagerInterface *cppModelManager =
|
CppTools::CppModelManagerInterface *cppModelManager =
|
||||||
CPlusPlus::CppModelManagerInterface::instance();
|
CppTools::CppModelManagerInterface::instance();
|
||||||
if (cppModelManager) {
|
if (cppModelManager) {
|
||||||
// It's important to have a direct connection here so we can prevent
|
// It's important to have a direct connection here so we can prevent
|
||||||
// the source and AST of the cpp document being cleaned away.
|
// the source and AST of the cpp document being cleaned away.
|
||||||
@@ -899,8 +899,8 @@ void ModelManager::startCppQmlTypeUpdate()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CPlusPlus::CppModelManagerInterface *cppModelManager =
|
CppTools::CppModelManagerInterface *cppModelManager =
|
||||||
CPlusPlus::CppModelManagerInterface::instance();
|
CppTools::CppModelManagerInterface::instance();
|
||||||
if (!cppModelManager)
|
if (!cppModelManager)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -1423,8 +1423,8 @@ Qt4ProFileNode::Qt4ProFileNode(Qt4Project *project,
|
|||||||
|
|
||||||
Qt4ProFileNode::~Qt4ProFileNode()
|
Qt4ProFileNode::~Qt4ProFileNode()
|
||||||
{
|
{
|
||||||
CPlusPlus::CppModelManagerInterface *modelManager
|
CppTools::CppModelManagerInterface *modelManager
|
||||||
= CPlusPlus::CppModelManagerInterface::instance();
|
= CppTools::CppModelManagerInterface::instance();
|
||||||
QMap<QString, Internal::Qt4UiCodeModelSupport *>::const_iterator it, end;
|
QMap<QString, Internal::Qt4UiCodeModelSupport *>::const_iterator it, end;
|
||||||
end = m_uiCodeModelSupport.constEnd();
|
end = m_uiCodeModelSupport.constEnd();
|
||||||
for (it = m_uiCodeModelSupport.constBegin(); it != end; ++it) {
|
for (it = m_uiCodeModelSupport.constBegin(); it != end; ++it) {
|
||||||
@@ -2275,8 +2275,8 @@ QString Qt4ProFileNode::uiHeaderFile(const QString &uiDir, const QString &formFi
|
|||||||
void Qt4ProFileNode::createUiCodeModelSupport()
|
void Qt4ProFileNode::createUiCodeModelSupport()
|
||||||
{
|
{
|
||||||
// qDebug()<<"creatUiCodeModelSupport()";
|
// qDebug()<<"creatUiCodeModelSupport()";
|
||||||
CPlusPlus::CppModelManagerInterface *modelManager
|
CppTools::CppModelManagerInterface *modelManager
|
||||||
= CPlusPlus::CppModelManagerInterface::instance();
|
= CppTools::CppModelManagerInterface::instance();
|
||||||
|
|
||||||
// First move all to
|
// First move all to
|
||||||
QMap<QString, Internal::Qt4UiCodeModelSupport *> oldCodeModelSupport;
|
QMap<QString, Internal::Qt4UiCodeModelSupport *> oldCodeModelSupport;
|
||||||
|
|||||||
@@ -446,9 +446,9 @@ bool Qt4Project::equalFileList(const QStringList &a, const QStringList &b)
|
|||||||
QStringList::const_iterator bend = b.constEnd();
|
QStringList::const_iterator bend = b.constEnd();
|
||||||
|
|
||||||
while (ait != aend && bit != bend) {
|
while (ait != aend && bit != bend) {
|
||||||
if (*ait == CPlusPlus::CppModelManagerInterface::configurationFileName())
|
if (*ait == CppTools::CppModelManagerInterface::configurationFileName())
|
||||||
++ait;
|
++ait;
|
||||||
else if (*bit == CPlusPlus::CppModelManagerInterface::configurationFileName())
|
else if (*bit == CppTools::CppModelManagerInterface::configurationFileName())
|
||||||
++bit;
|
++bit;
|
||||||
else if (*ait == *bit)
|
else if (*ait == *bit)
|
||||||
++ait, ++bit;
|
++ait, ++bit;
|
||||||
@@ -472,8 +472,8 @@ void Qt4Project::updateCodeModels()
|
|||||||
|
|
||||||
void Qt4Project::updateCppCodeModel()
|
void Qt4Project::updateCppCodeModel()
|
||||||
{
|
{
|
||||||
typedef CPlusPlus::ProjectPart ProjectPart;
|
typedef CppTools::ProjectPart ProjectPart;
|
||||||
typedef CPlusPlus::ProjectFile ProjectFile;
|
typedef CppTools::ProjectFile ProjectFile;
|
||||||
|
|
||||||
Kit *k = 0;
|
Kit *k = 0;
|
||||||
QtSupport::BaseQtVersion *qtVersion = 0;
|
QtSupport::BaseQtVersion *qtVersion = 0;
|
||||||
@@ -485,8 +485,8 @@ void Qt4Project::updateCppCodeModel()
|
|||||||
qtVersion = QtSupport::QtKitInformation::qtVersion(k);
|
qtVersion = QtSupport::QtKitInformation::qtVersion(k);
|
||||||
tc = ToolChainKitInformation::toolChain(k);
|
tc = ToolChainKitInformation::toolChain(k);
|
||||||
|
|
||||||
CPlusPlus::CppModelManagerInterface *modelmanager =
|
CppTools::CppModelManagerInterface *modelmanager =
|
||||||
CPlusPlus::CppModelManagerInterface::instance();
|
CppTools::CppModelManagerInterface::instance();
|
||||||
|
|
||||||
if (!modelmanager)
|
if (!modelmanager)
|
||||||
return;
|
return;
|
||||||
@@ -494,7 +494,7 @@ void Qt4Project::updateCppCodeModel()
|
|||||||
FindQt4ProFiles findQt4ProFiles;
|
FindQt4ProFiles findQt4ProFiles;
|
||||||
QList<Qt4ProFileNode *> proFiles = findQt4ProFiles(rootProjectNode());
|
QList<Qt4ProFileNode *> proFiles = findQt4ProFiles(rootProjectNode());
|
||||||
|
|
||||||
CPlusPlus::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
||||||
pinfo.clearProjectParts();
|
pinfo.clearProjectParts();
|
||||||
ProjectPart::QtVersion qtVersionForPart = ProjectPart::NoQt;
|
ProjectPart::QtVersion qtVersionForPart = ProjectPart::NoQt;
|
||||||
if (qtVersion) {
|
if (qtVersion) {
|
||||||
@@ -567,7 +567,7 @@ void Qt4Project::updateCppCodeModel()
|
|||||||
part->files << ProjectFile(file, ProjectFile::CXXHeader);
|
part->files << ProjectFile(file, ProjectFile::CXXHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
part->files.prepend(ProjectFile(CPlusPlus::CppModelManagerInterface::configurationFileName(),
|
part->files.prepend(ProjectFile(CppTools::CppModelManagerInterface::configurationFileName(),
|
||||||
ProjectFile::CXXSource));
|
ProjectFile::CXXSource));
|
||||||
foreach (const QString &file, pro->variableValue(ObjCSourceVar)) {
|
foreach (const QString &file, pro->variableValue(ObjCSourceVar)) {
|
||||||
allFiles << file;
|
allFiles << file;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
using namespace Qt4ProjectManager;
|
using namespace Qt4ProjectManager;
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
Qt4UiCodeModelSupport::Qt4UiCodeModelSupport(CPlusPlus::CppModelManagerInterface *modelmanager,
|
Qt4UiCodeModelSupport::Qt4UiCodeModelSupport(CppTools::CppModelManagerInterface *modelmanager,
|
||||||
Qt4Project *project,
|
Qt4Project *project,
|
||||||
const QString &source,
|
const QString &source,
|
||||||
const QString &uiHeaderFile)
|
const QString &uiHeaderFile)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace Internal {
|
|||||||
class Qt4UiCodeModelSupport : public CppTools::UiCodeModelSupport
|
class Qt4UiCodeModelSupport : public CppTools::UiCodeModelSupport
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Qt4UiCodeModelSupport(CPlusPlus::CppModelManagerInterface *modelmanager,
|
Qt4UiCodeModelSupport(CppTools::CppModelManagerInterface *modelmanager,
|
||||||
Qt4Project *project,
|
Qt4Project *project,
|
||||||
const QString &sourceFile,
|
const QString &sourceFile,
|
||||||
const QString &uiHeaderFile);
|
const QString &uiHeaderFile);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Internal {
|
|||||||
CppTodoItemsScanner::CppTodoItemsScanner(const KeywordList &keywordList, QObject *parent) :
|
CppTodoItemsScanner::CppTodoItemsScanner(const KeywordList &keywordList, QObject *parent) :
|
||||||
TodoItemsScanner(keywordList, parent)
|
TodoItemsScanner(keywordList, parent)
|
||||||
{
|
{
|
||||||
CPlusPlus::CppModelManagerInterface *modelManager = CPlusPlus::CppModelManagerInterface::instance();
|
CppTools::CppModelManagerInterface *modelManager = CppTools::CppModelManagerInterface::instance();
|
||||||
|
|
||||||
connect(modelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)), this,
|
connect(modelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)), this,
|
||||||
SLOT(documentUpdated(CPlusPlus::Document::Ptr)), Qt::DirectConnection);
|
SLOT(documentUpdated(CPlusPlus::Document::Ptr)), Qt::DirectConnection);
|
||||||
@@ -47,9 +47,9 @@ CppTodoItemsScanner::CppTodoItemsScanner(const KeywordList &keywordList, QObject
|
|||||||
|
|
||||||
bool CppTodoItemsScanner::shouldProcessFile(const QString &fileName)
|
bool CppTodoItemsScanner::shouldProcessFile(const QString &fileName)
|
||||||
{
|
{
|
||||||
CPlusPlus::CppModelManagerInterface *modelManager = CPlusPlus::CppModelManagerInterface::instance();
|
CppTools::CppModelManagerInterface *modelManager = CppTools::CppModelManagerInterface::instance();
|
||||||
|
|
||||||
foreach (const CPlusPlus::CppModelManagerInterface::ProjectInfo &info, modelManager->projectInfos())
|
foreach (const CppTools::CppModelManagerInterface::ProjectInfo &info, modelManager->projectInfos())
|
||||||
if (info.project().data()->files(ProjectExplorer::Project::ExcludeGeneratedFiles).contains(fileName))
|
if (info.project().data()->files(ProjectExplorer::Project::ExcludeGeneratedFiles).contains(fileName))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -61,10 +61,10 @@ void CppTodoItemsScanner::keywordListChanged()
|
|||||||
// We need to rescan everything known to the code model
|
// We need to rescan everything known to the code model
|
||||||
// TODO: It would be nice to only tokenize the source files, not update the code model entirely.
|
// TODO: It would be nice to only tokenize the source files, not update the code model entirely.
|
||||||
|
|
||||||
CPlusPlus::CppModelManagerInterface *modelManager = CPlusPlus::CppModelManagerInterface::instance();
|
CppTools::CppModelManagerInterface *modelManager = CppTools::CppModelManagerInterface::instance();
|
||||||
|
|
||||||
QStringList filesToBeUpdated;
|
QStringList filesToBeUpdated;
|
||||||
foreach (const CPlusPlus::CppModelManagerInterface::ProjectInfo &info, modelManager->projectInfos())
|
foreach (const CppTools::CppModelManagerInterface::ProjectInfo &info, modelManager->projectInfos())
|
||||||
filesToBeUpdated << info.project().data()->files(ProjectExplorer::Project::ExcludeGeneratedFiles);
|
filesToBeUpdated << info.project().data()->files(ProjectExplorer::Project::ExcludeGeneratedFiles);
|
||||||
|
|
||||||
modelManager->updateSourceFiles(filesToBeUpdated);
|
modelManager->updateSourceFiles(filesToBeUpdated);
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ void TodoItemsProvider::createScanners()
|
|||||||
{
|
{
|
||||||
qRegisterMetaType<QList<TodoItem> >("QList<TodoItem>");
|
qRegisterMetaType<QList<TodoItem> >("QList<TodoItem>");
|
||||||
|
|
||||||
if (CPlusPlus::CppModelManagerInterface::instance())
|
if (CppTools::CppModelManagerInterface::instance())
|
||||||
m_scanners << new CppTodoItemsScanner(m_settings.keywords, this);
|
m_scanners << new CppTodoItemsScanner(m_settings.keywords, this);
|
||||||
|
|
||||||
if (QmlJS::ModelManagerInterface::instance())
|
if (QmlJS::ModelManagerInterface::instance())
|
||||||
|
|||||||
@@ -472,7 +472,7 @@ void VcsBaseSubmitEditor::setFileModel(SubmitFileModel *model, const QString &re
|
|||||||
d->m_widget->setFileModel(model);
|
d->m_widget->setFileModel(model);
|
||||||
|
|
||||||
QSet<QString> uniqueSymbols;
|
QSet<QString> uniqueSymbols;
|
||||||
const CPlusPlus::Snapshot cppSnapShot = CPlusPlus::CppModelManagerInterface::instance()->snapshot();
|
const CPlusPlus::Snapshot cppSnapShot = CppTools::CppModelManagerInterface::instance()->snapshot();
|
||||||
|
|
||||||
// Iterate over the files and get interesting symbols
|
// Iterate over the files and get interesting symbols
|
||||||
for (int row = 0; row < model->rowCount(); ++row) {
|
for (int row = 0; row < model->rowCount(); ++row) {
|
||||||
|
|||||||
Reference in New Issue
Block a user