CppEditor: Un-export some classes

Change-Id: I285fe7bd3ac835c4a43f0a200dd7905f577ff211
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2021-09-02 14:52:29 +02:00
parent d3b55f45cb
commit 72d52f3ac2
44 changed files with 222 additions and 230 deletions

View File

@@ -238,7 +238,8 @@ private:
typeOfExpression.init(m_document, theSnapshot);
typeOfExpression.setExpandTemplates(true);
if (Symbol *s = CanonicalSymbol::canonicalSymbol(m_scope, m_expression, typeOfExpression)) {
if (Symbol *s = Internal::CanonicalSymbol::canonicalSymbol(
m_scope, m_expression, typeOfExpression)) {
const QList<int> tokenIndices = CppModelManager::instance()
->references(s, typeOfExpression.context());
result = toRanges(tokenIndices, m_document->translationUnit());
@@ -339,7 +340,7 @@ QFuture<CursorInfo> BuiltinCursorInfo::run(const CursorInfoParams &cursorInfoPar
const QTextCursor &textCursor = cursorInfoParams.textCursor;
int line, column;
Utils::Text::convertPosition(textCursor.document(), textCursor.position(), &line, &column);
CanonicalSymbol canonicalSymbol(document, snapshot);
Internal::CanonicalSymbol canonicalSymbol(document, snapshot);
QString expression;
Scope *scope = canonicalSymbol.getScopeAndExpression(textCursor, &expression);
@@ -355,7 +356,7 @@ BuiltinCursorInfo::findLocalUses(const Document::Ptr &document, int line, int co
AST *ast = document->translationUnit()->ast();
FunctionDefinitionUnderCursor functionDefinitionUnderCursor(document->translationUnit());
DeclarationAST *declaration = functionDefinitionUnderCursor(ast, line, column);
return LocalSymbols(document, declaration).uses;
return Internal::LocalSymbols(document, declaration).uses;
}
} // namespace CppEditor

View File

@@ -341,7 +341,8 @@ void CompilerOptionsBuilder::insertWrappedHeaders(const QStringList &relPaths)
void CompilerOptionsBuilder::addHeaderPathOptions()
{
HeaderPathFilter filter{m_projectPart,
Internal::HeaderPathFilter filter{
m_projectPart,
m_useTweakedHeaderPaths,
m_clangVersion,
m_clangIncludeDirectory};

View File

@@ -36,7 +36,7 @@
using namespace CPlusPlus;
namespace CppEditor{
namespace CppEditor::Internal {
CanonicalSymbol::CanonicalSymbol(const Document::Ptr &document,
const Snapshot &snapshot)
@@ -126,4 +126,4 @@ Symbol *CanonicalSymbol::canonicalSymbol(Scope *scope, const QString &code,
return nullptr;
}
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -25,17 +25,15 @@
#pragma once
#include "cppeditor_global.h"
#include <cplusplus/LookupContext.h>
#include <cplusplus/Symbol.h>
#include <cplusplus/TypeOfExpression.h>
QT_FORWARD_DECLARE_CLASS(QTextCursor)
namespace CppEditor {
namespace CppEditor::Internal {
class CPPEDITOR_EXPORT CanonicalSymbol
class CanonicalSymbol
{
public:
CanonicalSymbol(const CPlusPlus::Document::Ptr &document,
@@ -59,4 +57,4 @@ private:
CPlusPlus::TypeOfExpression m_typeOfExpression;
};
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -1136,7 +1136,7 @@ bool CheckSymbols::visit(FunctionDefinitionAST *ast)
accept(ast->ctor_initializer);
accept(ast->function_body);
const LocalSymbols locals(_doc, ast);
const Internal::LocalSymbols locals(_doc, ast);
foreach (const QList<Result> &uses, locals.uses) {
foreach (const Result &u, uses)
addUse(u);

View File

@@ -25,7 +25,6 @@
#pragma once
#include "cppeditor_global.h"
#include "projectpart.h"
#include "projectinfo.h"
@@ -39,7 +38,7 @@ class WorkingCopy;
namespace CppCodeModelInspector {
struct CPPEDITOR_EXPORT Utils
struct Utils
{
static QString toString(bool value);
static QString toString(int value);
@@ -63,7 +62,7 @@ struct CPPEDITOR_EXPORT Utils
static QList<CPlusPlus::Document::Ptr> snapshotToList(const CPlusPlus::Snapshot &snapshot);
};
class CPPEDITOR_EXPORT Dumper
class Dumper
{
public:
explicit Dumper(const CPlusPlus::Snapshot &globalSnapshot,

View File

@@ -111,7 +111,7 @@ QWidget *CppCodeStylePreferencesFactory::createEditor(TextEditor::ICodeStylePref
TextEditor::Indenter *CppCodeStylePreferencesFactory::createIndenter(QTextDocument *doc) const
{
return new CppQtStyleIndenter(doc);
return new Internal::CppQtStyleIndenter(doc);
}
QString CppCodeStylePreferencesFactory::snippetProviderGroupId() const

View File

@@ -87,7 +87,7 @@ QTimer *newSingleShotTimer(QObject *parent, int msInternal, const QString &objec
} // anonymous namespace
namespace CppEditor {
namespace CppEditor::Internal {
CppEditorOutline::CppEditorOutline(TextEditor::TextEditorWidget *editorWidget)
: QObject(editorWidget)
@@ -296,6 +296,6 @@ QModelIndex CppEditorOutline::indexForPosition(int line, int column,
return lastIndex;
}
} // namespace CppEditor
} // namespace CppEditor::Internal
#include <cppeditoroutline.moc>

View File

@@ -25,8 +25,6 @@
#pragma once
#include "cppeditor_global.h"
#include "abstractoverviewmodel.h"
#include <QModelIndex>
@@ -43,9 +41,9 @@ QT_END_NAMESPACE
namespace TextEditor { class TextEditorWidget; }
namespace Utils { class TreeViewComboBox; }
namespace CppEditor {
namespace CppEditor::Internal {
class CPPEDITOR_EXPORT CppEditorOutline : public QObject
class CppEditorOutline : public QObject
{
Q_OBJECT
@@ -92,4 +90,4 @@ private:
QTimer *m_updateIndexTimer;
};
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -32,13 +32,13 @@
#include <QScopedPointer>
namespace CppEditor {
class CppEditorOutline;
class FollowSymbolInterface;
class SemanticInfo;
class ProjectPart;
namespace Internal {
class CppEditorDocument;
class CppEditorOutline;
class CppEditorWidgetPrivate;
class FunctionDeclDefLink;

View File

@@ -44,7 +44,7 @@
using namespace CPlusPlus;
namespace CppEditor {
namespace CppEditor::Internal {
static QStringList stripName(const QString &name)
{
@@ -754,4 +754,4 @@ Utils::Link CppElementEvaluator::linkFromExpression(const QString &expression, c
return Utils::Link();
}
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -25,8 +25,6 @@
#pragma once
#include "cppeditor_global.h"
#include <coreplugin/helpitem.h>
#include <texteditor/texteditor.h>
@@ -47,10 +45,12 @@ class LookupContext;
}
namespace CppEditor {
class CppElement;
class CppModelManager;
class CPPEDITOR_EXPORT CppElementEvaluator final
namespace Internal {
class CppElement;
class CppElementEvaluator final
{
public:
explicit CppElementEvaluator(TextEditor::TextEditorWidget *editor);
@@ -75,7 +75,7 @@ private:
class CppClass;
class CPPEDITOR_EXPORT CppElement
class CppElement
{
protected:
CppElement();
@@ -92,7 +92,7 @@ public:
QString tooltip;
};
class CPPEDITOR_EXPORT CppDeclarableElement : public CppElement
class CppDeclarableElement : public CppElement
{
public:
explicit CppDeclarableElement(CPlusPlus::Symbol *declaration);
@@ -105,7 +105,7 @@ public:
QIcon icon;
};
class CPPEDITOR_EXPORT CppClass : public CppDeclarableElement
class CppClass : public CppDeclarableElement
{
public:
CppClass();
@@ -125,4 +125,5 @@ public:
QList<CppClass> derived;
};
} // namespace Internal
} // namespace CppEditor

View File

@@ -130,12 +130,12 @@ bool VirtualFunctionHelper::canLookupVirtualFunctionOverrides(Function *function
if (IdExpressionAST *idExpressionAST = m_baseExpressionAST->asIdExpression()) {
NameAST *name = idExpressionAST->name;
const bool nameIsQualified = name && name->asQualifiedName();
result = !nameIsQualified && FunctionUtils::isVirtualFunction(
result = !nameIsQualified && Internal::FunctionUtils::isVirtualFunction(
function, LookupContext(m_document, m_snapshot));
} else if (MemberAccessAST *memberAccessAST = m_baseExpressionAST->asMemberAccess()) {
NameAST *name = memberAccessAST->member_name;
const bool nameIsQualified = name && name->asQualifiedName();
if (!nameIsQualified && FunctionUtils::isVirtualFunction(
if (!nameIsQualified && Internal::FunctionUtils::isVirtualFunction(
function, LookupContext(m_document, m_snapshot))) {
TranslationUnit *unit = m_expressionDocument->translationUnit();
QTC_ASSERT(unit, return false);

View File

@@ -30,7 +30,7 @@
using namespace CPlusPlus;
namespace CppEditor {
namespace CppEditor::Internal {
namespace {
@@ -309,4 +309,4 @@ LocalSymbols::LocalSymbols(Document::Ptr doc, DeclarationAST *ast)
uses = findLocalSymbols.localUses;
}
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -25,12 +25,11 @@
#pragma once
#include "cppeditor_global.h"
#include "cppsemanticinfo.h"
namespace CppEditor {
namespace CppEditor::Internal {
class CPPEDITOR_EXPORT LocalSymbols
class LocalSymbols
{
Q_DISABLE_COPY(LocalSymbols)
@@ -40,4 +39,4 @@ public:
SemanticInfo::LocalUseMap uses;
};
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -35,10 +35,18 @@
#include <utils/link.h>
using namespace CPlusPlus;
namespace CppEditor {
namespace CppEditor::Internal {
QVariant SymbolItem::data(int /*column*/, int role) const
class SymbolItem : public Utils::TreeItem
{
public:
SymbolItem() = default;
explicit SymbolItem(CPlusPlus::Symbol *symbol) : symbol(symbol) {}
QVariant data(int column, int role) const override
{
Q_UNUSED(column)
if (!symbol && parent()) { // account for no symbol item
switch (role) {
case Qt::DisplayRole:
@@ -127,7 +135,13 @@ QVariant SymbolItem::data(int /*column*/, int role) const
default:
return QVariant();
} // switch
}
}
CPlusPlus::Symbol *symbol = nullptr; // not owned
};
bool OverviewModel::hasDocument() const
@@ -228,4 +242,4 @@ void OverviewModel::buildTree(SymbolItem *root, bool isRoot)
}
}
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -30,20 +30,10 @@
#include <cplusplus/CppDocument.h>
#include <cplusplus/Overview.h>
namespace CppEditor {
namespace CppEditor::Internal {
class SymbolItem;
class SymbolItem : public Utils::TreeItem
{
public:
SymbolItem() = default;
explicit SymbolItem(CPlusPlus::Symbol *symbol) : symbol(symbol) {}
QVariant data(int column, int role) const override;
CPlusPlus::Symbol *symbol = nullptr; // not owned
};
class CPPEDITOR_EXPORT OverviewModel : public AbstractOverviewModel
class OverviewModel : public AbstractOverviewModel
{
Q_OBJECT
@@ -68,4 +58,4 @@ private:
friend class SymbolItem;
};
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -46,7 +46,7 @@
#define CHECK_C(cond, err) \
if (!(cond)) { if (DEBUG_OUTPUT) qDebug() << "Discarded:" << (err); continue; }
namespace CppEditor {
namespace CppEditor::Internal {
/*!
Skips specifiers that are not type relevant and returns the index of the
@@ -471,4 +471,4 @@ void PointerDeclarationFormatter::printCandidate(AST *ast)
#endif // DEBUG_OUTPUT
}
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -25,7 +25,6 @@
#pragma once
#include "cppeditor_global.h"
#include "cpprefactoringchanges.h"
#include <cplusplus/ASTVisitor.h>
@@ -34,7 +33,7 @@
namespace CPlusPlus { class Overview; }
namespace CppEditor {
namespace CppEditor::Internal {
using namespace CPlusPlus;
@@ -52,7 +51,7 @@ using namespace CPlusPlus;
\endlist
*/
class CPPEDITOR_EXPORT PointerDeclarationFormatter: protected ASTVisitor
class PointerDeclarationFormatter: protected ASTVisitor
{
public:
/*!
@@ -117,4 +116,4 @@ private:
Utils::ChangeSet m_changeSet;
};
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -47,7 +47,7 @@
using namespace CPlusPlus;
Q_DECLARE_METATYPE(CppEditor::Overview)
Q_DECLARE_METATYPE(CppEditor::Internal::Overview)
namespace CppEditor::Internal {
namespace {

View File

@@ -166,6 +166,7 @@ void CppProjectUpdater::checkForExtraCompilersFinished()
m_futureSynchronizer.addFuture(updateFuture);
}
namespace Internal {
CppProjectUpdaterFactory::CppProjectUpdaterFactory()
{
setObjectName("CppProjectUpdaterFactory");
@@ -175,5 +176,6 @@ CppProjectUpdaterInterface *CppProjectUpdaterFactory::create()
{
return new CppProjectUpdater;
}
} // namespace Internal
} // namespace CppEditor

View File

@@ -35,11 +35,12 @@
#include <QFutureWatcher>
namespace CppEditor {
class ProjectInfo;
namespace Internal {
// registered in extensionsystem's object pool for plugins with weak dependency to CppEditor
class CPPEDITOR_EXPORT CppProjectUpdaterFactory : public QObject
class CppProjectUpdaterFactory : public QObject
{
Q_OBJECT
public:
@@ -49,6 +50,8 @@ public:
Q_INVOKABLE CppProjectUpdaterInterface *create();
};
} // namespace Internal
class CPPEDITOR_EXPORT CppProjectUpdater final : public QObject, public CppProjectUpdaterInterface
{
Q_OBJECT

View File

@@ -34,7 +34,7 @@
#include <QTextBlock>
#include <QTextCursor>
namespace CppEditor {
namespace CppEditor::Internal {
CppQtStyleIndenter::CppQtStyleIndenter(QTextDocument *doc)
: TextEditor::TextIndenter(doc)
@@ -205,4 +205,4 @@ TextEditor::IndentationForBlock CppQtStyleIndenter::indentationForBlocks(
return ret;
}
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -25,8 +25,6 @@
#pragma once
#include "cppeditor_global.h"
#include <texteditor/textindenter.h>
namespace TextEditor { class ICodeStylePreferences; }
@@ -35,7 +33,8 @@ namespace CppEditor {
class CppCodeStyleSettings;
class CppCodeStylePreferences;
class CPPEDITOR_EXPORT CppQtStyleIndenter : public TextEditor::TextIndenter
namespace Internal {
class CppQtStyleIndenter : public TextEditor::TextIndenter
{
public:
explicit CppQtStyleIndenter(QTextDocument *doc);
@@ -66,4 +65,5 @@ private:
CppCodeStylePreferences *m_cppCodeStylePreferences = nullptr;
};
} // namespace Internal
} // namespace CppEditor

View File

@@ -31,8 +31,7 @@
using namespace CPlusPlus;
using namespace TextEditor;
namespace CppEditor {
namespace Internal {
namespace CppEditor::Internal {
const QStringList magicQObjectFunctions()
{
@@ -40,12 +39,10 @@ const QStringList magicQObjectFunctions()
return list;
}
} // namespace Internal
CppQuickFixOperation::CppQuickFixOperation(const CppQuickFixInterface &interface, int priority)
: QuickFixOperation(priority), CppQuickFixInterface(interface)
{}
CppQuickFixOperation::~CppQuickFixOperation() = default;
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -37,9 +37,7 @@ class CppQuickFixInterface;
// These are generated functions that should not be offered in quickfixes.
const QStringList magicQObjectFunctions();
}
class CPPEDITOR_EXPORT CppQuickFixOperation
class CppQuickFixOperation
: public TextEditor::QuickFixOperation,
public Internal::CppQuickFixInterface
{
@@ -48,6 +46,8 @@ public:
~CppQuickFixOperation() override;
};
} // namespace Internal
/*!
The QuickFixFactory is responsible for generating QuickFixOperation s which are
applicable to the given QuickFixState.

View File

@@ -50,7 +50,7 @@ using namespace CPlusPlus;
using namespace TextEditor;
using CppEditor::Tests::TemporaryDir;
using CppEditor::Tests::TestIncludePaths;
using CppEditor::Tests::Internal::TestIncludePaths;
typedef QByteArray _;

View File

@@ -36,7 +36,7 @@
#include <utils/qtcassert.h>
namespace CppEditor {
namespace CppEditor::Internal {
void CppRefactoringEngine::startLocalRenaming(const CursorInEditor &data,
const ProjectPart *,
@@ -71,7 +71,7 @@ void CppRefactoringEngine::globalRename(const CursorInEditor &data,
if (const CPlusPlus::Macro *macro = findCanonicalMacro(cursor, info.doc)) {
modelManager->renameMacroUsages(*macro, replacement);
} else {
CanonicalSymbol cs(info.doc, info.snapshot);
Internal::CanonicalSymbol cs(info.doc, info.snapshot);
CPlusPlus::Symbol *canonicalSymbol = cs(cursor);
if (canonicalSymbol)
modelManager->renameUsages(canonicalSymbol, cs.context(), replacement);
@@ -95,7 +95,7 @@ void CppRefactoringEngine::findUsages(const CursorInEditor &data,
if (const CPlusPlus::Macro *macro = findCanonicalMacro(cursor, info.doc)) {
modelManager->findMacroUsages(*macro);
} else {
CanonicalSymbol cs(info.doc, info.snapshot);
Internal::CanonicalSymbol cs(info.doc, info.snapshot);
CPlusPlus::Symbol *canonicalSymbol = cs(cursor);
if (canonicalSymbol)
modelManager->findUsages(canonicalSymbol, cs.context());
@@ -115,4 +115,4 @@ void CppRefactoringEngine::globalFollowSymbol(
documentFromSemanticInfo, symbolFinder, inNextSplit);
}
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -27,9 +27,9 @@
#include "refactoringengineinterface.h"
namespace CppEditor {
namespace CppEditor::Internal {
class CPPEDITOR_EXPORT CppRefactoringEngine : public RefactoringEngineInterface
class CppRefactoringEngine : public RefactoringEngineInterface
{
public:
void startLocalRenaming(const CursorInEditor &data,
@@ -46,4 +46,4 @@ public:
bool inNextSplit) const override;
};
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -27,7 +27,7 @@
#include <QDir>
namespace CppEditor::Tests {
namespace CppEditor::Tests::Internal {
QString TestIncludePaths::includeBaseDirectory()
{
@@ -52,7 +52,7 @@ QString TestIncludePaths::directoryOfTestFile()
QString TestIncludePaths::testFilePath(const QString &fileName)
{
return Tests::TestIncludePaths::directoryOfTestFile() + QLatin1Char('/') + fileName;
return directoryOfTestFile() + QLatin1Char('/') + fileName;
}
} // namespace CppEditor::Tests
} // namespace CppEditor::Tests::Internal

View File

@@ -25,14 +25,12 @@
#pragma once
#include "cppeditor_global.h"
#include <QtGlobal>
#include <QString>
namespace CppEditor::Tests {
namespace CppEditor::Tests::Internal {
class CPPEDITOR_EXPORT TestIncludePaths
class TestIncludePaths
{
Q_DISABLE_COPY(TestIncludePaths)
@@ -44,4 +42,4 @@ public:
static QString testFilePath(const QString &fileName = QLatin1String("file.cpp"));
};
} // namespace CppEditor::Tests
} // namespace CppEditor::Tests::Internal

View File

@@ -47,7 +47,7 @@ using ProjectExplorer::HeaderPathType;
using Include = Document::Include;
using CppEditor::Tests::TestCase;
using CppEditor::Tests::TestIncludePaths;
using CppEditor::Tests::Internal::TestIncludePaths;
namespace CppEditor::Internal {

View File

@@ -53,12 +53,10 @@ class ProgressIndicator;
}
namespace CppEditor {
class CppClass;
class CppElement;
namespace Internal {
class CppClass;
class CppEditorWidget;
class CppElement;
class CppTypeHierarchyModel : public QStandardItemModel
{

View File

@@ -136,7 +136,7 @@ public:
if (!functionsClass)
return nullptr;
const QList<Function *> overrides = FunctionUtils::overrides(
const QList<Function *> overrides = Internal::FunctionUtils::overrides(
m_params.function, functionsClass, m_params.staticClass, m_params.snapshot);
if (overrides.isEmpty())
return nullptr;

View File

@@ -42,7 +42,7 @@
using namespace CPlusPlus;
namespace CppEditor {
namespace CppEditor::Internal {
DoxygenGenerator::DoxygenGenerator() = default;
@@ -337,4 +337,4 @@ QString DoxygenGenerator::offsetString() const
return m_commentOffset;
}
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -25,8 +25,6 @@
#pragma once
#include "cppeditor_global.h"
#include <cplusplus/Overview.h>
QT_FORWARD_DECLARE_CLASS(QTextCursor)
@@ -35,9 +33,9 @@ namespace CPlusPlus { class DeclarationAST; }
namespace CPlusPlus { class Snapshot; }
namespace Utils { class FilePath; }
namespace CppEditor {
namespace CppEditor::Internal {
class CPPEDITOR_EXPORT DoxygenGenerator
class DoxygenGenerator
{
public:
DoxygenGenerator();
@@ -93,4 +91,4 @@ private:
QString m_commentOffset;
};
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -45,7 +45,7 @@
using namespace CPlusPlus;
namespace CppEditor {
namespace CppEditor::Internal {
enum VirtualType { Virtual, PureVirtual };
@@ -219,11 +219,11 @@ QList<Function *> FunctionUtils::overrides(Function *function, Class *functionsC
return result;
}
} // namespaceCppEditor
} // namespace CppEditor::Internal
#ifdef WITH_TESTS
namespace CppEditor::Internal {
enum Virtuality
enum class Virtuality
{
NotVirtual,
Virtual,
@@ -272,14 +272,14 @@ void FunctionUtilsTest::testVirtualFunctions()
QCOMPARE(FunctionUtils::isPureVirtualFunction(function, context), isPureVirtual);
if (isVirtual) {
if (isPureVirtual)
QCOMPARE(virtuality, PureVirtual);
QCOMPARE(virtuality, Virtuality::PureVirtual);
else
QCOMPARE(virtuality, Virtual);
QCOMPARE(virtuality, Virtuality::Virtual);
} else {
QEXPECT_FAIL("virtual-dtor-dtor", "Not implemented", Abort);
if (allFunctions.size() == 3)
QEXPECT_FAIL("dtor-virtual-dtor-dtor", "Not implemented", Abort);
QCOMPARE(virtuality, NotVirtual);
QCOMPARE(virtuality, Virtuality::NotVirtual);
}
if (firstVirtualIndex == -1)
QVERIFY(firstVirtuals.isEmpty());
@@ -300,74 +300,78 @@ void FunctionUtilsTest::testVirtualFunctions_data()
QTest::newRow("none")
<< _("struct None { void foo() {} };\n")
<< (VirtualityList() << NotVirtual)
<< (VirtualityList() << Virtuality::NotVirtual)
<< (QList<int>() << -1);
QTest::newRow("single-virtual")
<< _("struct V { virtual void foo() {} };\n")
<< (VirtualityList() << Virtual)
<< (VirtualityList() << Virtuality::Virtual)
<< (QList<int>() << 0);
QTest::newRow("single-pure-virtual")
<< _("struct PV { virtual void foo() = 0; };\n")
<< (VirtualityList() << PureVirtual)
<< (VirtualityList() << Virtuality::PureVirtual)
<< (QList<int>() << 0);
QTest::newRow("virtual-derived-with-specifier")
<< _("struct Base { virtual void foo() {} };\n"
"struct Derived : Base { virtual void foo() {} };\n")
<< (VirtualityList() << Virtual << Virtual)
<< (VirtualityList() << Virtuality::Virtual << Virtuality::Virtual)
<< (QList<int>() << 0 << 0);
QTest::newRow("virtual-derived-implicit")
<< _("struct Base { virtual void foo() {} };\n"
"struct Derived : Base { void foo() {} };\n")
<< (VirtualityList() << Virtual << Virtual)
<< (VirtualityList() << Virtuality::Virtual << Virtuality::Virtual)
<< (QList<int>() << 0 << 0);
QTest::newRow("not-virtual-then-virtual")
<< _("struct Base { void foo() {} };\n"
"struct Derived : Base { virtual void foo() {} };\n")
<< (VirtualityList() << NotVirtual << Virtual)
<< (VirtualityList() << Virtuality::NotVirtual << Virtuality::Virtual)
<< (QList<int>() << -1 << 1);
QTest::newRow("virtual-final-not-virtual")
<< _("struct Base { virtual void foo() {} };\n"
"struct Derived : Base { void foo() final {} };\n"
"struct Derived2 : Derived { void foo() {} };")
<< (VirtualityList() << Virtual << Virtual << NotVirtual)
<< (VirtualityList() << Virtuality::Virtual << Virtuality::Virtual
<< Virtuality::NotVirtual)
<< (QList<int>() << 0 << 0 << -1);
QTest::newRow("virtual-then-pure")
<< _("struct Base { virtual void foo() {} };\n"
"struct Derived : Base { virtual void foo() = 0; };\n"
"struct Derived2 : Derived { void foo() {} };")
<< (VirtualityList() << Virtual << PureVirtual << Virtual)
<< (VirtualityList() << Virtuality::Virtual << Virtuality::PureVirtual
<< Virtuality::Virtual)
<< (QList<int>() << 0 << 0 << 0);
QTest::newRow("virtual-virtual-final-not-virtual")
<< _("struct Base { virtual void foo() {} };\n"
"struct Derived : Base { virtual void foo() final {} };\n"
"struct Derived2 : Derived { void foo() {} };")
<< (VirtualityList() << Virtual << Virtual << NotVirtual)
<< (VirtualityList() << Virtuality::Virtual << Virtuality::Virtual
<< Virtuality::NotVirtual)
<< (QList<int>() << 0 << 0 << -1);
QTest::newRow("ctor-virtual-dtor")
<< _("struct Base { Base() {} virtual ~Base() {} };\n")
<< (VirtualityList() << NotVirtual << Virtual)
<< (VirtualityList() << Virtuality::NotVirtual << Virtuality::Virtual)
<< (QList<int>() << -1 << 1);
QTest::newRow("virtual-dtor-dtor")
<< _("struct Base { virtual ~Base() {} };\n"
"struct Derived : Base { ~Derived() {} };\n")
<< (VirtualityList() << Virtual << Virtual)
<< (VirtualityList() << Virtuality::Virtual << Virtuality::Virtual)
<< (QList<int>() << 0 << 0);
QTest::newRow("dtor-virtual-dtor-dtor")
<< _("struct Base { ~Base() {} };\n"
"struct Derived : Base { virtual ~Derived() {} };\n"
"struct Derived2 : Derived { ~Derived2() {} };\n")
<< (VirtualityList() << NotVirtual << Virtual << Virtual)
<< (VirtualityList() << Virtuality::NotVirtual << Virtuality::Virtual
<< Virtuality::Virtual)
<< (QList<int>() << -1 << 1 << 1);
}

View File

@@ -25,8 +25,6 @@
#pragma once
#include "cppeditor_global.h"
#include <QList>
#include <QObject>
@@ -38,9 +36,9 @@ class Snapshot;
class Symbol;
} // namespace CPlusPlus
namespace CppEditor {
namespace CppEditor::Internal {
class CPPEDITOR_EXPORT FunctionUtils
class FunctionUtils
{
public:
static bool isVirtualFunction(const CPlusPlus::Function *function,
@@ -58,7 +56,6 @@ public:
};
#ifdef WITH_TESTS
namespace Internal {
class FunctionUtilsTest : public QObject
{
Q_OBJECT
@@ -67,7 +64,6 @@ private slots:
void testVirtualFunctions();
void testVirtualFunctions_data();
};
} // namespace Internal
#endif // WITH_TESTS
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -39,7 +39,7 @@
using namespace ProjectExplorer;
using namespace Utils;
namespace CppEditor {
namespace CppEditor::Internal {
void HeaderPathFilter::process()
{
@@ -181,4 +181,4 @@ QString HeaderPathFilter::ensurePathWithSlashEnding(const QString &path)
return pathWithSlashEnding;
}
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -30,9 +30,9 @@
#include <utils/filepath.h>
namespace CppEditor {
namespace CppEditor::Internal {
class CPPEDITOR_EXPORT HeaderPathFilter
class HeaderPathFilter
{
public:
HeaderPathFilter(const ProjectPart &projectPart,
@@ -76,4 +76,4 @@ public:
const UseTweakedHeaderPaths useTweakedHeaderPaths;
};
} // namespace CppEditor
} // namespace CppEditor::Internal

View File

@@ -528,6 +528,7 @@ bool IncludeGroup::hasCommonIncludeDir() const
#ifdef WITH_TESTS
using namespace Tests;
using namespace IncludeUtils;
using Tests::Internal::TestIncludePaths;
namespace Internal {

View File

@@ -25,8 +25,6 @@
#pragma once
#include "cppeditor_global.h"
#include <cplusplus/CppDocument.h>
#include <cplusplus/PreprocessorClient.h>
@@ -42,8 +40,7 @@ namespace IncludeUtils {
using Include = CPlusPlus::Document::Include;
using IncludeType = CPlusPlus::Client::IncludeType;
// TODO: Unexport
class CPPEDITOR_EXPORT IncludeGroup
class IncludeGroup
{
public:
static QList<IncludeGroup> detectIncludeGroupsByNewLines(QList<Include> &includes);
@@ -78,7 +75,7 @@ private:
QList<Include> m_includes;
};
class CPPEDITOR_EXPORT LineForNewIncludeDirective
class LineForNewIncludeDirective
{
public:
enum MocIncludeMode { RespectMocIncludes, IgnoreMocIncludes };

View File

@@ -29,7 +29,7 @@
using namespace CPlusPlus;
namespace CppEditor {
namespace CppEditor::Internal {
namespace {
QString unqualifyName(const QString &qualifiedName)
@@ -240,4 +240,4 @@ void TypeHierarchyBuilder::buildDerived(QFutureInterfaceBase &futureInterface,
}
}
} // CppEditor
} // CppEditor::Internal

View File

@@ -25,8 +25,6 @@
#pragma once
#include "cppeditor_global.h"
#include <cplusplus/CppDocument.h>
#include <cplusplus/Overview.h>
@@ -43,9 +41,9 @@ class Name;
class Scope;
}
namespace CppEditor {
namespace CppEditor::Internal {
class CPPEDITOR_EXPORT TypeHierarchy
class TypeHierarchy
{
friend class TypeHierarchyBuilder;
@@ -64,7 +62,7 @@ private:
QList<TypeHierarchy> _hierarchy;
};
class CPPEDITOR_EXPORT TypeHierarchyBuilder
class TypeHierarchyBuilder
{
public:
static TypeHierarchy buildDerivedTypeHierarchy(CPlusPlus::Symbol *symbol,
@@ -87,4 +85,4 @@ private:
CPlusPlus::Overview _overview;
};
} // CppEditor
} // CppEditor::Internal