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