forked from qt-creator/qt-creator
CppTools: modernize
Change-Id: Iaf02e4d026f1ac8b216833d83cd7a735e21ff60a Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -323,7 +323,7 @@ void ClangEditorDocumentProcessor::invalidateDiagnostics()
|
||||
}
|
||||
|
||||
void ClangEditorDocumentProcessor::setParserConfig(
|
||||
const CppTools::BaseEditorDocumentParser::Configuration config)
|
||||
const CppTools::BaseEditorDocumentParser::Configuration &config)
|
||||
{
|
||||
m_parser->setConfiguration(config);
|
||||
m_builtinProcessor.parser()->setConfiguration(config);
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
|
||||
void editorDocumentTimerRestarted() override;
|
||||
|
||||
void setParserConfig(const CppTools::BaseEditorDocumentParser::Configuration config) override;
|
||||
void setParserConfig(const CppTools::BaseEditorDocumentParser::Configuration &config) override;
|
||||
|
||||
QFuture<CppTools::CursorInfo> cursorInfo(const CppTools::CursorInfoParams ¶ms) override;
|
||||
QFuture<CppTools::CursorInfo> requestLocalReferences(const QTextCursor &cursor) override;
|
||||
|
||||
@@ -65,7 +65,7 @@ QString AbstractEditorSupport::licenseTemplate(const QString &file, const QStrin
|
||||
expander.registerVariable("Cpp:License:ClassName", tr("The class name."),
|
||||
[className]() { return className; });
|
||||
|
||||
return Utils::TemplateEngine::processText(&expander, license, 0);
|
||||
return Utils::TemplateEngine::processText(&expander, license, nullptr);
|
||||
}
|
||||
|
||||
} // namespace CppTools
|
||||
|
||||
@@ -58,9 +58,7 @@ BaseEditorDocumentParser::BaseEditorDocumentParser(const QString &filePath)
|
||||
Q_UNUSED(meta);
|
||||
}
|
||||
|
||||
BaseEditorDocumentParser::~BaseEditorDocumentParser()
|
||||
{
|
||||
}
|
||||
BaseEditorDocumentParser::~BaseEditorDocumentParser() = default;
|
||||
|
||||
QString BaseEditorDocumentParser::filePath() const
|
||||
{
|
||||
|
||||
@@ -52,9 +52,7 @@ BaseEditorDocumentProcessor::BaseEditorDocumentProcessor(QTextDocument *textDocu
|
||||
{
|
||||
}
|
||||
|
||||
BaseEditorDocumentProcessor::~BaseEditorDocumentProcessor()
|
||||
{
|
||||
}
|
||||
BaseEditorDocumentProcessor::~BaseEditorDocumentProcessor() = default;
|
||||
|
||||
void BaseEditorDocumentProcessor::run(bool projectsUpdated)
|
||||
{
|
||||
@@ -92,7 +90,7 @@ void BaseEditorDocumentProcessor::invalidateDiagnostics()
|
||||
}
|
||||
|
||||
void BaseEditorDocumentProcessor::setParserConfig(
|
||||
const BaseEditorDocumentParser::Configuration config)
|
||||
const BaseEditorDocumentParser::Configuration &config)
|
||||
{
|
||||
parser()->setConfiguration(config);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
|
||||
virtual void editorDocumentTimerRestarted();
|
||||
|
||||
virtual void setParserConfig(const BaseEditorDocumentParser::Configuration config);
|
||||
virtual void setParserConfig(const BaseEditorDocumentParser::Configuration &config);
|
||||
|
||||
virtual QFuture<CursorInfo> cursorInfo(const CursorInfoParams ¶ms) = 0;
|
||||
virtual QFuture<CursorInfo> requestLocalReferences(const QTextCursor &cursor) = 0;
|
||||
@@ -103,12 +103,12 @@ signals:
|
||||
void projectPartInfoUpdated(const CppTools::ProjectPartInfo &projectPartInfo);
|
||||
|
||||
void codeWarningsUpdated(unsigned revision,
|
||||
const QList<QTextEdit::ExtraSelection> selections,
|
||||
const QList<QTextEdit::ExtraSelection> &selections,
|
||||
const HeaderErrorDiagnosticWidgetCreator &creator,
|
||||
const TextEditor::RefactorMarkers &refactorMarkers);
|
||||
|
||||
void ifdefedOutBlocksUpdated(unsigned revision,
|
||||
const QList<TextEditor::BlockRange> ifdefedOutBlocks);
|
||||
const QList<TextEditor::BlockRange> &ifdefedOutBlocks);
|
||||
|
||||
void cppDocumentUpdated(const CPlusPlus::Document::Ptr document); // TODO: Remove me
|
||||
void semanticInfoUpdated(const CppTools::SemanticInfo semanticInfo); // TODO: Remove me
|
||||
|
||||
@@ -91,7 +91,7 @@ CursorInfo::Ranges toRanges(const SemanticUses &uses)
|
||||
return ranges;
|
||||
}
|
||||
|
||||
CursorInfo::Ranges toRanges(const QList<int> tokenIndices, TranslationUnit *translationUnit)
|
||||
CursorInfo::Ranges toRanges(const QList<int> &tokenIndices, TranslationUnit *translationUnit)
|
||||
{
|
||||
CursorInfo::Ranges ranges;
|
||||
ranges.reserve(tokenIndices.size());
|
||||
@@ -109,7 +109,7 @@ class FunctionDefinitionUnderCursor: protected ASTVisitor
|
||||
DeclarationAST *m_functionDefinition = nullptr;
|
||||
|
||||
public:
|
||||
FunctionDefinitionUnderCursor(TranslationUnit *translationUnit)
|
||||
explicit FunctionDefinitionUnderCursor(TranslationUnit *translationUnit)
|
||||
: ASTVisitor(translationUnit)
|
||||
{ }
|
||||
|
||||
|
||||
@@ -95,14 +95,14 @@ CppTools::CheckSymbols *createHighlighter(const CPlusPlus::Document::Ptr &doc,
|
||||
const CPlusPlus::Snapshot &snapshot,
|
||||
QTextDocument *textDocument)
|
||||
{
|
||||
QTC_ASSERT(doc, return 0);
|
||||
QTC_ASSERT(doc->translationUnit(), return 0);
|
||||
QTC_ASSERT(doc->translationUnit()->ast(), return 0);
|
||||
QTC_ASSERT(textDocument, return 0);
|
||||
QTC_ASSERT(doc, return nullptr);
|
||||
QTC_ASSERT(doc->translationUnit(), return nullptr);
|
||||
QTC_ASSERT(doc->translationUnit()->ast(), return nullptr);
|
||||
QTC_ASSERT(textDocument, return nullptr);
|
||||
|
||||
using namespace CPlusPlus;
|
||||
using namespace CppTools;
|
||||
typedef TextEditor::HighlightingResult Result;
|
||||
using Result = TextEditor::HighlightingResult;
|
||||
QList<Result> macroUses;
|
||||
|
||||
using Utils::Text::convertPosition;
|
||||
@@ -168,7 +168,7 @@ BuiltinEditorDocumentProcessor::BuiltinEditorDocumentProcessor(
|
||||
, m_codeWarningsUpdated(false)
|
||||
, m_semanticHighlighter(enableSemanticHighlighter
|
||||
? new CppTools::SemanticHighlighter(document)
|
||||
: 0)
|
||||
: nullptr)
|
||||
{
|
||||
using namespace Internal;
|
||||
|
||||
|
||||
@@ -70,7 +70,6 @@ class WriteTaskFileForDiagnostics
|
||||
|
||||
public:
|
||||
WriteTaskFileForDiagnostics()
|
||||
: m_processedDiagnostics(0)
|
||||
{
|
||||
const QString fileName = Utils::TemporaryDirectory::masterDirectoryPath()
|
||||
+ "/qtc_findErrorsIndexing.diagnostics."
|
||||
@@ -120,7 +119,7 @@ public:
|
||||
private:
|
||||
QFile m_file;
|
||||
QTextStream m_out;
|
||||
int m_processedDiagnostics;
|
||||
int m_processedDiagnostics = 0;
|
||||
};
|
||||
|
||||
void classifyFiles(const QSet<QString> &files, QStringList *headers, QStringList *sources)
|
||||
@@ -262,16 +261,15 @@ class BuiltinSymbolSearcher: public SymbolSearcher
|
||||
{
|
||||
public:
|
||||
BuiltinSymbolSearcher(const CPlusPlus::Snapshot &snapshot,
|
||||
Parameters parameters, QSet<QString> fileNames)
|
||||
const Parameters ¶meters, const QSet<QString> &fileNames)
|
||||
: m_snapshot(snapshot)
|
||||
, m_parameters(parameters)
|
||||
, m_fileNames(fileNames)
|
||||
{}
|
||||
|
||||
~BuiltinSymbolSearcher()
|
||||
{}
|
||||
~BuiltinSymbolSearcher() override = default;
|
||||
|
||||
void runSearch(QFutureInterface<Core::SearchResultItem> &future)
|
||||
void runSearch(QFutureInterface<Core::SearchResultItem> &future) override
|
||||
{
|
||||
future.setProgressRange(0, m_snapshot.size());
|
||||
future.setProgressValue(0);
|
||||
@@ -343,8 +341,7 @@ BuiltinIndexingSupport::BuiltinIndexingSupport()
|
||||
m_synchronizer.setCancelOnWait(true);
|
||||
}
|
||||
|
||||
BuiltinIndexingSupport::~BuiltinIndexingSupport()
|
||||
{}
|
||||
BuiltinIndexingSupport::~BuiltinIndexingSupport() = default;
|
||||
|
||||
QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(
|
||||
const QFutureInterface<void> &superFuture,
|
||||
@@ -382,7 +379,8 @@ QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(
|
||||
return result;
|
||||
}
|
||||
|
||||
SymbolSearcher *BuiltinIndexingSupport::createSymbolSearcher(SymbolSearcher::Parameters parameters, QSet<QString> fileNames)
|
||||
SymbolSearcher *BuiltinIndexingSupport::createSymbolSearcher(
|
||||
const SymbolSearcher::Parameters ¶meters, const QSet<QString> &fileNames)
|
||||
{
|
||||
return new BuiltinSymbolSearcher(CppModelManager::instance()->snapshot(), parameters, fileNames);
|
||||
}
|
||||
|
||||
@@ -36,13 +36,13 @@ namespace Internal {
|
||||
class BuiltinIndexingSupport: public CppIndexingSupport {
|
||||
public:
|
||||
BuiltinIndexingSupport();
|
||||
~BuiltinIndexingSupport();
|
||||
~BuiltinIndexingSupport() override;
|
||||
|
||||
QFuture<void> refreshSourceFiles(const QFutureInterface<void> &superFuture,
|
||||
const QSet<QString> &sourceFiles,
|
||||
CppModelManager::ProgressNotificationMode mode) override;
|
||||
SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters,
|
||||
QSet<QString> fileNames) override;
|
||||
SymbolSearcher *createSymbolSearcher(const SymbolSearcher::Parameters ¶meters,
|
||||
const QSet<QString> &fileNames) override;
|
||||
|
||||
public:
|
||||
static bool isFindErrorsIndexingActive();
|
||||
|
||||
@@ -37,7 +37,7 @@ class CPPTOOLS_EXPORT ClangDiagnosticConfigsModel
|
||||
{
|
||||
public:
|
||||
ClangDiagnosticConfigsModel() = default;
|
||||
ClangDiagnosticConfigsModel(const ClangDiagnosticConfigs &customConfigs);
|
||||
explicit ClangDiagnosticConfigsModel(const ClangDiagnosticConfigs &customConfigs);
|
||||
|
||||
int size() const;
|
||||
const ClangDiagnosticConfig &at(int index) const;
|
||||
|
||||
@@ -303,13 +303,13 @@ void CompilerOptionsBuilder::addHeaderPathOptions()
|
||||
}
|
||||
|
||||
|
||||
for (const HeaderPath &headerPath : filter.userHeaderPaths)
|
||||
for (const HeaderPath &headerPath : qAsConst(filter.userHeaderPaths))
|
||||
addIncludeDirOptionForPath(headerPath);
|
||||
|
||||
for (const HeaderPath &headerPath : filter.systemHeaderPaths)
|
||||
for (const HeaderPath &headerPath : qAsConst(filter.systemHeaderPaths))
|
||||
addIncludeDirOptionForPath(headerPath);
|
||||
|
||||
for (const HeaderPath &headerPath : filter.builtInHeaderPaths)
|
||||
for (const HeaderPath &headerPath : qAsConst(filter.builtInHeaderPaths))
|
||||
addIncludeDirOptionForPath(headerPath);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,9 +61,7 @@ BuiltinModelManagerSupport::BuiltinModelManagerSupport()
|
||||
{
|
||||
}
|
||||
|
||||
BuiltinModelManagerSupport::~BuiltinModelManagerSupport()
|
||||
{
|
||||
}
|
||||
BuiltinModelManagerSupport::~BuiltinModelManagerSupport() = default;
|
||||
|
||||
BaseEditorDocumentProcessor *BuiltinModelManagerSupport::createEditorDocumentProcessor(
|
||||
TextEditor::TextDocument *baseTextDocument)
|
||||
|
||||
@@ -38,7 +38,7 @@ class BuiltinModelManagerSupport: public ModelManagerSupport
|
||||
|
||||
public:
|
||||
BuiltinModelManagerSupport();
|
||||
virtual ~BuiltinModelManagerSupport();
|
||||
~BuiltinModelManagerSupport() override;
|
||||
|
||||
CppCompletionAssistProvider *completionAssistProvider() final;
|
||||
TextEditor::BaseHoverHandler *createHoverHandler() final;
|
||||
|
||||
@@ -55,7 +55,7 @@ const LookupContext &CanonicalSymbol::context() const
|
||||
Scope *CanonicalSymbol::getScopeAndExpression(const QTextCursor &cursor, QString *code)
|
||||
{
|
||||
if (!m_document)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
QTextCursor tc = cursor;
|
||||
int line, column;
|
||||
@@ -65,7 +65,7 @@ Scope *CanonicalSymbol::getScopeAndExpression(const QTextCursor &cursor, QString
|
||||
QTextDocument *textDocument = cursor.document();
|
||||
if (!CppTools::isValidIdentifierChar(textDocument->characterAt(pos)))
|
||||
if (!(pos > 0 && CppTools::isValidIdentifierChar(textDocument->characterAt(pos - 1))))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
while (CppTools::isValidIdentifierChar(textDocument->characterAt(pos)))
|
||||
++pos;
|
||||
@@ -83,7 +83,7 @@ Symbol *CanonicalSymbol::operator()(const QTextCursor &cursor)
|
||||
if (Scope *scope = getScopeAndExpression(cursor, &code))
|
||||
return operator()(scope, code);
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Symbol *CanonicalSymbol::operator()(Scope *scope, const QString &code)
|
||||
@@ -118,14 +118,12 @@ Symbol *CanonicalSymbol::canonicalSymbol(Scope *scope, const QString &code,
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < results.size(); ++i) {
|
||||
const LookupItem &r = results.at(i);
|
||||
|
||||
for (const auto &r : results) {
|
||||
if (r.declaration())
|
||||
return r.declaration();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace CppEditor
|
||||
|
||||
@@ -185,7 +185,7 @@ protected:
|
||||
|
||||
bool visit(Declaration *symbol) override
|
||||
{
|
||||
if (symbol->enclosingEnum() != 0)
|
||||
if (symbol->enclosingEnum() != nullptr)
|
||||
addStatic(symbol->name());
|
||||
|
||||
if (symbol->type()->isFunctionType())
|
||||
@@ -303,9 +303,9 @@ CheckSymbols::Future CheckSymbols::go(Document::Ptr doc, const LookupContext &co
|
||||
CheckSymbols * CheckSymbols::create(Document::Ptr doc, const LookupContext &context,
|
||||
const QList<CheckSymbols::Result> ¯oUses)
|
||||
{
|
||||
QTC_ASSERT(doc, return NULL);
|
||||
QTC_ASSERT(doc->translationUnit(), return NULL);
|
||||
QTC_ASSERT(doc->translationUnit()->ast(), return NULL);
|
||||
QTC_ASSERT(doc, return nullptr);
|
||||
QTC_ASSERT(doc->translationUnit(), return nullptr);
|
||||
QTC_ASSERT(doc->translationUnit()->ast(), return nullptr);
|
||||
|
||||
return new CheckSymbols(doc, context, macroUses);
|
||||
}
|
||||
@@ -315,7 +315,7 @@ CheckSymbols::CheckSymbols(Document::Ptr doc, const LookupContext &context, cons
|
||||
, _lineOfLastUsage(0), _macroUses(macroUses)
|
||||
{
|
||||
unsigned line = 0;
|
||||
getTokenEndPosition(translationUnit()->ast()->lastToken(), &line, 0);
|
||||
getTokenEndPosition(translationUnit()->ast()->lastToken(), &line, nullptr);
|
||||
_chunkSize = qMax(50U, line / 200);
|
||||
_usages.reserve(_chunkSize);
|
||||
|
||||
@@ -326,8 +326,7 @@ CheckSymbols::CheckSymbols(Document::Ptr doc, const LookupContext &context, cons
|
||||
typeOfExpression.setExpandTemplates(true);
|
||||
}
|
||||
|
||||
CheckSymbols::~CheckSymbols()
|
||||
{ }
|
||||
CheckSymbols::~CheckSymbols() = default;
|
||||
|
||||
void CheckSymbols::run()
|
||||
{
|
||||
@@ -385,7 +384,7 @@ FunctionDefinitionAST *CheckSymbols::enclosingFunctionDefinition(bool skipTopOfS
|
||||
return funDef;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TemplateDeclarationAST *CheckSymbols::enclosingTemplateDeclaration() const
|
||||
@@ -397,7 +396,7 @@ TemplateDeclarationAST *CheckSymbols::enclosingTemplateDeclaration() const
|
||||
return funDef;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Scope *CheckSymbols::enclosingScope() const
|
||||
@@ -508,7 +507,7 @@ bool CheckSymbols::visit(DotDesignatorAST *ast)
|
||||
|
||||
bool CheckSymbols::visit(SimpleDeclarationAST *ast)
|
||||
{
|
||||
NameAST *declrIdNameAST = 0;
|
||||
NameAST *declrIdNameAST = nullptr;
|
||||
if (ast->declarator_list && !ast->declarator_list->next) {
|
||||
if (ast->symbols && !ast->symbols->next && !ast->symbols->value->isGenerated()) {
|
||||
Symbol *decl = ast->symbols->value;
|
||||
@@ -606,7 +605,7 @@ bool CheckSymbols::visit(ObjCClassForwardDeclarationAST *ast)
|
||||
{
|
||||
accept(ast->attribute_list);
|
||||
accept(ast->identifier_list);
|
||||
for (NameListAST *i = ast->identifier_list ; i != 0; i = i->next)
|
||||
for (NameListAST *i = ast->identifier_list; i; i = i->next)
|
||||
addUse(i->value, SemanticHighlighter::TypeUse);
|
||||
return false;
|
||||
}
|
||||
@@ -680,7 +679,7 @@ bool CheckSymbols::visit(CallAST *ast)
|
||||
} else if (IdExpressionAST *idExpr = ast->base_expression->asIdExpression()) {
|
||||
if (const Name *name = idExpr->name->name) {
|
||||
if (maybeFunction(name)) {
|
||||
expr = 0;
|
||||
expr = nullptr;
|
||||
|
||||
NameAST *exprName = idExpr->name;
|
||||
if (QualifiedNameAST *q = exprName->asQualifiedName()) {
|
||||
@@ -723,8 +722,8 @@ bool CheckSymbols::visit(NewExpressionAST *ast)
|
||||
if (highlightCtorDtorAsType) {
|
||||
accept(ast->new_type_id);
|
||||
} else {
|
||||
ClassOrNamespace *binding = 0;
|
||||
NameAST *nameAST = 0;
|
||||
ClassOrNamespace *binding = nullptr;
|
||||
NameAST *nameAST = nullptr;
|
||||
if (ast->new_type_id) {
|
||||
for (SpecifierListAST *it = ast->new_type_id->type_specifier_list; it; it = it->next) {
|
||||
if (NamedTypeSpecifierAST *spec = it->value->asNamedTypeSpecifier()) {
|
||||
@@ -746,7 +745,7 @@ bool CheckSymbols::visit(NewExpressionAST *ast)
|
||||
if (binding && nameAST) {
|
||||
int arguments = 0;
|
||||
if (ast->new_initializer) {
|
||||
ExpressionListAST *list = 0;
|
||||
ExpressionListAST *list = nullptr;
|
||||
if (ExpressionListParenAST *exprListParen = ast->new_initializer->asExpressionListParen())
|
||||
list = exprListParen->expression_list;
|
||||
else if (BracedInitializerAST *braceInit = ast->new_initializer->asBracedInitializer())
|
||||
@@ -853,7 +852,7 @@ void CheckSymbols::checkName(NameAST *ast, Scope *scope)
|
||||
if (!scope)
|
||||
scope = enclosingScope();
|
||||
|
||||
if (ast->asDestructorName() != 0) {
|
||||
if (ast->asDestructorName() != nullptr) {
|
||||
Class *klass = scope->asClass();
|
||||
if (!klass && scope->asFunction())
|
||||
klass = scope->asFunction()->enclosingScope()->asClass();
|
||||
@@ -915,7 +914,7 @@ bool CheckSymbols::visit(QualifiedNameAST *ast)
|
||||
ClassOrNamespace *binding = checkNestedName(ast);
|
||||
|
||||
if (binding && ast->unqualified_name) {
|
||||
if (ast->unqualified_name->asDestructorName() != 0) {
|
||||
if (ast->unqualified_name->asDestructorName() != nullptr) {
|
||||
if (hasVirtualDestructor(binding)) {
|
||||
addUse(ast->unqualified_name, SemanticHighlighter::VirtualFunctionDeclarationUse);
|
||||
} else {
|
||||
@@ -943,7 +942,7 @@ bool CheckSymbols::visit(QualifiedNameAST *ast)
|
||||
|
||||
ClassOrNamespace *CheckSymbols::checkNestedName(QualifiedNameAST *ast)
|
||||
{
|
||||
ClassOrNamespace *binding = 0;
|
||||
ClassOrNamespace *binding = nullptr;
|
||||
|
||||
if (ast->name) {
|
||||
if (NestedNameSpecifierListAST *it = ast->nested_name_specifier_list) {
|
||||
@@ -969,7 +968,7 @@ ClassOrNamespace *CheckSymbols::checkNestedName(QualifiedNameAST *ast)
|
||||
if (TemplateIdAST *template_id = class_or_namespace_name->asTemplateId()) {
|
||||
if (template_id->template_token) {
|
||||
addUse(template_id, SemanticHighlighter::TypeUse);
|
||||
binding = 0; // there's no way we can find a binding.
|
||||
binding = nullptr; // there's no way we can find a binding.
|
||||
}
|
||||
|
||||
accept(template_id->template_argument_list);
|
||||
@@ -1026,7 +1025,7 @@ bool CheckSymbols::visit(MemInitializerAST *ast)
|
||||
// It's a constructor, count the number of arguments
|
||||
unsigned arguments = 0;
|
||||
if (ast->expression) {
|
||||
ExpressionListAST *expr_list = 0;
|
||||
ExpressionListAST *expr_list = nullptr;
|
||||
if (ExpressionListParenAST *parenExprList = ast->expression->asExpressionListParen())
|
||||
expr_list = parenExprList->expression_list;
|
||||
else if (BracedInitializerAST *bracedInitList = ast->expression->asBracedInitializer())
|
||||
@@ -1165,7 +1164,7 @@ void CheckSymbols::addUse(NameAST *ast, Kind kind)
|
||||
|
||||
if (!ast)
|
||||
return; // nothing to do
|
||||
else if (ast->asOperatorFunctionId() != 0 || ast->asConversionFunctionId() != 0)
|
||||
else if (ast->asOperatorFunctionId() != nullptr || ast->asConversionFunctionId() != nullptr)
|
||||
return; // nothing to do
|
||||
|
||||
unsigned startToken = ast->firstToken();
|
||||
@@ -1262,14 +1261,14 @@ bool CheckSymbols::maybeAddTypeOrStatic(const QList<LookupItem> &candidates, Nam
|
||||
else if (c->isTypedef() || c->isNamespace() ||
|
||||
c->isStatic() || //consider also static variable
|
||||
c->isClass() || c->isEnum() || isTemplateClass(c) ||
|
||||
c->isForwardClassDeclaration() || c->isTypenameArgument() || c->enclosingEnum() != 0) {
|
||||
c->isForwardClassDeclaration() || c->isTypenameArgument() || c->enclosingEnum() != nullptr) {
|
||||
|
||||
unsigned line, column;
|
||||
getTokenStartPosition(startToken, &line, &column);
|
||||
const unsigned length = tok.utf16chars();
|
||||
|
||||
Kind kind = SemanticHighlighter::TypeUse;
|
||||
if (c->enclosingEnum() != 0)
|
||||
if (c->enclosingEnum() != nullptr)
|
||||
kind = SemanticHighlighter::EnumerationUse;
|
||||
else if (c->isStatic())
|
||||
// treat static variable as a field(highlighting)
|
||||
@@ -1428,7 +1427,7 @@ NameAST *CheckSymbols::declaratorId(DeclaratorAST *ast) const
|
||||
return declId->name;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CheckSymbols::maybeType(const Name *name) const
|
||||
|
||||
@@ -47,12 +47,12 @@ class CPPTOOLS_EXPORT CheckSymbols:
|
||||
public:
|
||||
~CheckSymbols() override;
|
||||
|
||||
typedef TextEditor::HighlightingResult Result;
|
||||
typedef SemanticHighlighter::Kind Kind;
|
||||
using Result = TextEditor::HighlightingResult;
|
||||
using Kind = SemanticHighlighter::Kind;
|
||||
|
||||
void run() override;
|
||||
|
||||
typedef QFuture<Result> Future;
|
||||
using Future = QFuture<Result>;
|
||||
|
||||
Future start()
|
||||
{
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
|
||||
signals:
|
||||
void codeWarningsUpdated(CPlusPlus::Document::Ptr document,
|
||||
const QList<CPlusPlus::Document::DiagnosticMessage> selections);
|
||||
const QList<CPlusPlus::Document::DiagnosticMessage> &selections);
|
||||
|
||||
protected:
|
||||
using ASTVisitor::visit;
|
||||
|
||||
@@ -39,9 +39,7 @@ CppClassesFilter::CppClassesFilter(CppLocatorData *locatorData)
|
||||
setIncludedByDefault(false);
|
||||
}
|
||||
|
||||
CppClassesFilter::~CppClassesFilter()
|
||||
{
|
||||
}
|
||||
CppClassesFilter::~CppClassesFilter() = default;
|
||||
|
||||
Core::LocatorFilterEntry CppClassesFilter::filterEntryFromIndexItem(IndexItem::Ptr info)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ class CPPTOOLS_EXPORT CppClassesFilter : public Internal::CppLocatorFilter
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CppClassesFilter(CppLocatorData *locatorData);
|
||||
explicit CppClassesFilter(CppLocatorData *locatorData);
|
||||
~CppClassesFilter() override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -40,9 +40,7 @@ using namespace CppTools;
|
||||
using namespace TextEditor;
|
||||
using namespace CppTools::Internal;
|
||||
|
||||
CodeFormatter::~CodeFormatter()
|
||||
{
|
||||
}
|
||||
CodeFormatter::~CodeFormatter() = default;
|
||||
|
||||
void CodeFormatter::setTabSize(int tabSize)
|
||||
{
|
||||
@@ -1098,9 +1096,7 @@ namespace Internal {
|
||||
}
|
||||
}
|
||||
|
||||
QtStyleCodeFormatter::QtStyleCodeFormatter()
|
||||
{
|
||||
}
|
||||
QtStyleCodeFormatter::QtStyleCodeFormatter() = default;
|
||||
|
||||
QtStyleCodeFormatter::QtStyleCodeFormatter(const TabSettings &tabSettings,
|
||||
const CppCodeStyleSettings &settings)
|
||||
@@ -1124,7 +1120,7 @@ void QtStyleCodeFormatter::setCodeStyleSettings(const CppCodeStyleSettings &sett
|
||||
void QtStyleCodeFormatter::saveBlockData(QTextBlock *block, const BlockData &data) const
|
||||
{
|
||||
TextBlockUserData *userData = TextDocumentLayout::userData(*block);
|
||||
CppCodeFormatterData *cppData = static_cast<CppCodeFormatterData *>(userData->codeFormatterData());
|
||||
auto cppData = static_cast<CppCodeFormatterData *>(userData->codeFormatterData());
|
||||
if (!cppData) {
|
||||
cppData = new CppCodeFormatterData;
|
||||
userData->setCodeFormatterData(cppData);
|
||||
@@ -1137,7 +1133,7 @@ bool QtStyleCodeFormatter::loadBlockData(const QTextBlock &block, BlockData *dat
|
||||
TextBlockUserData *userData = TextDocumentLayout::testUserData(block);
|
||||
if (!userData)
|
||||
return false;
|
||||
CppCodeFormatterData *cppData = static_cast<CppCodeFormatterData *>(userData->codeFormatterData());
|
||||
auto cppData = static_cast<const CppCodeFormatterData *>(userData->codeFormatterData());
|
||||
if (!cppData)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ public: // must be public to make Q_GADGET introspection work
|
||||
string_open
|
||||
|
||||
};
|
||||
Q_ENUMS(StateType)
|
||||
Q_ENUM(StateType)
|
||||
|
||||
protected:
|
||||
class State {
|
||||
|
||||
@@ -44,7 +44,7 @@ using namespace CppTools::Internal;
|
||||
|
||||
namespace {
|
||||
|
||||
Document::Ptr createDocument(const QString filePath, const QByteArray text,
|
||||
Document::Ptr createDocument(const QString &filePath, const QByteArray &text,
|
||||
unsigned expectedGlobalSymbolCount)
|
||||
{
|
||||
Document::Ptr document = Document::create(filePath);
|
||||
|
||||
@@ -665,8 +665,8 @@ void Dumper::dumpDocuments(const QList<CPlusPlus::Document::Ptr> &documents, boo
|
||||
if (!diagnosticMessages.isEmpty()) {
|
||||
m_out << i3 << "Diagnostic Messages:{{{4\n";
|
||||
foreach (const CPlusPlus::Document::DiagnosticMessage &msg, diagnosticMessages) {
|
||||
const CPlusPlus::Document::DiagnosticMessage::Level level
|
||||
= static_cast<CPlusPlus::Document::DiagnosticMessage::Level>(msg.level());
|
||||
auto level =
|
||||
static_cast<const CPlusPlus::Document::DiagnosticMessage::Level>(msg.level());
|
||||
m_out << i4 << "at " << msg.line() << ":" << msg.column() << ", " << Utils::toString(level)
|
||||
<< ": " << msg.text() << "\n";
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class CppCodeModelSettingsWidget: public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CppCodeModelSettingsWidget(QWidget *parent = 0);
|
||||
explicit CppCodeModelSettingsWidget(QWidget *parent = nullptr);
|
||||
~CppCodeModelSettingsWidget() override;
|
||||
|
||||
void setSettings(const QSharedPointer<CppCodeModelSettings> &s);
|
||||
@@ -68,11 +68,11 @@ class CppCodeModelSettingsPage: public Core::IOptionsPage
|
||||
{
|
||||
public:
|
||||
explicit CppCodeModelSettingsPage(QSharedPointer<CppCodeModelSettings> &settings,
|
||||
QObject *parent = 0);
|
||||
QObject *parent = nullptr);
|
||||
|
||||
QWidget *widget();
|
||||
void apply();
|
||||
void finish();
|
||||
QWidget *widget() override;
|
||||
void apply() override;
|
||||
void finish() override;
|
||||
|
||||
private:
|
||||
const QSharedPointer<CppCodeModelSettings> m_settings;
|
||||
|
||||
@@ -82,9 +82,7 @@ static const char *defaultPreviewText =
|
||||
;
|
||||
|
||||
|
||||
CppCodeStylePreferencesFactory::CppCodeStylePreferencesFactory()
|
||||
{
|
||||
}
|
||||
CppCodeStylePreferencesFactory::CppCodeStylePreferencesFactory() = default;
|
||||
|
||||
Core::Id CppCodeStylePreferencesFactory::languageId()
|
||||
{
|
||||
@@ -104,10 +102,10 @@ TextEditor::ICodeStylePreferences *CppCodeStylePreferencesFactory::createCodeSty
|
||||
QWidget *CppCodeStylePreferencesFactory::createEditor(TextEditor::ICodeStylePreferences *preferences,
|
||||
QWidget *parent) const
|
||||
{
|
||||
CppCodeStylePreferences *cppPreferences = qobject_cast<CppCodeStylePreferences *>(preferences);
|
||||
auto cppPreferences = qobject_cast<CppCodeStylePreferences *>(preferences);
|
||||
if (!cppPreferences)
|
||||
return 0;
|
||||
Internal::CppCodeStylePreferencesWidget *widget = new Internal::CppCodeStylePreferencesWidget(parent);
|
||||
return nullptr;
|
||||
auto widget = new Internal::CppCodeStylePreferencesWidget(parent);
|
||||
widget->layout()->setMargin(0);
|
||||
widget->setCodeStyle(cppPreferences);
|
||||
return widget;
|
||||
|
||||
@@ -36,14 +36,14 @@ class CPPTOOLS_EXPORT CppCodeStylePreferencesFactory : public TextEditor::ICodeS
|
||||
public:
|
||||
CppCodeStylePreferencesFactory();
|
||||
|
||||
Core::Id languageId();
|
||||
QString displayName();
|
||||
TextEditor::ICodeStylePreferences *createCodeStyle() const;
|
||||
Core::Id languageId() override;
|
||||
QString displayName() override;
|
||||
TextEditor::ICodeStylePreferences *createCodeStyle() const override;
|
||||
QWidget *createEditor(TextEditor::ICodeStylePreferences *settings,
|
||||
QWidget *parent) const;
|
||||
TextEditor::Indenter *createIndenter() const;
|
||||
QString snippetProviderGroupId() const;
|
||||
QString previewText() const;
|
||||
QWidget *parent) const override;
|
||||
TextEditor::Indenter *createIndenter() const override;
|
||||
QString snippetProviderGroupId() const override;
|
||||
QString previewText() const override;
|
||||
};
|
||||
|
||||
} // namespace CppTools
|
||||
|
||||
@@ -214,8 +214,8 @@ Utils::optional<CppCodeStyleSettings> CppCodeStyleSettings::currentProjectCodeSt
|
||||
= editorConfiguration->codeStyle(Constants::CPP_SETTINGS_ID);
|
||||
QTC_ASSERT(codeStylePreferences, return OptSettings());
|
||||
|
||||
CppCodeStylePreferences *cppCodeStylePreferences
|
||||
= dynamic_cast<CppCodeStylePreferences *>(codeStylePreferences);
|
||||
auto cppCodeStylePreferences =
|
||||
dynamic_cast<const CppCodeStylePreferences *>(codeStylePreferences);
|
||||
if (!cppCodeStylePreferences)
|
||||
return OptSettings();
|
||||
|
||||
@@ -258,7 +258,7 @@ TextEditor::TabSettings CppCodeStyleSettings::currentGlobalTabSettings()
|
||||
static void configureOverviewWithCodeStyleSettings(CPlusPlus::Overview &overview,
|
||||
const CppCodeStyleSettings &settings)
|
||||
{
|
||||
overview.starBindFlags = CPlusPlus::Overview::StarBindFlags(0);
|
||||
overview.starBindFlags = CPlusPlus::Overview::StarBindFlags(nullptr);
|
||||
if (settings.bindStarToIdentifier)
|
||||
overview.starBindFlags |= CPlusPlus::Overview::BindToIdentifier;
|
||||
if (settings.bindStarToTypeName)
|
||||
|
||||
@@ -224,7 +224,7 @@ static void applyRefactorings(QTextDocument *textDocument, TextEditorWidget *edi
|
||||
{
|
||||
// Preprocess source
|
||||
Environment env;
|
||||
Preprocessor preprocess(0, &env);
|
||||
Preprocessor preprocess(nullptr, &env);
|
||||
const QByteArray preprocessedSource
|
||||
= preprocess.run(QLatin1String("<no-file>"), textDocument->toPlainText());
|
||||
|
||||
@@ -238,7 +238,7 @@ static void applyRefactorings(QTextDocument *textDocument, TextEditorWidget *edi
|
||||
// Run the formatter
|
||||
Overview overview;
|
||||
overview.showReturnTypes = true;
|
||||
overview.starBindFlags = Overview::StarBindFlags(0);
|
||||
overview.starBindFlags = Overview::StarBindFlags(nullptr);
|
||||
|
||||
if (settings.bindStarToIdentifier)
|
||||
overview.starBindFlags |= Overview::BindToIdentifier;
|
||||
@@ -261,9 +261,7 @@ static void applyRefactorings(QTextDocument *textDocument, TextEditorWidget *edi
|
||||
|
||||
CppCodeStylePreferencesWidget::CppCodeStylePreferencesWidget(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
m_preferences(0),
|
||||
m_ui(new Ui::CppCodeStyleSettingsPage),
|
||||
m_blockUpdates(false)
|
||||
m_ui(new Ui::CppCodeStyleSettingsPage)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->categoryTab->setProperty("_q_custom_style_disabled", true);
|
||||
@@ -442,7 +440,7 @@ void CppCodeStylePreferencesWidget::slotCodeStyleSettingsChanged()
|
||||
return;
|
||||
|
||||
if (m_preferences) {
|
||||
CppCodeStylePreferences *current = qobject_cast<CppCodeStylePreferences *>(m_preferences->currentPreferences());
|
||||
auto current = qobject_cast<CppCodeStylePreferences *>(m_preferences->currentPreferences());
|
||||
if (current)
|
||||
current->setCodeStyleSettings(cppCodeStyleSettings());
|
||||
}
|
||||
@@ -456,7 +454,7 @@ void CppCodeStylePreferencesWidget::slotTabSettingsChanged(const TabSettings &se
|
||||
return;
|
||||
|
||||
if (m_preferences) {
|
||||
CppCodeStylePreferences *current = qobject_cast<CppCodeStylePreferences *>(m_preferences->currentPreferences());
|
||||
auto current = qobject_cast<CppCodeStylePreferences *>(m_preferences->currentPreferences());
|
||||
if (current)
|
||||
current->setTabSettings(settings);
|
||||
}
|
||||
@@ -512,9 +510,8 @@ void CppCodeStylePreferencesWidget::setVisualizeWhitespace(bool on)
|
||||
|
||||
// ------------------ CppCodeStyleSettingsPage
|
||||
|
||||
CppCodeStyleSettingsPage::CppCodeStyleSettingsPage(QWidget *parent) :
|
||||
Core::IOptionsPage(parent),
|
||||
m_pageCppCodeStylePreferences(0)
|
||||
CppCodeStyleSettingsPage::CppCodeStyleSettingsPage(QWidget *parent)
|
||||
: Core::IOptionsPage(parent)
|
||||
{
|
||||
setId(Constants::CPP_CODE_STYLE_SETTINGS_ID);
|
||||
setDisplayName(QCoreApplication::translate("CppTools", Constants::CPP_CODE_STYLE_SETTINGS_NAME));
|
||||
|
||||
@@ -54,8 +54,8 @@ class CppCodeStylePreferencesWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CppCodeStylePreferencesWidget(QWidget *parent = 0);
|
||||
virtual ~CppCodeStylePreferencesWidget();
|
||||
explicit CppCodeStylePreferencesWidget(QWidget *parent = nullptr);
|
||||
~CppCodeStylePreferencesWidget() override;
|
||||
|
||||
void setCodeStyle(CppTools::CppCodeStylePreferences *codeStylePreferences);
|
||||
|
||||
@@ -71,10 +71,10 @@ private:
|
||||
|
||||
CppCodeStyleSettings cppCodeStyleSettings() const;
|
||||
|
||||
CppCodeStylePreferences *m_preferences;
|
||||
CppCodeStylePreferences *m_preferences = nullptr;
|
||||
Ui::CppCodeStyleSettingsPage *m_ui;
|
||||
QList<TextEditor::SnippetEditorWidget *> m_previews;
|
||||
bool m_blockUpdates;
|
||||
bool m_blockUpdates = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -83,14 +83,14 @@ class CppCodeStyleSettingsPage : public Core::IOptionsPage
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CppCodeStyleSettingsPage(QWidget *parent = 0);
|
||||
explicit CppCodeStyleSettingsPage(QWidget *parent = nullptr);
|
||||
|
||||
QWidget *widget();
|
||||
void apply();
|
||||
void finish();
|
||||
QWidget *widget() override;
|
||||
void apply() override;
|
||||
void finish() override;
|
||||
|
||||
private:
|
||||
CppCodeStylePreferences *m_pageCppCodeStylePreferences;
|
||||
CppCodeStylePreferences *m_pageCppCodeStylePreferences = nullptr;
|
||||
QPointer<QWidget> m_widget;
|
||||
};
|
||||
|
||||
|
||||
@@ -54,14 +54,13 @@ using namespace Core;
|
||||
|
||||
namespace {
|
||||
|
||||
typedef QByteArray _;
|
||||
using _ = QByteArray;
|
||||
|
||||
class CompletionTestCase : public Tests::TestCase
|
||||
{
|
||||
public:
|
||||
CompletionTestCase(const QByteArray &sourceText, const QByteArray &textToInsert = QByteArray(),
|
||||
bool isObjC = false)
|
||||
: m_position(-1), m_editorWidget(0), m_textDocument(0), m_editor(0)
|
||||
{
|
||||
QVERIFY(succeededSoFar());
|
||||
m_succeededSoFar = false;
|
||||
@@ -100,7 +99,7 @@ public:
|
||||
m_succeededSoFar = true;
|
||||
}
|
||||
|
||||
QStringList getCompletions(bool *replaceAccessOperator = 0) const
|
||||
QStringList getCompletions(bool *replaceAccessOperator = nullptr) const
|
||||
{
|
||||
QStringList completions;
|
||||
LanguageFeatures languageFeatures = LanguageFeatures::defaultFeatures();
|
||||
@@ -153,12 +152,12 @@ public:
|
||||
|
||||
private:
|
||||
QByteArray m_source;
|
||||
int m_position;
|
||||
int m_position = -1;
|
||||
Snapshot m_snapshot;
|
||||
QScopedPointer<Tests::TemporaryDir> m_temporaryDir;
|
||||
TextEditorWidget *m_editorWidget;
|
||||
QTextDocument *m_textDocument;
|
||||
IEditor *m_editor;
|
||||
TextEditorWidget *m_editorWidget = nullptr;
|
||||
QTextDocument *m_textDocument = nullptr;
|
||||
IEditor *m_editor = nullptr;
|
||||
};
|
||||
|
||||
bool isProbablyGlobalCompletion(const QStringList &list)
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Internal {
|
||||
|
||||
struct CompleteFunctionDeclaration
|
||||
{
|
||||
explicit CompleteFunctionDeclaration(Function *f = 0)
|
||||
explicit CompleteFunctionDeclaration(Function *f = nullptr)
|
||||
: function(f)
|
||||
{}
|
||||
|
||||
@@ -83,7 +83,7 @@ struct CompleteFunctionDeclaration
|
||||
class CppAssistProposalItem final : public AssistProposalItem
|
||||
{
|
||||
public:
|
||||
~CppAssistProposalItem() noexcept {}
|
||||
~CppAssistProposalItem() noexcept override = default;
|
||||
bool prematurelyApplies(const QChar &c) const override;
|
||||
void applyContextualContent(TextDocumentManipulatorInterface &manipulator, int basePosition) const override;
|
||||
|
||||
@@ -120,7 +120,7 @@ AssistProposalItemInterface *CppAssistProposalModel::proposalItem(int index) con
|
||||
{
|
||||
AssistProposalItemInterface *item = GenericProposalModel::proposalItem(index);
|
||||
if (!item->isSnippet()) {
|
||||
CppAssistProposalItem *cppItem = static_cast<CppAssistProposalItem *>(item);
|
||||
auto cppItem = static_cast<CppAssistProposalItem *>(item);
|
||||
cppItem->keepCompletionOperator(m_completionOperator);
|
||||
cppItem->keepTypeOfExpression(m_typeOfExpression);
|
||||
}
|
||||
@@ -191,7 +191,7 @@ quint64 CppAssistProposalItem::hash() const
|
||||
|
||||
void CppAssistProposalItem::applyContextualContent(TextDocumentManipulatorInterface &manipulator, int basePosition) const
|
||||
{
|
||||
Symbol *symbol = 0;
|
||||
Symbol *symbol = nullptr;
|
||||
|
||||
if (data().isValid())
|
||||
symbol = data().value<Symbol *>();
|
||||
@@ -347,7 +347,7 @@ void CppAssistProposalItem::applyContextualContent(TextDocumentManipulatorInterf
|
||||
class CppFunctionHintModel : public IFunctionHintProposalModel
|
||||
{
|
||||
public:
|
||||
CppFunctionHintModel(QList<Function *> functionSymbols,
|
||||
CppFunctionHintModel(const QList<Function *> &functionSymbols,
|
||||
const QSharedPointer<TypeOfExpression> &typeOfExp)
|
||||
: m_functionSymbols(functionSymbols)
|
||||
, m_currentArg(-1)
|
||||
@@ -426,7 +426,7 @@ AssistInterface *InternalCompletionAssistProvider::createAssistInterface(const Q
|
||||
int position,
|
||||
AssistReason reason) const
|
||||
{
|
||||
QTC_ASSERT(textEditorWidget, return 0);
|
||||
QTC_ASSERT(textEditorWidget, return nullptr);
|
||||
|
||||
return new CppCompletionAssistInterface(filePath,
|
||||
textEditorWidget,
|
||||
@@ -469,18 +469,16 @@ namespace {
|
||||
class ConvertToCompletionItem: protected NameVisitor
|
||||
{
|
||||
// The completion item.
|
||||
AssistProposalItem *_item;
|
||||
AssistProposalItem *_item = nullptr;
|
||||
|
||||
// The current symbol.
|
||||
Symbol *_symbol;
|
||||
Symbol *_symbol = nullptr;
|
||||
|
||||
// The pretty printer.
|
||||
Overview overview;
|
||||
|
||||
public:
|
||||
ConvertToCompletionItem()
|
||||
: _item(0)
|
||||
, _symbol(0)
|
||||
{
|
||||
overview.showReturnTypes = true;
|
||||
overview.showArgumentNames = true;
|
||||
@@ -491,9 +489,9 @@ public:
|
||||
//using declaration can be qualified
|
||||
if (!symbol || !symbol->name() || (symbol->name()->isQualifiedNameId()
|
||||
&& !symbol->asUsingDeclaration()))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
AssistProposalItem *previousItem = switchCompletionItem(0);
|
||||
AssistProposalItem *previousItem = switchCompletionItem(nullptr);
|
||||
Symbol *previousSymbol = switchSymbol(symbol);
|
||||
accept(symbol->unqualifiedName());
|
||||
if (_item)
|
||||
@@ -524,32 +522,32 @@ protected:
|
||||
return item;
|
||||
}
|
||||
|
||||
void visit(const Identifier *name)
|
||||
void visit(const Identifier *name) override
|
||||
{
|
||||
_item = newCompletionItem(name);
|
||||
if (!_symbol->isScope() || _symbol->isFunction())
|
||||
_item->setDetail(overview.prettyType(_symbol->type(), name));
|
||||
}
|
||||
|
||||
void visit(const TemplateNameId *name)
|
||||
void visit(const TemplateNameId *name) override
|
||||
{
|
||||
_item = newCompletionItem(name);
|
||||
_item->setText(QString::fromUtf8(name->identifier()->chars(), name->identifier()->size()));
|
||||
}
|
||||
|
||||
void visit(const DestructorNameId *name)
|
||||
void visit(const DestructorNameId *name) override
|
||||
{ _item = newCompletionItem(name); }
|
||||
|
||||
void visit(const OperatorNameId *name)
|
||||
void visit(const OperatorNameId *name) override
|
||||
{
|
||||
_item = newCompletionItem(name);
|
||||
_item->setDetail(overview.prettyType(_symbol->type(), name));
|
||||
}
|
||||
|
||||
void visit(const ConversionNameId *name)
|
||||
void visit(const ConversionNameId *name) override
|
||||
{ _item = newCompletionItem(name); }
|
||||
|
||||
void visit(const QualifiedNameId *name)
|
||||
void visit(const QualifiedNameId *name) override
|
||||
{ _item = newCompletionItem(name->name()); }
|
||||
};
|
||||
|
||||
@@ -561,7 +559,7 @@ Class *asClassOrTemplateClassType(FullySpecifiedType ty)
|
||||
if (Symbol *decl = templ->declaration())
|
||||
return decl->asClass();
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Scope *enclosingNonTemplateScope(Symbol *symbol)
|
||||
@@ -573,7 +571,7 @@ Scope *enclosingNonTemplateScope(Symbol *symbol)
|
||||
return scope;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Function *asFunctionOrTemplateFunctionType(FullySpecifiedType ty)
|
||||
@@ -584,7 +582,7 @@ Function *asFunctionOrTemplateFunctionType(FullySpecifiedType ty)
|
||||
if (Symbol *decl = templ->declaration())
|
||||
return decl->asFunction();
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool isQPrivateSignal(const Symbol *symbol)
|
||||
@@ -758,7 +756,7 @@ bool canCompleteClassNameAt2ndOr4thConnectArgument(
|
||||
ClassOrNamespace *classOrNamespaceFromLookupItem(const LookupItem &lookupItem,
|
||||
const LookupContext &context)
|
||||
{
|
||||
const Name *name = 0;
|
||||
const Name *name = nullptr;
|
||||
|
||||
if (Symbol *d = lookupItem.declaration()) {
|
||||
if (Class *k = d->asClass())
|
||||
@@ -771,29 +769,29 @@ ClassOrNamespace *classOrNamespaceFromLookupItem(const LookupItem &lookupItem,
|
||||
if (PointerType *pointerType = type->asPointerType())
|
||||
type = pointerType->elementType().simplified();
|
||||
else
|
||||
return 0; // not a pointer or a reference to a pointer.
|
||||
return nullptr; // not a pointer or a reference to a pointer.
|
||||
|
||||
NamedType *namedType = type->asNamedType();
|
||||
if (!namedType) // not a class name.
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
name = namedType->name();
|
||||
}
|
||||
|
||||
return name ? context.lookupType(name, lookupItem.scope()) : 0;
|
||||
return name ? context.lookupType(name, lookupItem.scope()) : nullptr;
|
||||
}
|
||||
|
||||
Class *classFromLookupItem(const LookupItem &lookupItem, const LookupContext &context)
|
||||
{
|
||||
ClassOrNamespace *b = classOrNamespaceFromLookupItem(lookupItem, context);
|
||||
if (!b)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
foreach (Symbol *s, b->symbols()) {
|
||||
if (Class *klass = s->asClass())
|
||||
return klass;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Name *minimalName(Symbol *symbol, Scope *targetScope, const LookupContext &context)
|
||||
@@ -814,15 +812,14 @@ InternalCppCompletionAssistProcessor::InternalCppCompletionAssistProcessor()
|
||||
{
|
||||
}
|
||||
|
||||
InternalCppCompletionAssistProcessor::~InternalCppCompletionAssistProcessor()
|
||||
{}
|
||||
InternalCppCompletionAssistProcessor::~InternalCppCompletionAssistProcessor() = default;
|
||||
|
||||
IAssistProposal * InternalCppCompletionAssistProcessor::perform(const AssistInterface *interface)
|
||||
{
|
||||
m_interface.reset(static_cast<const CppCompletionAssistInterface *>(interface));
|
||||
|
||||
if (interface->reason() != ExplicitlyInvoked && !accepts())
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
int index = startCompletionHelper();
|
||||
if (index != -1) {
|
||||
@@ -832,7 +829,7 @@ IAssistProposal * InternalCppCompletionAssistProcessor::perform(const AssistInte
|
||||
return createContentProposal();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool InternalCppCompletionAssistProcessor::accepts() const
|
||||
@@ -901,13 +898,13 @@ IAssistProposal *InternalCppCompletionAssistProcessor::createContentProposal()
|
||||
QSet<QString> processed;
|
||||
auto it = m_completions.begin();
|
||||
while (it != m_completions.end()) {
|
||||
CppAssistProposalItem *item = static_cast<CppAssistProposalItem *>(*it);
|
||||
auto item = static_cast<CppAssistProposalItem *>(*it);
|
||||
if (!processed.contains(item->text()) || item->isSnippet()) {
|
||||
++it;
|
||||
if (!item->isSnippet()) {
|
||||
processed.insert(item->text());
|
||||
if (!item->isOverloaded()) {
|
||||
if (Symbol *symbol = qvariant_cast<Symbol *>(item->data())) {
|
||||
if (auto symbol = qvariant_cast<Symbol *>(item->data())) {
|
||||
if (Function *funTy = symbol->type()->asFunctionType()) {
|
||||
if (funTy->hasArguments())
|
||||
item->markAsOverloaded();
|
||||
@@ -1333,7 +1330,7 @@ int InternalCppCompletionAssistProcessor::startCompletionInternal(const QString
|
||||
m_model->m_typeOfExpression->init(thisDocument, m_interface->snapshot());
|
||||
|
||||
Scope *scope = thisDocument->scopeAt(line, positionInBlock);
|
||||
QTC_ASSERT(scope != 0, return -1);
|
||||
QTC_ASSERT(scope, return -1);
|
||||
|
||||
if (expression.isEmpty()) {
|
||||
if (m_model->m_completionOperator == T_EOF_SYMBOL || m_model->m_completionOperator == T_COLON_COLON) {
|
||||
@@ -1461,7 +1458,7 @@ bool InternalCppCompletionAssistProcessor::globalCompletion(Scope *currentScope)
|
||||
}
|
||||
|
||||
QList<ClassOrNamespace *> usingBindings;
|
||||
ClassOrNamespace *currentBinding = 0;
|
||||
ClassOrNamespace *currentBinding = nullptr;
|
||||
|
||||
for (Scope *scope = currentScope; scope; scope = scope->enclosingScope()) {
|
||||
if (Block *block = scope->asBlock()) {
|
||||
@@ -1543,7 +1540,7 @@ bool InternalCppCompletionAssistProcessor::completeMember(const QList<LookupItem
|
||||
|
||||
ResolveExpression resolveExpression(context);
|
||||
|
||||
bool *replaceDotForArrow = 0;
|
||||
bool *replaceDotForArrow = nullptr;
|
||||
if (!m_interface->languageFeatures().objCEnabled)
|
||||
replaceDotForArrow = &m_model->m_replaceDotForArrow;
|
||||
|
||||
|
||||
@@ -62,8 +62,6 @@ class CppAssistProposalModel : public TextEditor::GenericProposalModel
|
||||
public:
|
||||
CppAssistProposalModel()
|
||||
: TextEditor::GenericProposalModel()
|
||||
, m_completionOperator(CPlusPlus::T_EOF_SYMBOL)
|
||||
, m_replaceDotForArrow(false)
|
||||
, m_typeOfExpression(new CPlusPlus::TypeOfExpression)
|
||||
{
|
||||
m_typeOfExpression->setExpandTemplates(true);
|
||||
@@ -72,8 +70,8 @@ public:
|
||||
bool isSortable(const QString &prefix) const override;
|
||||
TextEditor::AssistProposalItemInterface *proposalItem(int index) const override;
|
||||
|
||||
unsigned m_completionOperator;
|
||||
bool m_replaceDotForArrow;
|
||||
unsigned m_completionOperator = CPlusPlus::T_EOF_SYMBOL;
|
||||
bool m_replaceDotForArrow = false;
|
||||
QSharedPointer<CPlusPlus::TypeOfExpression> m_typeOfExpression;
|
||||
};
|
||||
|
||||
@@ -98,7 +96,7 @@ class InternalCppCompletionAssistProcessor : public CppCompletionAssistProcessor
|
||||
{
|
||||
public:
|
||||
InternalCppCompletionAssistProcessor();
|
||||
~InternalCppCompletionAssistProcessor();
|
||||
~InternalCppCompletionAssistProcessor() override;
|
||||
|
||||
TextEditor::IAssistProposal *perform(const TextEditor::AssistInterface *interface) override;
|
||||
|
||||
|
||||
@@ -41,8 +41,7 @@ using namespace CPlusPlus;
|
||||
namespace CppTools {
|
||||
|
||||
CppCompletionAssistProcessor::CppCompletionAssistProcessor(int snippetItemOrder)
|
||||
: m_positionForProposal(-1)
|
||||
, m_preprocessorCompletions(
|
||||
: m_preprocessorCompletions(
|
||||
QStringList({"define", "error", "include", "line", "pragma", "pragma once",
|
||||
"pragma omp atomic", "pragma omp parallel", "pragma omp for",
|
||||
"pragma omp ordered", "pragma omp parallel for", "pragma omp section",
|
||||
@@ -50,7 +49,6 @@ CppCompletionAssistProcessor::CppCompletionAssistProcessor(int snippetItemOrder)
|
||||
"pragma omp master", "pragma omp critical", "pragma omp barrier",
|
||||
"pragma omp flush", "pragma omp threadprivate", "undef", "if", "ifdef",
|
||||
"ifndef", "elif", "else", "endif"}))
|
||||
, m_hintProposal(0)
|
||||
, m_snippetCollector(QLatin1String(CppEditor::Constants::CPP_SNIPPETS_GROUP_ID),
|
||||
QIcon(QLatin1String(":/texteditor/images/snippet.png")),
|
||||
snippetItemOrder)
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace CppTools {
|
||||
class CPPTOOLS_EXPORT CppCompletionAssistProcessor : public TextEditor::IAssistProcessor
|
||||
{
|
||||
public:
|
||||
CppCompletionAssistProcessor(int snippetItemOrder = 0);
|
||||
explicit CppCompletionAssistProcessor(int snippetItemOrder = 0);
|
||||
|
||||
protected:
|
||||
void addSnippets();
|
||||
@@ -60,10 +60,10 @@ protected:
|
||||
DotAtIncludeCompletionHandler dotAtIncludeCompletionHandler
|
||||
= DotAtIncludeCompletionHandler());
|
||||
|
||||
int m_positionForProposal;
|
||||
int m_positionForProposal = -1;
|
||||
QList<TextEditor::AssistProposalItemInterface *> m_completions;
|
||||
QStringList m_preprocessorCompletions;
|
||||
TextEditor::IAssistProposal *m_hintProposal;
|
||||
TextEditor::IAssistProposal *m_hintProposal = nullptr;
|
||||
|
||||
private:
|
||||
TextEditor::SnippetAssistCollector m_snippetCollector;
|
||||
|
||||
@@ -51,7 +51,7 @@ bool CppCompletionAssistProvider::isActivationCharSequence(const QString &sequen
|
||||
const QChar &ch = sequence.at(2);
|
||||
const QChar &ch2 = sequence.at(1);
|
||||
const QChar &ch3 = sequence.at(0);
|
||||
if (activationSequenceChar(ch, ch2, ch3, 0, true, false) != 0)
|
||||
if (activationSequenceChar(ch, ch2, ch3, nullptr, true, false) != 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ QList<Core::LocatorFilterEntry> CppCurrentDocumentFilter::matchesFor(
|
||||
return goodEntries;
|
||||
|
||||
const QList<IndexItem::Ptr> items = itemsOfCurrentDocument();
|
||||
for (IndexItem::Ptr info : items) {
|
||||
for (const IndexItem::Ptr &info : items) {
|
||||
if (future.isCanceled())
|
||||
break;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class CppCurrentDocumentFilter : public Core::ILocatorFilter
|
||||
|
||||
public:
|
||||
explicit CppCurrentDocumentFilter(CppModelManager *manager);
|
||||
~CppCurrentDocumentFilter() {}
|
||||
~CppCurrentDocumentFilter() override = default;
|
||||
|
||||
QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future,
|
||||
const QString &entry) override;
|
||||
|
||||
@@ -57,11 +57,9 @@ static QStringList stripName(const QString &name)
|
||||
return all;
|
||||
}
|
||||
|
||||
CppElement::CppElement() : helpCategory(TextEditor::HelpItem::Unknown)
|
||||
{}
|
||||
CppElement::CppElement() = default;
|
||||
|
||||
CppElement::~CppElement()
|
||||
{}
|
||||
CppElement::~CppElement() = default;
|
||||
|
||||
CppClass *CppElement::toCppClass()
|
||||
{
|
||||
@@ -168,7 +166,7 @@ CppClass *CppClass::toCppClass()
|
||||
|
||||
void CppClass::lookupBases(Symbol *declaration, const LookupContext &context)
|
||||
{
|
||||
typedef QPair<ClassOrNamespace *, CppClass *> Data;
|
||||
using Data = QPair<ClassOrNamespace*, CppClass*>;
|
||||
|
||||
if (ClassOrNamespace *clazz = context.lookupType(declaration)) {
|
||||
QSet<ClassOrNamespace *> visited;
|
||||
@@ -199,7 +197,7 @@ void CppClass::lookupBases(Symbol *declaration, const LookupContext &context)
|
||||
|
||||
void CppClass::lookupDerived(Symbol *declaration, const Snapshot &snapshot)
|
||||
{
|
||||
typedef QPair<CppClass *, CppTools::TypeHierarchy> Data;
|
||||
using Data = QPair<CppClass*, CppTools::TypeHierarchy>;
|
||||
|
||||
CppTools::TypeHierarchyBuilder builder(declaration, snapshot);
|
||||
const CppTools::TypeHierarchy &completeHierarchy = builder.buildDerivedTypeHierarchy();
|
||||
@@ -268,7 +266,7 @@ public:
|
||||
{
|
||||
const FullySpecifiedType &type = declaration->type();
|
||||
|
||||
const Name *typeName = 0;
|
||||
const Name *typeName = nullptr;
|
||||
if (type->isNamedType()) {
|
||||
typeName = type->asNamedType()->name();
|
||||
} else if (type->isPointerType() || type->isReferenceType()) {
|
||||
@@ -462,7 +460,7 @@ void CppElementEvaluator::handleLookupItemMatch(const Snapshot &snapshot,
|
||||
}
|
||||
}
|
||||
|
||||
CppClass *cppClass = new CppClass(declaration);
|
||||
auto cppClass = new CppClass(declaration);
|
||||
if (m_lookupBaseClasses)
|
||||
cppClass->lookupBases(declaration, contextToUse);
|
||||
if (m_lookupDerivedClasses)
|
||||
@@ -470,7 +468,7 @@ void CppElementEvaluator::handleLookupItemMatch(const Snapshot &snapshot,
|
||||
m_element = QSharedPointer<CppElement>(cppClass);
|
||||
} else if (Enum *enumDecl = declaration->asEnum()) {
|
||||
m_element = QSharedPointer<CppElement>(new CppEnum(enumDecl));
|
||||
} else if (EnumeratorDeclaration *enumerator = dynamic_cast<EnumeratorDeclaration *>(declaration)) {
|
||||
} else if (auto enumerator = dynamic_cast<EnumeratorDeclaration *>(declaration)) {
|
||||
m_element = QSharedPointer<CppElement>(new CppEnumerator(enumerator));
|
||||
} else if (declaration->isTypedef()) {
|
||||
m_element = QSharedPointer<CppElement>(new CppTypedef(declaration));
|
||||
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
|
||||
virtual CppClass *toCppClass();
|
||||
|
||||
TextEditor::HelpItem::Category helpCategory;
|
||||
TextEditor::HelpItem::Category helpCategory = TextEditor::HelpItem::Unknown;
|
||||
QStringList helpIdCandidates;
|
||||
QString helpMark;
|
||||
Utils::Link link;
|
||||
|
||||
@@ -86,9 +86,7 @@ bool operator<(const FileIterationOrder::Entry &first, const FileIterationOrder:
|
||||
}
|
||||
}
|
||||
|
||||
FileIterationOrder::FileIterationOrder()
|
||||
{
|
||||
}
|
||||
FileIterationOrder::FileIterationOrder() = default;
|
||||
|
||||
FileIterationOrder::FileIterationOrder(const QString &referenceFilePath,
|
||||
const QString &referenceProjectPartId)
|
||||
|
||||
@@ -71,8 +71,8 @@ class CppFileSettingsWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CppFileSettingsWidget(QWidget *parent = 0);
|
||||
virtual ~CppFileSettingsWidget();
|
||||
explicit CppFileSettingsWidget(QWidget *parent = nullptr);
|
||||
~CppFileSettingsWidget() override;
|
||||
|
||||
CppFileSettings settings() const;
|
||||
void setSettings(const CppFileSettings &s);
|
||||
@@ -89,11 +89,11 @@ class CppFileSettingsPage : public Core::IOptionsPage
|
||||
{
|
||||
public:
|
||||
explicit CppFileSettingsPage(QSharedPointer<CppFileSettings> &settings,
|
||||
QObject *parent = 0);
|
||||
QObject *parent = nullptr);
|
||||
|
||||
QWidget *widget();
|
||||
void apply();
|
||||
void finish();
|
||||
QWidget *widget() override;
|
||||
void apply() override;
|
||||
void finish() override;
|
||||
|
||||
private:
|
||||
const QSharedPointer<CppFileSettings> m_settings;
|
||||
|
||||
@@ -218,7 +218,7 @@ public:
|
||||
}
|
||||
|
||||
CPlusPlus::Control *control = doc->control();
|
||||
if (control->findIdentifier(symbolId->chars(), symbolId->size()) != 0) {
|
||||
if (control->findIdentifier(symbolId->chars(), symbolId->size()) != nullptr) {
|
||||
if (doc != symbolDocument)
|
||||
doc->check();
|
||||
|
||||
@@ -239,7 +239,7 @@ class UpdateUI
|
||||
QFutureInterface<CPlusPlus::Usage> *future;
|
||||
|
||||
public:
|
||||
UpdateUI(QFutureInterface<CPlusPlus::Usage> *future): future(future) {}
|
||||
explicit UpdateUI(QFutureInterface<CPlusPlus::Usage> *future): future(future) {}
|
||||
|
||||
void operator()(QList<CPlusPlus::Usage> &, const QList<CPlusPlus::Usage> &usages)
|
||||
{
|
||||
@@ -258,9 +258,7 @@ CppFindReferences::CppFindReferences(CppModelManager *modelManager)
|
||||
{
|
||||
}
|
||||
|
||||
CppFindReferences::~CppFindReferences()
|
||||
{
|
||||
}
|
||||
CppFindReferences::~CppFindReferences() = default;
|
||||
|
||||
QList<int> CppFindReferences::references(CPlusPlus::Symbol *symbol,
|
||||
const CPlusPlus::LookupContext &context) const
|
||||
@@ -276,11 +274,11 @@ QList<int> CppFindReferences::references(CPlusPlus::Symbol *symbol,
|
||||
|
||||
static void find_helper(QFutureInterface<CPlusPlus::Usage> &future,
|
||||
const WorkingCopy workingCopy,
|
||||
const CPlusPlus::LookupContext context,
|
||||
const CPlusPlus::LookupContext &context,
|
||||
CPlusPlus::Symbol *symbol)
|
||||
{
|
||||
const CPlusPlus::Identifier *symbolId = symbol->identifier();
|
||||
QTC_ASSERT(symbolId != 0, return);
|
||||
QTC_ASSERT(symbolId != nullptr, return);
|
||||
|
||||
const CPlusPlus::Snapshot snapshot = context.snapshot();
|
||||
|
||||
@@ -465,7 +463,7 @@ void CppFindReferences::onReplaceButtonClicked(const QString &text,
|
||||
|
||||
void CppFindReferences::searchAgain()
|
||||
{
|
||||
SearchResult *search = qobject_cast<SearchResult *>(sender());
|
||||
auto search = qobject_cast<SearchResult *>(sender());
|
||||
CppFindReferencesParameters parameters = search->userData().value<CppFindReferencesParameters>();
|
||||
parameters.filesToRename.clear();
|
||||
CPlusPlus::Snapshot snapshot = CppModelManager::instance()->snapshot();
|
||||
@@ -483,10 +481,10 @@ namespace {
|
||||
class UidSymbolFinder : public CPlusPlus::SymbolVisitor
|
||||
{
|
||||
public:
|
||||
UidSymbolFinder(const QList<QByteArray> &uid) : m_uid(uid), m_index(0), m_result(0) { }
|
||||
explicit UidSymbolFinder(const QList<QByteArray> &uid) : m_uid(uid) { }
|
||||
CPlusPlus::Symbol *result() const { return m_result; }
|
||||
|
||||
bool preVisit(CPlusPlus::Symbol *symbol)
|
||||
bool preVisit(CPlusPlus::Symbol *symbol) override
|
||||
{
|
||||
if (m_result)
|
||||
return false;
|
||||
@@ -505,7 +503,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
void postVisit(CPlusPlus::Symbol *symbol)
|
||||
void postVisit(CPlusPlus::Symbol *symbol) override
|
||||
{
|
||||
if (symbol->asScope())
|
||||
--m_index;
|
||||
@@ -513,8 +511,8 @@ public:
|
||||
|
||||
private:
|
||||
QList<QByteArray> m_uid;
|
||||
int m_index;
|
||||
CPlusPlus::Symbol *m_result;
|
||||
int m_index = 0;
|
||||
CPlusPlus::Symbol *m_result = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -522,10 +520,10 @@ CPlusPlus::Symbol *CppFindReferences::findSymbol(const CppFindReferencesParamete
|
||||
const CPlusPlus::Snapshot &snapshot,
|
||||
CPlusPlus::LookupContext *context)
|
||||
{
|
||||
QTC_ASSERT(context, return 0);
|
||||
QTC_ASSERT(context, return nullptr);
|
||||
QString symbolFile = QLatin1String(parameters.symbolFileName);
|
||||
if (!snapshot.contains(symbolFile))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
CPlusPlus::Document::Ptr newSymbolDocument = snapshot.document(symbolFile);
|
||||
// document is not parsed and has no bindings yet, do it
|
||||
@@ -542,7 +540,7 @@ CPlusPlus::Symbol *CppFindReferences::findSymbol(const CppFindReferencesParamete
|
||||
*context = CPlusPlus::LookupContext(doc, snapshot);
|
||||
return finder.result();
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void displayResults(SearchResult *search, QFutureWatcher<CPlusPlus::Usage> *watcher,
|
||||
@@ -661,7 +659,7 @@ restart_search:
|
||||
}
|
||||
|
||||
static QString matchingLine(unsigned bytesOffsetOfUseStart, const QByteArray &utf8Source,
|
||||
unsigned *columnOfUseStart = 0)
|
||||
unsigned *columnOfUseStart = nullptr)
|
||||
{
|
||||
int lineBegin = utf8Source.lastIndexOf('\n', bytesOffsetOfUseStart) + 1;
|
||||
int lineEnd = utf8Source.indexOf('\n', bytesOffsetOfUseStart);
|
||||
@@ -765,7 +763,7 @@ void CppFindReferences::renameMacroUses(const CPlusPlus::Macro ¯o, const QSt
|
||||
|
||||
void CppFindReferences::createWatcher(const QFuture<CPlusPlus::Usage> &future, SearchResult *search)
|
||||
{
|
||||
QFutureWatcher<CPlusPlus::Usage> *watcher = new QFutureWatcher<CPlusPlus::Usage>();
|
||||
auto watcher = new QFutureWatcher<CPlusPlus::Usage>();
|
||||
// auto-delete:
|
||||
connect(watcher, &QFutureWatcherBase::finished, watcher, [search, watcher]() {
|
||||
searchFinished(search, watcher);
|
||||
|
||||
@@ -63,8 +63,8 @@ class CppFindReferences: public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CppFindReferences(CppModelManager *modelManager);
|
||||
virtual ~CppFindReferences();
|
||||
explicit CppFindReferences(CppModelManager *modelManager);
|
||||
~CppFindReferences() override;
|
||||
|
||||
QList<int> references(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context) const;
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ public:
|
||||
const Document::Ptr &document,
|
||||
const Snapshot &snapshot,
|
||||
SymbolFinder *symbolFinder);
|
||||
VirtualFunctionHelper() = delete;
|
||||
|
||||
bool canLookupVirtualFunctionOverrides(Function *function);
|
||||
|
||||
@@ -67,7 +68,6 @@ public:
|
||||
{ return m_staticClassOfFunctionCallExpression; }
|
||||
|
||||
private:
|
||||
VirtualFunctionHelper();
|
||||
Q_DISABLE_COPY(VirtualFunctionHelper)
|
||||
|
||||
Class *staticClassOfFunctionCallExpression_internal() const;
|
||||
@@ -82,10 +82,10 @@ private:
|
||||
SymbolFinder *m_finder;
|
||||
|
||||
// Determined
|
||||
ExpressionAST *m_baseExpressionAST;
|
||||
Function *m_function;
|
||||
int m_accessTokenKind;
|
||||
Class *m_staticClassOfFunctionCallExpression; // Output
|
||||
ExpressionAST *m_baseExpressionAST = nullptr;
|
||||
Function *m_function = nullptr;
|
||||
int m_accessTokenKind = 0;
|
||||
Class *m_staticClassOfFunctionCallExpression = nullptr; // Output
|
||||
};
|
||||
|
||||
VirtualFunctionHelper::VirtualFunctionHelper(TypeOfExpression &typeOfExpression,
|
||||
@@ -99,10 +99,6 @@ VirtualFunctionHelper::VirtualFunctionHelper(TypeOfExpression &typeOfExpression,
|
||||
, m_snapshot(snapshot)
|
||||
, m_typeOfExpression(typeOfExpression)
|
||||
, m_finder(finder)
|
||||
, m_baseExpressionAST(0)
|
||||
, m_function(0)
|
||||
, m_accessTokenKind(0)
|
||||
, m_staticClassOfFunctionCallExpression(0)
|
||||
{
|
||||
if (ExpressionAST *expressionAST = typeOfExpression.expressionAST()) {
|
||||
if (CallAST *callAST = expressionAST->asCall()) {
|
||||
@@ -160,9 +156,9 @@ bool VirtualFunctionHelper::canLookupVirtualFunctionOverrides(Function *function
|
||||
Class *VirtualFunctionHelper::staticClassOfFunctionCallExpression_internal() const
|
||||
{
|
||||
if (!m_finder)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
Class *result = 0;
|
||||
Class *result = nullptr;
|
||||
|
||||
if (m_baseExpressionAST->asIdExpression()) {
|
||||
for (Scope *s = m_scope; s ; s = s->enclosingScope()) {
|
||||
@@ -323,14 +319,14 @@ Link attemptFuncDeclDef(const QTextCursor &cursor, Snapshot snapshot,
|
||||
for (int i = path.size() - 1; i != -1; --i) {
|
||||
AST *node = path.at(i);
|
||||
|
||||
if (node->asParameterDeclaration() != 0)
|
||||
if (node->asParameterDeclaration() != nullptr)
|
||||
return result;
|
||||
}
|
||||
|
||||
AST *declParent = 0;
|
||||
DeclaratorAST *decl = 0;
|
||||
AST *declParent = nullptr;
|
||||
DeclaratorAST *decl = nullptr;
|
||||
for (int i = path.size() - 2; i > 0; --i) {
|
||||
if ((decl = path.at(i)->asDeclarator()) != 0) {
|
||||
if ((decl = path.at(i)->asDeclarator()) != nullptr) {
|
||||
declParent = path.at(i - 1);
|
||||
break;
|
||||
}
|
||||
@@ -343,7 +339,7 @@ Link attemptFuncDeclDef(const QTextCursor &cursor, Snapshot snapshot,
|
||||
if (!funcDecl)
|
||||
return result;
|
||||
|
||||
Symbol *target = 0;
|
||||
Symbol *target = nullptr;
|
||||
if (FunctionDefinitionAST *funDef = declParent->asFunctionDefinition()) {
|
||||
QList<Declaration *> candidates =
|
||||
symbolFinder->findMatchingDeclaration(LookupContext(document, snapshot),
|
||||
@@ -376,10 +372,10 @@ Link attemptFuncDeclDef(const QTextCursor &cursor, Snapshot snapshot,
|
||||
Symbol *findDefinition(Symbol *symbol, const Snapshot &snapshot, SymbolFinder *symbolFinder)
|
||||
{
|
||||
if (symbol->isFunction())
|
||||
return 0; // symbol is a function definition.
|
||||
return nullptr; // symbol is a function definition.
|
||||
|
||||
else if (!symbol->type()->isFunctionType())
|
||||
return 0; // not a function declaration
|
||||
return nullptr; // not a function declaration
|
||||
|
||||
return symbolFinder->findMatchingDefinition(symbol, snapshot);
|
||||
}
|
||||
@@ -724,7 +720,7 @@ void FollowSymbolUnderCursor::findLink(
|
||||
}
|
||||
|
||||
if (Symbol *symbol = result.declaration()) {
|
||||
Symbol *def = 0;
|
||||
Symbol *def = nullptr;
|
||||
|
||||
if (resolveTarget) {
|
||||
// Consider to show a pop-up displaying overrides for the function
|
||||
@@ -759,7 +755,7 @@ void FollowSymbolUnderCursor::findLink(
|
||||
def = findDefinition(symbol, snapshot, symbolFinder);
|
||||
|
||||
if (def == lastVisibleSymbol)
|
||||
def = 0; // jump to declaration then.
|
||||
def = nullptr; // jump to declaration then.
|
||||
|
||||
if (symbol->isForwardClassDeclaration()) {
|
||||
def = symbolFinder->findMatchingClassDeclaration(symbol, snapshot);
|
||||
|
||||
@@ -41,9 +41,7 @@ CppFunctionsFilter::CppFunctionsFilter(CppLocatorData *locatorData)
|
||||
setIncludedByDefault(false);
|
||||
}
|
||||
|
||||
CppFunctionsFilter::~CppFunctionsFilter()
|
||||
{
|
||||
}
|
||||
CppFunctionsFilter::~CppFunctionsFilter() = default;
|
||||
|
||||
Core::LocatorFilterEntry CppFunctionsFilter::filterEntryFromIndexItem(IndexItem::Ptr info)
|
||||
{
|
||||
|
||||
@@ -37,8 +37,8 @@ class CppFunctionsFilter : public CppLocatorFilter
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CppFunctionsFilter(CppLocatorData *locatorData);
|
||||
~CppFunctionsFilter();
|
||||
explicit CppFunctionsFilter(CppLocatorData *locatorData);
|
||||
~CppFunctionsFilter() override;
|
||||
|
||||
protected:
|
||||
IndexItem::ItemType matchTypes() const override { return IndexItem::Function; }
|
||||
|
||||
@@ -48,11 +48,11 @@ class CppIncludesIterator : public BaseFileFilter::Iterator
|
||||
public:
|
||||
CppIncludesIterator(CPlusPlus::Snapshot snapshot, const QSet<QString> &seedPaths);
|
||||
|
||||
void toFront();
|
||||
bool hasNext() const;
|
||||
QString next();
|
||||
QString filePath() const;
|
||||
QString fileName() const;
|
||||
void toFront() override;
|
||||
bool hasNext() const override;
|
||||
QString next() override;
|
||||
QString filePath() const override;
|
||||
QString fileName() const override;
|
||||
|
||||
private:
|
||||
void fetchMore();
|
||||
@@ -184,5 +184,5 @@ void CppIncludesFilter::refresh(QFutureInterface<void> &future)
|
||||
void CppIncludesFilter::markOutdated()
|
||||
{
|
||||
m_needsUpdate = true;
|
||||
setFileIterator(0); // clean up
|
||||
setFileIterator(nullptr); // clean up
|
||||
}
|
||||
|
||||
@@ -27,16 +27,13 @@
|
||||
|
||||
namespace CppTools {
|
||||
|
||||
CppIndexingSupport::~CppIndexingSupport()
|
||||
{
|
||||
}
|
||||
CppIndexingSupport::~CppIndexingSupport() = default;
|
||||
|
||||
SymbolSearcher::SymbolSearcher(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
SymbolSearcher::~SymbolSearcher()
|
||||
{}
|
||||
SymbolSearcher::~SymbolSearcher() = default;
|
||||
|
||||
} // namespace CppTools
|
||||
|
||||
@@ -81,8 +81,8 @@ public:
|
||||
virtual QFuture<void> refreshSourceFiles(const QFutureInterface<void> &superFuture,
|
||||
const QSet<QString> &sourceFiles,
|
||||
CppModelManager::ProgressNotificationMode mode) = 0;
|
||||
virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters,
|
||||
QSet<QString> fileNames) = 0;
|
||||
virtual SymbolSearcher *createSymbolSearcher(const SymbolSearcher::Parameters ¶meters,
|
||||
const QSet<QString> &fileNames) = 0;
|
||||
};
|
||||
|
||||
} // namespace CppTools
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace CppTools {
|
||||
class CPPTOOLS_EXPORT KitInfo
|
||||
{
|
||||
public:
|
||||
KitInfo(ProjectExplorer::Project *project);
|
||||
explicit KitInfo(ProjectExplorer::Project *project);
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace {
|
||||
class FindLocalSymbols: protected ASTVisitor
|
||||
{
|
||||
public:
|
||||
FindLocalSymbols(Document::Ptr doc)
|
||||
explicit FindLocalSymbols(Document::Ptr doc)
|
||||
: ASTVisitor(doc->translationUnit())
|
||||
{ }
|
||||
|
||||
@@ -65,7 +65,7 @@ protected:
|
||||
using ASTVisitor::visit;
|
||||
using ASTVisitor::endVisit;
|
||||
|
||||
typedef TextEditor::HighlightingResult HighlightingResult;
|
||||
using HighlightingResult = TextEditor::HighlightingResult;
|
||||
|
||||
void enterScope(Scope *scope)
|
||||
{
|
||||
|
||||
@@ -38,9 +38,8 @@ namespace {
|
||||
class FindFirstFunctionDefinition: protected CPlusPlus::ASTVisitor
|
||||
{
|
||||
public:
|
||||
FindFirstFunctionDefinition(CPlusPlus::TranslationUnit *translationUnit)
|
||||
explicit FindFirstFunctionDefinition(CPlusPlus::TranslationUnit *translationUnit)
|
||||
: ASTVisitor(translationUnit)
|
||||
, m_definition(0)
|
||||
{}
|
||||
|
||||
CPlusPlus::FunctionDefinitionAST *operator()()
|
||||
@@ -50,7 +49,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
bool preVisit(CPlusPlus::AST *ast)
|
||||
bool preVisit(CPlusPlus::AST *ast) override
|
||||
{
|
||||
if (CPlusPlus::FunctionDefinitionAST *f = ast->asFunctionDefinition()) {
|
||||
m_definition = f;
|
||||
@@ -60,20 +59,20 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
CPlusPlus::FunctionDefinitionAST *m_definition;
|
||||
CPlusPlus::FunctionDefinitionAST *m_definition = nullptr;
|
||||
};
|
||||
|
||||
struct Result
|
||||
{
|
||||
Result() : line(0), column(0), length(0) {}
|
||||
Result() = default;
|
||||
Result(const QByteArray &name, unsigned line, unsigned column, unsigned length)
|
||||
: name(name), line(line), column(column), length(length)
|
||||
{}
|
||||
|
||||
QByteArray name;
|
||||
unsigned line;
|
||||
unsigned column;
|
||||
unsigned length;
|
||||
unsigned line = 0;
|
||||
unsigned column = 0;
|
||||
unsigned length = 0;
|
||||
|
||||
bool operator==(const Result &other) const
|
||||
{
|
||||
@@ -139,7 +138,7 @@ void CppToolsPlugin::test_cpplocalsymbols_data()
|
||||
QTest::addColumn<QByteArray>("source");
|
||||
QTest::addColumn<QList<Result>>("expectedUses");
|
||||
|
||||
typedef QByteArray _;
|
||||
using _ = QByteArray;
|
||||
|
||||
QTest::newRow("basic")
|
||||
<< _("int f(int arg)\n"
|
||||
|
||||
@@ -46,9 +46,7 @@ CppLocatorFilter::CppLocatorFilter(CppLocatorData *locatorData)
|
||||
setIncludedByDefault(false);
|
||||
}
|
||||
|
||||
CppLocatorFilter::~CppLocatorFilter()
|
||||
{
|
||||
}
|
||||
CppLocatorFilter::~CppLocatorFilter() = default;
|
||||
|
||||
Core::LocatorFilterEntry CppLocatorFilter::filterEntryFromIndexItem(IndexItem::Ptr info)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ class CppLocatorFilter : public Core::ILocatorFilter
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CppLocatorFilter(CppLocatorData *locatorData);
|
||||
explicit CppLocatorFilter(CppLocatorData *locatorData);
|
||||
~CppLocatorFilter() override;
|
||||
|
||||
QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future,
|
||||
|
||||
@@ -82,8 +82,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
void doBeforeLocatorRun() { QVERIFY(parseFiles(m_fileName)); }
|
||||
void doAfterLocatorRun() { QVERIFY(garbageCollectGlobalSnapshot()); }
|
||||
void doBeforeLocatorRun() override { QVERIFY(parseFiles(m_fileName)); }
|
||||
void doAfterLocatorRun() override { QVERIFY(garbageCollectGlobalSnapshot()); }
|
||||
|
||||
private:
|
||||
const QString m_fileName;
|
||||
@@ -97,7 +97,6 @@ public:
|
||||
CppCurrentDocumentFilterTestCase(const QString &fileName,
|
||||
const ResultDataList &expectedResults)
|
||||
: BasicLocatorFilterTest(CppTools::CppModelManager::instance()->currentDocumentFilter())
|
||||
, m_editor(0)
|
||||
, m_fileName(fileName)
|
||||
{
|
||||
QVERIFY(succeededSoFar());
|
||||
@@ -113,7 +112,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
void doBeforeLocatorRun()
|
||||
void doBeforeLocatorRun() override
|
||||
{
|
||||
QVERIFY(DocumentModel::openedDocuments().isEmpty());
|
||||
QVERIFY(garbageCollectGlobalSnapshot());
|
||||
@@ -124,7 +123,7 @@ private:
|
||||
QVERIFY(waitForFileInGlobalSnapshot(m_fileName));
|
||||
}
|
||||
|
||||
void doAfterLocatorRun()
|
||||
void doAfterLocatorRun() override
|
||||
{
|
||||
QVERIFY(closeEditorWithoutGarbageCollectorInvocation(m_editor));
|
||||
QCoreApplication::processEvents();
|
||||
@@ -133,7 +132,7 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
IEditor *m_editor;
|
||||
IEditor *m_editor = nullptr;
|
||||
const QString m_fileName;
|
||||
};
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ class DumpAST: protected ASTVisitor
|
||||
public:
|
||||
int depth;
|
||||
|
||||
DumpAST(Control *control)
|
||||
explicit DumpAST(Control *control)
|
||||
: ASTVisitor(control), depth(0)
|
||||
{ }
|
||||
|
||||
@@ -511,7 +511,7 @@ CppModelManager::CppModelManager()
|
||||
: CppModelManagerBase(nullptr)
|
||||
, d(new CppModelManagerPrivate)
|
||||
{
|
||||
d->m_indexingSupporter = 0;
|
||||
d->m_indexingSupporter = nullptr;
|
||||
d->m_enableGC = true;
|
||||
|
||||
qRegisterMetaType<QSet<QString> >();
|
||||
@@ -696,7 +696,7 @@ void CppModelManager::removeExtraEditorSupport(AbstractEditorSupport *editorSupp
|
||||
CppEditorDocumentHandle *CppModelManager::cppEditorDocument(const QString &filePath) const
|
||||
{
|
||||
if (filePath.isEmpty())
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
QMutexLocker locker(&d->m_cppEditorDocumentsMutex);
|
||||
return d->m_cppEditorDocuments.value(filePath, 0);
|
||||
@@ -987,7 +987,7 @@ void CppModelManager::watchForCanceledProjectIndexer(const QVector<QFuture<void>
|
||||
if (future.isCanceled() || future.isFinished())
|
||||
continue;
|
||||
|
||||
QFutureWatcher<void> *watcher = new QFutureWatcher<void>();
|
||||
auto watcher = new QFutureWatcher<void>();
|
||||
connect(watcher, &QFutureWatcher<void>::canceled, this, [this, project, watcher]() {
|
||||
if (d->m_projectToIndexerCanceled.contains(project)) // Project not yet removed
|
||||
d->m_projectToIndexerCanceled.insert(project, true);
|
||||
@@ -1411,7 +1411,7 @@ void CppModelManager::setIndexingSupport(CppIndexingSupport *indexingSupport)
|
||||
{
|
||||
if (indexingSupport) {
|
||||
if (dynamic_cast<BuiltinIndexingSupport *>(indexingSupport))
|
||||
d->m_indexingSupporter = 0;
|
||||
d->m_indexingSupporter = nullptr;
|
||||
else
|
||||
d->m_indexingSupporter = indexingSupport;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class CPPTOOLS_EXPORT CppModelManager final : public CPlusPlus::CppModelManagerB
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef CPlusPlus::Document Document;
|
||||
using Document = CPlusPlus::Document;
|
||||
|
||||
public:
|
||||
CppModelManager();
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
Document::Ptr document(const QString &fileName) const;
|
||||
bool replaceDocument(Document::Ptr newDoc);
|
||||
|
||||
void emitDocumentUpdated(CPlusPlus::Document::Ptr doc);
|
||||
void emitDocumentUpdated(Document::Ptr doc);
|
||||
void emitAbstractEditorSupportContentsUpdated(const QString &filePath,
|
||||
const QByteArray &contents);
|
||||
void emitAbstractEditorSupportRemoved(const QString &filePath);
|
||||
@@ -165,7 +165,7 @@ public:
|
||||
void globalFollowSymbol(const CursorInEditor &data,
|
||||
Utils::ProcessLinkCallback &&processLinkCallback,
|
||||
const CPlusPlus::Snapshot &snapshot,
|
||||
const CPlusPlus::Document::Ptr &documentFromSemanticInfo,
|
||||
const Document::Ptr &documentFromSemanticInfo,
|
||||
SymbolFinder *symbolFinder,
|
||||
bool inNextSplit) const final;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ using namespace CppTools::Internal;
|
||||
using namespace CppTools::Tests;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
typedef CPlusPlus::Document Document;
|
||||
using CPlusPlus::Document;
|
||||
|
||||
Q_DECLARE_METATYPE(ProjectFile)
|
||||
|
||||
@@ -66,7 +66,7 @@ inline QString _(const QByteArray &ba) { return QString::fromLatin1(ba, ba.size(
|
||||
class MyTestDataDir : public Core::Tests::TestDataDir
|
||||
{
|
||||
public:
|
||||
MyTestDataDir(const QString &dir)
|
||||
explicit MyTestDataDir(const QString &dir)
|
||||
: TestDataDir(_(SRCDIR "/../../../tests/cppmodelmanager/") + dir)
|
||||
{}
|
||||
|
||||
@@ -93,7 +93,7 @@ QStringList toAbsolutePaths(const QStringList &relativePathList,
|
||||
class ProjectCreator
|
||||
{
|
||||
public:
|
||||
ProjectCreator(ModelManagerTestHelper *modelManagerTestHelper)
|
||||
explicit ProjectCreator(ModelManagerTestHelper *modelManagerTestHelper)
|
||||
: modelManagerTestHelper(modelManagerTestHelper)
|
||||
{}
|
||||
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
class FileChangerAndRestorer
|
||||
{
|
||||
public:
|
||||
FileChangerAndRestorer(const QString &filePath)
|
||||
explicit FileChangerAndRestorer(const QString &filePath)
|
||||
: m_filePath(filePath)
|
||||
{
|
||||
}
|
||||
@@ -328,7 +328,7 @@ void CppToolsPlugin::test_modelmanager_refresh_several_times()
|
||||
|
||||
CPlusPlus::Snapshot snapshot;
|
||||
QSet<QString> refreshedFiles;
|
||||
CPlusPlus::Document::Ptr document;
|
||||
Document::Ptr document;
|
||||
|
||||
ProjectExplorer::Macros macros = {{"FIRST_DEFINE"}};
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
@@ -714,7 +714,7 @@ void CppToolsPlugin::test_modelmanager_dont_gc_opened_files()
|
||||
namespace {
|
||||
struct EditorCloser {
|
||||
Core::IEditor *editor;
|
||||
EditorCloser(Core::IEditor *editor): editor(editor) {}
|
||||
explicit EditorCloser(Core::IEditor *editor): editor(editor) {}
|
||||
~EditorCloser()
|
||||
{
|
||||
using namespace CppTools;
|
||||
@@ -785,10 +785,10 @@ void CppToolsPlugin::test_modelmanager_defines_per_project()
|
||||
{_("one"), main1File},
|
||||
{_("two"), main2File}
|
||||
};
|
||||
const int size = sizeof(d) / sizeof(d[0]);
|
||||
for (int i = 0; i < size; ++i) {
|
||||
const QString firstDeclarationName = d[i].firstDeclarationName;
|
||||
const QString fileName = d[i].fileName;
|
||||
|
||||
for (auto &i : d) {
|
||||
const QString firstDeclarationName = i.firstDeclarationName;
|
||||
const QString fileName = i.fileName;
|
||||
|
||||
Core::IEditor *editor = Core::EditorManager::openEditor(fileName);
|
||||
EditorCloser closer(editor);
|
||||
@@ -852,11 +852,10 @@ void CppToolsPlugin::test_modelmanager_precompiled_headers()
|
||||
{_("one"), _("ClassInPch1"), main1File},
|
||||
{_("two"), _("ClassInPch2"), main2File}
|
||||
};
|
||||
const int size = sizeof(d) / sizeof(d[0]);
|
||||
for (int i = 0; i < size; ++i) {
|
||||
const QString firstDeclarationName = d[i].firstDeclarationName;
|
||||
const QByteArray firstClassInPchFile = d[i].firstClassInPchFile.toUtf8();
|
||||
const QString fileName = d[i].fileName;
|
||||
for (auto &i : d) {
|
||||
const QString firstDeclarationName = i.firstDeclarationName;
|
||||
const QByteArray firstClassInPchFile = i.firstClassInPchFile.toUtf8();
|
||||
const QString fileName = i.fileName;
|
||||
|
||||
Core::IEditor *editor = Core::EditorManager::openEditor(fileName);
|
||||
EditorCloser closer(editor);
|
||||
@@ -929,10 +928,9 @@ void CppToolsPlugin::test_modelmanager_defines_per_editor()
|
||||
{_("#define SUB1\n"), _("one")},
|
||||
{_("#define SUB2\n"), _("two")}
|
||||
};
|
||||
const int size = sizeof(d) / sizeof(d[0]);
|
||||
for (int i = 0; i < size; ++i) {
|
||||
const QString editorDefines = d[i].editorDefines;
|
||||
const QString firstDeclarationName = d[i].firstDeclarationName;
|
||||
for (auto &i : d) {
|
||||
const QString editorDefines = i.editorDefines;
|
||||
const QString firstDeclarationName = i.firstDeclarationName;
|
||||
|
||||
Core::IEditor *editor = Core::EditorManager::openEditor(main1File);
|
||||
EditorCloser closer(editor);
|
||||
|
||||
@@ -35,6 +35,6 @@ public:
|
||||
virtual ProjectPart::Ptr projectPartForId(const QString &projectPartId) const = 0;
|
||||
|
||||
protected:
|
||||
~CppModelManagerInterface() = default;
|
||||
virtual ~CppModelManagerInterface() = default;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -27,6 +27,4 @@
|
||||
|
||||
using namespace CppTools;
|
||||
|
||||
ModelManagerSupport::~ModelManagerSupport()
|
||||
{
|
||||
}
|
||||
ModelManagerSupport::~ModelManagerSupport() = default;
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
class CPPTOOLS_EXPORT ModelManagerSupportProvider
|
||||
{
|
||||
public:
|
||||
virtual ~ModelManagerSupportProvider() {}
|
||||
virtual ~ModelManagerSupportProvider() = default;
|
||||
|
||||
virtual QString id() const = 0;
|
||||
virtual QString displayName() const = 0;
|
||||
|
||||
@@ -50,7 +50,7 @@ QVariant SymbolItem::data(int /*column*/, int role) const
|
||||
}
|
||||
}
|
||||
|
||||
OverviewModel *overviewModel = qobject_cast<OverviewModel *>(model());
|
||||
auto overviewModel = qobject_cast<const OverviewModel*>(model());
|
||||
if (!symbol || !overviewModel)
|
||||
return QVariant();
|
||||
|
||||
@@ -150,7 +150,7 @@ Symbol *OverviewModel::symbolFromIndex(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return nullptr;
|
||||
SymbolItem *item = static_cast<SymbolItem *>(itemForIndex(index));
|
||||
auto item = static_cast<const SymbolItem*>(itemForIndex(index));
|
||||
return item ? item->symbol : nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class SymbolItem : public Utils::TreeItem
|
||||
{
|
||||
public:
|
||||
SymbolItem() = default;
|
||||
SymbolItem(CPlusPlus::Symbol *symbol) : symbol(symbol) {}
|
||||
explicit SymbolItem(CPlusPlus::Symbol *symbol) : symbol(symbol) {}
|
||||
|
||||
QVariant data(int column, int role) const override;
|
||||
|
||||
|
||||
@@ -100,10 +100,10 @@ protected:
|
||||
private:
|
||||
class TokenRange {
|
||||
public:
|
||||
TokenRange() : start(0), end(0) {}
|
||||
TokenRange() = default;
|
||||
TokenRange(unsigned start, unsigned end) : start(start), end(end) {}
|
||||
unsigned start;
|
||||
unsigned end;
|
||||
unsigned start = 0;
|
||||
unsigned end = 0;
|
||||
};
|
||||
|
||||
void processIfWhileForStatement(ExpressionAST *expression, Symbol *symbol);
|
||||
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
|
||||
// Preprocess source
|
||||
Environment env;
|
||||
Preprocessor preprocess(0, &env);
|
||||
Preprocessor preprocess(nullptr, &env);
|
||||
const QByteArray preprocessedSource = preprocess.run(filePath, sourceWithoutCursorMarker);
|
||||
|
||||
Document::Ptr document = Document::create(filePath);
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
Overview overview;
|
||||
overview.showReturnTypes = true;
|
||||
overview.showArgumentNames = true;
|
||||
overview.starBindFlags = Overview::StarBindFlags(0);
|
||||
overview.starBindFlags = Overview::StarBindFlags(nullptr);
|
||||
|
||||
// Run the formatter
|
||||
PointerDeclarationFormatter formatter(cppRefactoringFile, overview, cursorHandling);
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace CppTools {
|
||||
|
||||
ProjectFileCategorizer::ProjectFileCategorizer(const QString &projectPartName,
|
||||
const QStringList &filePaths,
|
||||
FileClassifier fileClassifier)
|
||||
const FileClassifier &fileClassifier)
|
||||
: m_partName(projectPartName)
|
||||
{
|
||||
const ProjectFiles ambiguousHeaders = classifyFiles(filePaths, fileClassifier);
|
||||
@@ -53,7 +53,7 @@ QString ProjectFileCategorizer::partName(const QString &languageName) const
|
||||
}
|
||||
|
||||
ProjectFiles ProjectFileCategorizer::classifyFiles(const QStringList &filePaths,
|
||||
FileClassifier fileClassifier)
|
||||
const FileClassifier &fileClassifier)
|
||||
{
|
||||
ProjectFiles ambiguousHeaders;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
public:
|
||||
ProjectFileCategorizer(const QString &projectPartName,
|
||||
const QStringList &filePaths,
|
||||
FileClassifier fileClassifier = FileClassifier());
|
||||
const FileClassifier &fileClassifier = FileClassifier());
|
||||
|
||||
bool hasCSources() const { return !m_cSources.isEmpty(); }
|
||||
bool hasCxxSources() const { return !m_cxxSources.isEmpty(); }
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
QString partName(const QString &languageName) const;
|
||||
|
||||
private:
|
||||
ProjectFiles classifyFiles(const QStringList &filePaths, FileClassifier fileClassifier);
|
||||
ProjectFiles classifyFiles(const QStringList &filePaths, const FileClassifier &fileClassifier);
|
||||
void expandSourcesWithAmbiguousHeaders(const ProjectFiles &ambiguousHeaders);
|
||||
|
||||
private:
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
QList<PrioritizedProjectPart> prioritize(const QList<ProjectPart::Ptr> &projectParts)
|
||||
QList<PrioritizedProjectPart> prioritize(const QList<ProjectPart::Ptr> &projectParts) const
|
||||
{
|
||||
// Prioritize
|
||||
QList<PrioritizedProjectPart> prioritized = Utils::transform(projectParts,
|
||||
|
||||
@@ -37,15 +37,13 @@
|
||||
using namespace CppTools;
|
||||
|
||||
CppQtStyleIndenter::CppQtStyleIndenter()
|
||||
: m_cppCodeStylePreferences(0)
|
||||
{
|
||||
// Just for safety. setCodeStylePreferences should be called when the editor the
|
||||
// indenter belongs to gets initialized.
|
||||
m_cppCodeStylePreferences = CppToolsSettings::instance()->cppCodeStyle();
|
||||
}
|
||||
|
||||
CppQtStyleIndenter::~CppQtStyleIndenter()
|
||||
{}
|
||||
CppQtStyleIndenter::~CppQtStyleIndenter() = default;
|
||||
|
||||
bool CppQtStyleIndenter::isElectricCharacter(const QChar &ch) const
|
||||
{
|
||||
@@ -157,8 +155,7 @@ void CppQtStyleIndenter::indent(QTextDocument *doc,
|
||||
|
||||
void CppQtStyleIndenter::setCodeStylePreferences(TextEditor::ICodeStylePreferences *preferences)
|
||||
{
|
||||
CppCodeStylePreferences *cppCodeStylePreferences
|
||||
= qobject_cast<CppCodeStylePreferences *>(preferences);
|
||||
auto cppCodeStylePreferences = qobject_cast<CppCodeStylePreferences *>(preferences);
|
||||
if (cppCodeStylePreferences)
|
||||
m_cppCodeStylePreferences = cppCodeStylePreferences;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
const TextEditor::TabSettings &tabSettings) override;
|
||||
private:
|
||||
CppCodeStyleSettings codeStyleSettings() const;
|
||||
CppCodeStylePreferences *m_cppCodeStylePreferences;
|
||||
CppCodeStylePreferences *m_cppCodeStylePreferences = nullptr;
|
||||
};
|
||||
|
||||
} // CppTools
|
||||
|
||||
@@ -48,7 +48,7 @@ void RawProjectPart::setDisplayName(const QString &displayName)
|
||||
this->displayName = displayName;
|
||||
}
|
||||
|
||||
void RawProjectPart::setFiles(const QStringList &files, FileClassifier fileClassifier)
|
||||
void RawProjectPart::setFiles(const QStringList &files, const FileClassifier &fileClassifier)
|
||||
{
|
||||
this->files = files;
|
||||
this->fileClassifier = fileClassifier;
|
||||
|
||||
@@ -52,8 +52,6 @@ public:
|
||||
class CPPTOOLS_EXPORT RawProjectPart
|
||||
{
|
||||
public:
|
||||
RawProjectPart() {}
|
||||
|
||||
void setDisplayName(const QString &displayName);
|
||||
|
||||
void setProjectFileLocation(const QString &projectFile, int line = -1, int column = -1);
|
||||
@@ -62,7 +60,7 @@ public:
|
||||
|
||||
// FileClassifier must be thread-safe.
|
||||
using FileClassifier = std::function<ProjectFile(const QString &filePath)>;
|
||||
void setFiles(const QStringList &files, FileClassifier fileClassifier = FileClassifier());
|
||||
void setFiles(const QStringList &files, const FileClassifier &fileClassifier = FileClassifier());
|
||||
void setHeaderPaths(const ProjectExplorer::HeaderPaths &headerPaths);
|
||||
void setIncludePaths(const QStringList &includePaths);
|
||||
void setPreCompiledHeaders(const QStringList &preCompiledHeaders);
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace CppTools {
|
||||
class CppRefactoringChangesData : public TextEditor::RefactoringChangesData
|
||||
{
|
||||
public:
|
||||
CppRefactoringChangesData(const Snapshot &snapshot)
|
||||
explicit CppRefactoringChangesData(const Snapshot &snapshot)
|
||||
: m_snapshot(snapshot)
|
||||
, m_modelManager(CppModelManager::instance())
|
||||
, m_workingCopy(m_modelManager->workingCopy())
|
||||
@@ -107,7 +107,7 @@ CppRefactoringFilePtr CppRefactoringChanges::file(const QString &fileName) const
|
||||
|
||||
CppRefactoringFileConstPtr CppRefactoringChanges::fileNoEditor(const QString &fileName) const
|
||||
{
|
||||
QTextDocument *document = 0;
|
||||
QTextDocument *document = nullptr;
|
||||
if (data()->m_workingCopy.contains(fileName))
|
||||
document = new QTextDocument(QString::fromUtf8(data()->m_workingCopy.source(fileName)));
|
||||
CppRefactoringFilePtr result(new CppRefactoringFile(document, fileName));
|
||||
|
||||
@@ -36,8 +36,8 @@ namespace CppTools {
|
||||
class CppRefactoringChanges;
|
||||
class CppRefactoringFile;
|
||||
class CppRefactoringChangesData;
|
||||
typedef QSharedPointer<CppRefactoringFile> CppRefactoringFilePtr;
|
||||
typedef QSharedPointer<const CppRefactoringFile> CppRefactoringFileConstPtr;
|
||||
using CppRefactoringFilePtr = QSharedPointer<CppRefactoringFile>;
|
||||
using CppRefactoringFileConstPtr = QSharedPointer<const CppRefactoringFile>;
|
||||
|
||||
class CPPTOOLS_EXPORT CppRefactoringFile: public TextEditor::RefactoringFile
|
||||
{
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
protected:
|
||||
CppRefactoringFile(const QString &fileName, const QSharedPointer<TextEditor::RefactoringChangesData> &data);
|
||||
CppRefactoringFile(QTextDocument *document, const QString &fileName);
|
||||
CppRefactoringFile(TextEditor::TextEditorWidget *editor);
|
||||
explicit CppRefactoringFile(TextEditor::TextEditorWidget *editor);
|
||||
|
||||
CppRefactoringChangesData *data() const;
|
||||
void fileChanged() override;
|
||||
@@ -82,7 +82,7 @@ protected:
|
||||
class CPPTOOLS_EXPORT CppRefactoringChanges: public TextEditor::RefactoringChanges
|
||||
{
|
||||
public:
|
||||
CppRefactoringChanges(const CPlusPlus::Snapshot &snapshot);
|
||||
explicit CppRefactoringChanges(const CPlusPlus::Snapshot &snapshot);
|
||||
|
||||
static CppRefactoringFilePtr file(TextEditor::TextEditorWidget *editor,
|
||||
const CPlusPlus::Document::Ptr &document);
|
||||
|
||||
@@ -51,14 +51,8 @@ using namespace CppTools::Internal;
|
||||
|
||||
CppSelectionChanger::CppSelectionChanger(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_initialChangeSelectionCursor()
|
||||
, m_workingCursor()
|
||||
, m_doc(0)
|
||||
, m_unit(0)
|
||||
, m_direction(ExpandSelection)
|
||||
, m_changeSelectionNodeIndex(kChangeSelectionNodeIndexNotSet)
|
||||
, m_nodeCurrentStep(kChangeSelectionNodeIndexNotSet)
|
||||
, m_inChangeSelection(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -337,7 +331,7 @@ ASTNodePositions CppSelectionChanger::findRelevantASTPositionsFromCursor(
|
||||
}
|
||||
|
||||
ASTNodePositions CppSelectionChanger::findRelevantASTPositionsFromCursorWhenNodeIndexNotSet(
|
||||
const QList<AST *> astPath,
|
||||
const QList<AST *> &astPath,
|
||||
const QTextCursor &cursor)
|
||||
{
|
||||
// Find relevant AST node from cursor, when the user expands for the first time.
|
||||
@@ -345,19 +339,18 @@ ASTNodePositions CppSelectionChanger::findRelevantASTPositionsFromCursorWhenNode
|
||||
}
|
||||
|
||||
ASTNodePositions CppSelectionChanger::findRelevantASTPositionsFromCursorWhenWholeDocumentSelected(
|
||||
const QList<AST *> astPath,
|
||||
const QList<AST *> &astPath,
|
||||
const QTextCursor &cursor)
|
||||
{
|
||||
// Can't expand more, because whole document is selected.
|
||||
if (m_direction == ExpandSelection)
|
||||
return 0;
|
||||
return {};
|
||||
|
||||
// In case of shrink, select the next smaller selection.
|
||||
return findRelevantASTPositionsFromCursor(astPath, cursor);
|
||||
}
|
||||
|
||||
ASTNodePositions CppSelectionChanger::findRelevantASTPositionsFromCursorFromPreviousNodeIndex(
|
||||
const QList<AST *> astPath,
|
||||
ASTNodePositions CppSelectionChanger::findRelevantASTPositionsFromCursorFromPreviousNodeIndex(const QList<AST *> &astPath,
|
||||
const QTextCursor &cursor)
|
||||
{
|
||||
ASTNodePositions nodePositions;
|
||||
@@ -377,13 +370,13 @@ ASTNodePositions CppSelectionChanger::findRelevantASTPositionsFromCursorFromPrev
|
||||
if (newAstIndex < 0 || newAstIndex >= astPath.count()) {
|
||||
if (debug)
|
||||
qDebug() << "Skipping expansion because there is no available next AST node.";
|
||||
return 0;
|
||||
return {};
|
||||
}
|
||||
|
||||
// Switch to next AST and set the first step.
|
||||
nodePositions = findRelevantASTPositionsFromCursor(astPath, cursor, newAstIndex);
|
||||
if (!nodePositions)
|
||||
return 0;
|
||||
return {};
|
||||
|
||||
if (debug)
|
||||
qDebug() << "Moved to next AST node.";
|
||||
@@ -419,7 +412,7 @@ ASTNodePositions CppSelectionChanger::findNextASTStepPositions(const QTextCursor
|
||||
#endif
|
||||
|
||||
if (astPath.size() == 0)
|
||||
return 0;
|
||||
return {};
|
||||
|
||||
ASTNodePositions currentNodePositions;
|
||||
if (m_changeSelectionNodeIndex == kChangeSelectionNodeIndexNotSet) {
|
||||
@@ -439,7 +432,7 @@ ASTNodePositions CppSelectionChanger::findNextASTStepPositions(const QTextCursor
|
||||
<< "current step:" << m_nodeCurrentStep;
|
||||
}
|
||||
|
||||
QTC_ASSERT(m_nodeCurrentStep >= 1, return 0);
|
||||
QTC_ASSERT(m_nodeCurrentStep >= 1, return {});
|
||||
|
||||
return currentNodePositions;
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ namespace CppTools {
|
||||
|
||||
class ASTNodePositions {
|
||||
public:
|
||||
ASTNodePositions() {}
|
||||
ASTNodePositions(CPlusPlus::AST *_ast) : ast(_ast) {}
|
||||
ASTNodePositions() = default;
|
||||
explicit ASTNodePositions(CPlusPlus::AST *_ast) : ast(_ast) {}
|
||||
operator bool() const { return ast; }
|
||||
|
||||
CPlusPlus::AST *ast = nullptr;
|
||||
@@ -97,13 +97,13 @@ private:
|
||||
const QTextCursor &cursor,
|
||||
int startingFromNodeIndex = -1);
|
||||
ASTNodePositions findRelevantASTPositionsFromCursorWhenNodeIndexNotSet(
|
||||
const QList<CPlusPlus::AST *> astPath,
|
||||
const QList<CPlusPlus::AST *> &astPath,
|
||||
const QTextCursor &cursor);
|
||||
ASTNodePositions findRelevantASTPositionsFromCursorWhenWholeDocumentSelected(
|
||||
const QList<CPlusPlus::AST *> astPath,
|
||||
const QList<CPlusPlus::AST *> &astPath,
|
||||
const QTextCursor &cursor);
|
||||
ASTNodePositions findRelevantASTPositionsFromCursorFromPreviousNodeIndex(
|
||||
const QList<CPlusPlus::AST *> astPath,
|
||||
const QList<CPlusPlus::AST *> &astPath,
|
||||
const QTextCursor &cursor);
|
||||
bool shouldSkipASTNodeBasedOnPosition(const ASTNodePositions &positions,
|
||||
const QTextCursor &cursor) const;
|
||||
@@ -115,11 +115,11 @@ private:
|
||||
QTextCursor m_initialChangeSelectionCursor;
|
||||
QTextCursor m_workingCursor;
|
||||
CPlusPlus::Document::Ptr m_doc;
|
||||
CPlusPlus::TranslationUnit *m_unit;
|
||||
Direction m_direction;
|
||||
int m_changeSelectionNodeIndex;
|
||||
int m_nodeCurrentStep;
|
||||
bool m_inChangeSelection;
|
||||
CPlusPlus::TranslationUnit *m_unit = nullptr;
|
||||
Direction m_direction = ExpandSelection;
|
||||
int m_changeSelectionNodeIndex = -1;
|
||||
int m_nodeCurrentStep = -1;
|
||||
bool m_inChangeSelection = false;
|
||||
};
|
||||
|
||||
} // namespace CppTools
|
||||
|
||||
@@ -52,15 +52,15 @@ public:
|
||||
class FuturizedTopLevelDeclarationProcessor: public TopLevelDeclarationProcessor
|
||||
{
|
||||
public:
|
||||
FuturizedTopLevelDeclarationProcessor(QFutureInterface<void> &future): m_future(future) {}
|
||||
bool processDeclaration(DeclarationAST *) { return !isCanceled(); }
|
||||
explicit FuturizedTopLevelDeclarationProcessor(QFutureInterface<void> &future): m_future(future) {}
|
||||
bool processDeclaration(DeclarationAST *) override { return !isCanceled(); }
|
||||
bool isCanceled() { return m_future.isCanceled(); }
|
||||
private:
|
||||
QFutureInterface<void> m_future;
|
||||
};
|
||||
|
||||
public:
|
||||
SemanticInfoUpdaterPrivate(SemanticInfoUpdater *q);
|
||||
explicit SemanticInfoUpdaterPrivate(SemanticInfoUpdater *q);
|
||||
~SemanticInfoUpdaterPrivate();
|
||||
|
||||
SemanticInfo semanticInfo() const;
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
|
||||
bool reuseCurrentSemanticInfo(const SemanticInfo::Source &source, bool emitSignalWhenFinished);
|
||||
|
||||
void update_helper(QFutureInterface<void> &future, const SemanticInfo::Source source);
|
||||
void update_helper(QFutureInterface<void> &future, const SemanticInfo::Source &source);
|
||||
|
||||
public:
|
||||
SemanticInfoUpdater *q;
|
||||
@@ -159,7 +159,7 @@ bool SemanticInfoUpdaterPrivate::reuseCurrentSemanticInfo(const SemanticInfo::So
|
||||
}
|
||||
|
||||
void SemanticInfoUpdaterPrivate::update_helper(QFutureInterface<void> &future,
|
||||
const SemanticInfo::Source source)
|
||||
const SemanticInfo::Source &source)
|
||||
{
|
||||
FuturizedTopLevelDeclarationProcessor processor(future);
|
||||
update(source, true, &processor);
|
||||
@@ -187,10 +187,10 @@ SemanticInfo SemanticInfoUpdater::update(const SemanticInfo::Source &source)
|
||||
return semanticInfo();
|
||||
}
|
||||
|
||||
return d->update(source, emitSignalWhenFinished, 0);
|
||||
return d->update(source, emitSignalWhenFinished, nullptr);
|
||||
}
|
||||
|
||||
void SemanticInfoUpdater::updateDetached(const SemanticInfo::Source source)
|
||||
void SemanticInfoUpdater::updateDetached(const SemanticInfo::Source &source)
|
||||
{
|
||||
qCDebug(log) << "updateDetached() - asynchronous";
|
||||
d->m_future.cancel();
|
||||
|
||||
@@ -45,10 +45,10 @@ public:
|
||||
SemanticInfo semanticInfo() const;
|
||||
|
||||
SemanticInfo update(const SemanticInfo::Source &source);
|
||||
void updateDetached(const SemanticInfo::Source source);
|
||||
void updateDetached(const SemanticInfo::Source &source);
|
||||
|
||||
signals:
|
||||
void updated(CppTools::SemanticInfo semanticInfo);
|
||||
void updated(const CppTools::SemanticInfo &semanticInfo);
|
||||
|
||||
private:
|
||||
QScopedPointer<SemanticInfoUpdaterPrivate> d;
|
||||
|
||||
@@ -56,7 +56,7 @@ using namespace CPlusPlus;
|
||||
using namespace CppTools;
|
||||
using namespace CppTools::Internal;
|
||||
|
||||
typedef Document::DiagnosticMessage Message;
|
||||
using Message = Document::DiagnosticMessage;
|
||||
|
||||
static Q_LOGGING_CATEGORY(log, "qtc.cpptools.sourceprocessor", QtWarningMsg)
|
||||
|
||||
@@ -119,8 +119,7 @@ CppSourceProcessor::CppSourceProcessor(const Snapshot &snapshot, DocumentCallbac
|
||||
m_preprocess.setKeepComments(true);
|
||||
}
|
||||
|
||||
CppSourceProcessor::~CppSourceProcessor()
|
||||
{ }
|
||||
CppSourceProcessor::~CppSourceProcessor() = default;
|
||||
|
||||
void CppSourceProcessor::setCancelChecker(const CppSourceProcessor::CancelChecker &cancelChecker)
|
||||
{
|
||||
@@ -135,9 +134,7 @@ void CppSourceProcessor::setHeaderPaths(const ProjectExplorer::HeaderPaths &head
|
||||
using ProjectExplorer::HeaderPathType;
|
||||
m_headerPaths.clear();
|
||||
|
||||
for (int i = 0, ei = headerPaths.size(); i < ei; ++i) {
|
||||
const ProjectExplorer::HeaderPath &path = headerPaths.at(i);
|
||||
|
||||
for (const auto &path : headerPaths) {
|
||||
if (path.type == HeaderPathType::Framework )
|
||||
addFrameworkPath(path);
|
||||
else
|
||||
|
||||
@@ -51,13 +51,13 @@ class CppSourceProcessor: public CPlusPlus::Client
|
||||
Q_DISABLE_COPY(CppSourceProcessor)
|
||||
|
||||
public:
|
||||
typedef std::function<void (const CPlusPlus::Document::Ptr &)> DocumentCallback;
|
||||
using DocumentCallback = std::function<void (const CPlusPlus::Document::Ptr &)>;
|
||||
|
||||
public:
|
||||
static QString cleanPath(const QString &path);
|
||||
|
||||
CppSourceProcessor(const CPlusPlus::Snapshot &snapshot, DocumentCallback documentFinished);
|
||||
~CppSourceProcessor();
|
||||
~CppSourceProcessor() override;
|
||||
|
||||
using CancelChecker = std::function<bool()>;
|
||||
void setCancelChecker(const CancelChecker &cancelChecker);
|
||||
|
||||
@@ -49,7 +49,7 @@ using namespace CppTools::Tests;
|
||||
using namespace CppTools::Internal;
|
||||
using ProjectExplorer::HeaderPathType;
|
||||
|
||||
typedef Document::Include Include;
|
||||
using Include = Document::Include;
|
||||
|
||||
class SourcePreprocessor
|
||||
{
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
cleanUp();
|
||||
}
|
||||
|
||||
Document::Ptr run(const QString &filePath)
|
||||
Document::Ptr run(const QString &filePath) const
|
||||
{
|
||||
QScopedPointer<CppSourceProcessor> sourceProcessor(
|
||||
CppModelManager::createSourceProcessor());
|
||||
|
||||
@@ -79,7 +79,7 @@ CppToolsBridgeQtCreatorImplementation::baseEditorDocumentProcessor(const QString
|
||||
if (document)
|
||||
return document->processor();
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CppToolsBridgeQtCreatorImplementation::finishedRefreshingSourceFiles(
|
||||
|
||||
@@ -40,7 +40,7 @@ class CppToolsJsExtension : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CppToolsJsExtension(QObject *parent = 0) : QObject(parent) { }
|
||||
explicit CppToolsJsExtension(QObject *parent = nullptr) : QObject(parent) { }
|
||||
|
||||
// Generate header guard:
|
||||
Q_INVOKABLE QString headerGuard(const QString &in) const;
|
||||
|
||||
@@ -213,7 +213,7 @@ QString identifierUnderCursor(QTextCursor *cursor)
|
||||
|
||||
const Macro *findCanonicalMacro(const QTextCursor &cursor, Document::Ptr document)
|
||||
{
|
||||
QTC_ASSERT(document, return 0);
|
||||
QTC_ASSERT(document, return nullptr);
|
||||
|
||||
int line, column;
|
||||
Utils::Text::convertPosition(cursor.document(), cursor.position(), &line, &column);
|
||||
@@ -227,7 +227,7 @@ const Macro *findCanonicalMacro(const QTextCursor &cursor, Document::Ptr documen
|
||||
return &use->macro();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QSharedPointer<CppCodeModelSettings> codeModelSettings()
|
||||
|
||||
@@ -55,18 +55,14 @@ namespace Internal {
|
||||
class CppToolsSettingsPrivate
|
||||
{
|
||||
public:
|
||||
CppToolsSettingsPrivate()
|
||||
: m_globalCodeStyle(0)
|
||||
{}
|
||||
|
||||
CommentsSettings m_commentsSettings;
|
||||
CppCodeStylePreferences *m_globalCodeStyle;
|
||||
CppCodeStylePreferences *m_globalCodeStyle = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CppTools
|
||||
|
||||
CppToolsSettings *CppToolsSettings::m_instance = 0;
|
||||
CppToolsSettings *CppToolsSettings::m_instance = nullptr;
|
||||
|
||||
CppToolsSettings::CppToolsSettings(QObject *parent)
|
||||
: QObject(parent)
|
||||
@@ -86,7 +82,7 @@ CppToolsSettings::CppToolsSettings(QObject *parent)
|
||||
TextEditorSettings::registerCodeStyleFactory(factory);
|
||||
|
||||
// code style pool
|
||||
CodeStylePool *pool = new CodeStylePool(factory, this);
|
||||
auto pool = new CodeStylePool(factory, this);
|
||||
TextEditorSettings::registerCodeStylePool(Constants::CPP_SETTINGS_ID, pool);
|
||||
|
||||
// global code style settings
|
||||
@@ -124,7 +120,7 @@ CppToolsSettings::CppToolsSettings(QObject *parent)
|
||||
|
||||
// built-in settings
|
||||
// Qt style
|
||||
CppCodeStylePreferences *qtCodeStyle = new CppCodeStylePreferences();
|
||||
auto qtCodeStyle = new CppCodeStylePreferences;
|
||||
qtCodeStyle->setId("qt");
|
||||
qtCodeStyle->setDisplayName(tr("Qt"));
|
||||
qtCodeStyle->setReadOnly(true);
|
||||
@@ -137,7 +133,7 @@ CppToolsSettings::CppToolsSettings(QObject *parent)
|
||||
pool->addCodeStyle(qtCodeStyle);
|
||||
|
||||
// GNU style
|
||||
CppCodeStylePreferences *gnuCodeStyle = new CppCodeStylePreferences();
|
||||
auto gnuCodeStyle = new CppCodeStylePreferences;
|
||||
gnuCodeStyle->setId("gnu");
|
||||
gnuCodeStyle->setDisplayName(tr("GNU"));
|
||||
gnuCodeStyle->setReadOnly(true);
|
||||
@@ -227,7 +223,7 @@ CppToolsSettings::~CppToolsSettings()
|
||||
|
||||
delete d;
|
||||
|
||||
m_instance = 0;
|
||||
m_instance = nullptr;
|
||||
}
|
||||
|
||||
CppToolsSettings *CppToolsSettings::instance()
|
||||
|
||||
@@ -120,8 +120,8 @@ bool TestCase::succeededSoFar() const
|
||||
|
||||
bool TestCase::openBaseTextEditor(const QString &fileName, TextEditor::BaseTextEditor **editor)
|
||||
{
|
||||
typedef TextEditor::BaseTextEditor BTEditor;
|
||||
if (BTEditor *e = qobject_cast<BTEditor *>(Core::EditorManager::openEditor(fileName))) {
|
||||
using BTEditor = TextEditor::BaseTextEditor;
|
||||
if (auto e = qobject_cast<BTEditor *>(Core::EditorManager::openEditor(fileName))) {
|
||||
if (editor) {
|
||||
*editor = e;
|
||||
return true;
|
||||
|
||||
@@ -74,7 +74,7 @@ class CPPTOOLS_EXPORT TestCase
|
||||
Q_DISABLE_COPY(TestCase)
|
||||
|
||||
public:
|
||||
TestCase(bool runGarbageCollector = true);
|
||||
explicit TestCase(bool runGarbageCollector = true);
|
||||
~TestCase();
|
||||
|
||||
bool succeededSoFar() const;
|
||||
@@ -145,7 +145,7 @@ protected:
|
||||
class CPPTOOLS_EXPORT TemporaryCopiedDir : public TemporaryDir
|
||||
{
|
||||
public:
|
||||
TemporaryCopiedDir(const QString &sourceDirPath);
|
||||
explicit TemporaryCopiedDir(const QString &sourceDirPath);
|
||||
QString absolutePath(const QByteArray &relativePath) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -70,7 +70,7 @@ protected:
|
||||
bool eventFilter(QObject *o, QEvent *e) override
|
||||
{
|
||||
if (e->type() == QEvent::ShortcutOverride && m_sequence.count() == 1) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(e);
|
||||
auto ke = static_cast<const QKeyEvent*>(e);
|
||||
const QKeySequence seq(ke->key());
|
||||
if (seq == m_sequence) {
|
||||
activateCurrentProposalItem();
|
||||
@@ -124,7 +124,7 @@ public:
|
||||
|
||||
IAssistProposal *immediateProposal(const AssistInterface *) override
|
||||
{
|
||||
QTC_ASSERT(m_params.function, return 0);
|
||||
QTC_ASSERT(m_params.function, return nullptr);
|
||||
|
||||
auto *hintItem = new VirtualFunctionProposalItem(Utils::Link());
|
||||
hintItem->setText(QCoreApplication::translate("VirtualFunctionsAssistProcessor",
|
||||
@@ -141,19 +141,19 @@ public:
|
||||
{
|
||||
delete assistInterface;
|
||||
|
||||
QTC_ASSERT(m_params.function, return 0);
|
||||
QTC_ASSERT(m_params.staticClass, return 0);
|
||||
QTC_ASSERT(!m_params.snapshot.isEmpty(), return 0);
|
||||
QTC_ASSERT(m_params.function, return nullptr);
|
||||
QTC_ASSERT(m_params.staticClass, return nullptr);
|
||||
QTC_ASSERT(!m_params.snapshot.isEmpty(), return nullptr);
|
||||
|
||||
Class *functionsClass = m_finder.findMatchingClassDeclaration(m_params.function,
|
||||
m_params.snapshot);
|
||||
if (!functionsClass)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
const QList<Function *> overrides = FunctionUtils::overrides(
|
||||
m_params.function, functionsClass, m_params.staticClass, m_params.snapshot);
|
||||
if (overrides.isEmpty())
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
QList<AssistProposalItemInterface *> items;
|
||||
foreach (Function *func, overrides)
|
||||
@@ -190,9 +190,7 @@ private:
|
||||
mutable SymbolFinder m_finder;
|
||||
};
|
||||
|
||||
VirtualFunctionAssistProvider::VirtualFunctionAssistProvider()
|
||||
{
|
||||
}
|
||||
VirtualFunctionAssistProvider::VirtualFunctionAssistProvider() = default;
|
||||
|
||||
bool VirtualFunctionAssistProvider::configure(const Parameters ¶meters)
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ class CPPTOOLS_EXPORT VirtualFunctionProposalItem final : public TextEditor::Ass
|
||||
public:
|
||||
VirtualFunctionProposalItem(const Utils::Link &link,
|
||||
bool openInSplit = true);
|
||||
~VirtualFunctionProposalItem() noexcept override {}
|
||||
~VirtualFunctionProposalItem() noexcept override = default;
|
||||
void apply(TextEditor::TextDocumentManipulatorInterface &manipulator,
|
||||
int basePosition) const override;
|
||||
Utils::Link link() const { return m_link; } // Exposed for tests
|
||||
|
||||
@@ -40,8 +40,6 @@
|
||||
|
||||
namespace CppTools {
|
||||
|
||||
WorkingCopy::WorkingCopy()
|
||||
{
|
||||
}
|
||||
WorkingCopy::WorkingCopy() = default;
|
||||
|
||||
} // namespace CppTools
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
{ return _elements.size(); }
|
||||
|
||||
private:
|
||||
typedef QHash<Utils::FileName, QPair<QByteArray, unsigned> > Table;
|
||||
using Table = QHash<Utils::FileName, QPair<QByteArray, unsigned> >;
|
||||
Table _elements;
|
||||
};
|
||||
|
||||
|
||||
@@ -136,8 +136,8 @@ QString DoxygenGenerator::generate(QTextCursor cursor,
|
||||
|
||||
QString DoxygenGenerator::generate(QTextCursor cursor, DeclarationAST *decl)
|
||||
{
|
||||
SpecifierAST *spec = 0;
|
||||
DeclaratorAST *decltr = 0;
|
||||
SpecifierAST *spec = nullptr;
|
||||
DeclaratorAST *decltr = nullptr;
|
||||
if (SimpleDeclarationAST *simpleDecl = decl->asSimpleDeclaration()) {
|
||||
if (simpleDecl->declarator_list
|
||||
&& simpleDecl->declarator_list->value) {
|
||||
|
||||
@@ -34,9 +34,7 @@ namespace CppTools {
|
||||
C++ editor document.
|
||||
*/
|
||||
|
||||
CppEditorDocumentHandle::~CppEditorDocumentHandle()
|
||||
{
|
||||
}
|
||||
CppEditorDocumentHandle::~CppEditorDocumentHandle() = default;
|
||||
|
||||
SendDocumentTracker &CppEditorDocumentHandle::sendTracker()
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ class CPPTOOLS_EXPORT FollowSymbolInterface
|
||||
public:
|
||||
using Link = Utils::Link;
|
||||
|
||||
virtual ~FollowSymbolInterface() {}
|
||||
virtual ~FollowSymbolInterface() = default;
|
||||
virtual void findLink(const CursorInEditor &data,
|
||||
Utils::ProcessLinkCallback &&processLinkCallback,
|
||||
bool resolveTarget,
|
||||
|
||||
@@ -47,7 +47,7 @@ static bool isVirtualFunction_helper(const Function *function,
|
||||
enum { Unknown, False, True } res = Unknown;
|
||||
|
||||
if (firstVirtual)
|
||||
*firstVirtual = 0;
|
||||
*firstVirtual = nullptr;
|
||||
|
||||
if (!function)
|
||||
return false;
|
||||
@@ -170,7 +170,7 @@ enum Virtuality
|
||||
Virtual,
|
||||
PureVirtual
|
||||
};
|
||||
typedef QList<Virtuality> VirtualityList;
|
||||
using VirtualityList = QList<Virtuality>;
|
||||
} // Internal namespace
|
||||
} // CppTools namespace
|
||||
|
||||
@@ -191,7 +191,7 @@ void CppToolsPlugin::test_functionutils_virtualFunctions()
|
||||
QCOMPARE(document->diagnosticMessages().size(), 0);
|
||||
QVERIFY(document->translationUnit()->ast());
|
||||
QList<const Function *> allFunctions;
|
||||
const Function *firstVirtual = 0;
|
||||
const Function *firstVirtual = nullptr;
|
||||
|
||||
// Iterate through Function symbols
|
||||
Snapshot snapshot;
|
||||
@@ -236,7 +236,7 @@ void CppToolsPlugin::test_functionutils_virtualFunctions()
|
||||
|
||||
void CppToolsPlugin::test_functionutils_virtualFunctions_data()
|
||||
{
|
||||
typedef QByteArray _;
|
||||
using _ = QByteArray;
|
||||
QTest::addColumn<QByteArray>("source");
|
||||
QTest::addColumn<VirtualityList>("virtualityList");
|
||||
QTest::addColumn<QList<int> >("firstVirtualList");
|
||||
|
||||
@@ -217,7 +217,7 @@ int LineForNewIncludeDirective::operator()(const QString &newIncludeFileName,
|
||||
if (m_includes.empty())
|
||||
return findInsertLineForVeryFirstInclude(newLinesToPrepend, newLinesToAppend);
|
||||
|
||||
typedef QList<IncludeGroup> IncludeGroups;
|
||||
using IncludeGroups = QList<IncludeGroup>;
|
||||
|
||||
const IncludeGroups groupsNewline = IncludeGroup::detectIncludeGroupsByNewLines(m_includes);
|
||||
const bool includeAtTop
|
||||
@@ -241,8 +241,8 @@ int LineForNewIncludeDirective::operator()(const QString &newIncludeFileName,
|
||||
= IncludeGroup::detectIncludeGroupsByIncludeType(bestMixedGroup.includes());
|
||||
groupsMatchingIncludeType = getGroupsByIncludeType(groupsIncludeType, newIncludeType);
|
||||
// Avoid extra new lines for include groups which are not separated by new lines
|
||||
newLinesToPrepend = 0;
|
||||
newLinesToAppend = 0;
|
||||
newLinesToPrepend = nullptr;
|
||||
newLinesToAppend = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ QT_FORWARD_DECLARE_CLASS(QTextDocument)
|
||||
namespace CppTools {
|
||||
namespace IncludeUtils {
|
||||
|
||||
typedef CPlusPlus::Document::Include Include;
|
||||
typedef CPlusPlus::Client::IncludeType IncludeType;
|
||||
using Include = CPlusPlus::Document::Include;
|
||||
using IncludeType = CPlusPlus::Client::IncludeType;
|
||||
|
||||
class CPPTOOLS_EXPORT IncludeGroup
|
||||
{
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
CPlusPlus::Client::IncludeType includeType);
|
||||
|
||||
public:
|
||||
IncludeGroup(const QList<Include> &includes) : m_includes(includes) {}
|
||||
explicit IncludeGroup(const QList<Include> &includes) : m_includes(includes) {}
|
||||
|
||||
QList<Include> includes() const { return m_includes; }
|
||||
Include first() const { return m_includes.first(); }
|
||||
|
||||
@@ -39,7 +39,7 @@ class CPPTOOLS_EXPORT IndexItem
|
||||
{
|
||||
Q_DISABLE_COPY(IndexItem)
|
||||
|
||||
IndexItem() {}
|
||||
IndexItem() = default;
|
||||
|
||||
public:
|
||||
enum ItemType {
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
typedef QSharedPointer<IndexItem> Ptr;
|
||||
using Ptr = QSharedPointer<IndexItem>;
|
||||
static Ptr create(const QString &symbolName,
|
||||
const QString &symbolType,
|
||||
const QString &symbolScope,
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
Recurse, /// continues traversal with the children
|
||||
};
|
||||
|
||||
typedef std::function<VisitorResult (const IndexItem::Ptr &)> Visitor;
|
||||
using Visitor = std::function<VisitorResult (const IndexItem::Ptr &)>;
|
||||
|
||||
VisitorResult visitAllChildren(Visitor callback) const
|
||||
{
|
||||
|
||||
@@ -58,17 +58,10 @@ static int ordering(InsertionPointLocator::AccessSpec xsSpec)
|
||||
|
||||
struct AccessRange
|
||||
{
|
||||
unsigned start;
|
||||
unsigned end;
|
||||
InsertionPointLocator::AccessSpec xsSpec;
|
||||
unsigned colonToken;
|
||||
|
||||
AccessRange()
|
||||
: start(0)
|
||||
, end(0)
|
||||
, xsSpec(InsertionPointLocator::Invalid)
|
||||
, colonToken(0)
|
||||
{}
|
||||
unsigned start = 0;
|
||||
unsigned end = 0;
|
||||
InsertionPointLocator::AccessSpec xsSpec = InsertionPointLocator::Invalid;
|
||||
unsigned colonToken = 0;
|
||||
|
||||
AccessRange(unsigned start, unsigned end, InsertionPointLocator::AccessSpec xsSpec, unsigned colonToken)
|
||||
: start(start)
|
||||
@@ -107,7 +100,7 @@ public:
|
||||
protected:
|
||||
using ASTVisitor::visit;
|
||||
|
||||
bool visit(ClassSpecifierAST *ast)
|
||||
bool visit(ClassSpecifierAST *ast) override
|
||||
{
|
||||
if (!ast->lbrace_token || !ast->rbrace_token)
|
||||
return true;
|
||||
@@ -358,7 +351,7 @@ class FindMethodDefinitionInsertPoint : protected ASTVisitor
|
||||
HighestValue<int, unsigned> _bestToken;
|
||||
|
||||
public:
|
||||
FindMethodDefinitionInsertPoint(TranslationUnit *translationUnit)
|
||||
explicit FindMethodDefinitionInsertPoint(TranslationUnit *translationUnit)
|
||||
: ASTVisitor(translationUnit)
|
||||
{}
|
||||
|
||||
@@ -388,12 +381,12 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
bool preVisit(AST *ast)
|
||||
bool preVisit(AST *ast) override
|
||||
{
|
||||
return ast->asNamespace() || ast->asTranslationUnit() || ast->asLinkageBody();
|
||||
}
|
||||
|
||||
bool visit(NamespaceAST *ast)
|
||||
bool visit(NamespaceAST *ast) override
|
||||
{
|
||||
if (_currentDepth >= _namespaceNames.size())
|
||||
return false;
|
||||
@@ -423,7 +416,7 @@ class FindFunctionDefinition : protected ASTVisitor
|
||||
unsigned _line = 0;
|
||||
unsigned _column = 0;
|
||||
public:
|
||||
FindFunctionDefinition(TranslationUnit *translationUnit)
|
||||
explicit FindFunctionDefinition(TranslationUnit *translationUnit)
|
||||
: ASTVisitor(translationUnit)
|
||||
{
|
||||
}
|
||||
@@ -438,7 +431,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
bool preVisit(AST *ast)
|
||||
bool preVisit(AST *ast) override
|
||||
{
|
||||
if (_result)
|
||||
return false;
|
||||
@@ -452,7 +445,7 @@ protected:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool visit(FunctionDefinitionAST *ast)
|
||||
bool visit(FunctionDefinitionAST *ast) override
|
||||
{
|
||||
_result = ast;
|
||||
return false;
|
||||
@@ -464,13 +457,13 @@ protected:
|
||||
static Declaration *isNonVirtualFunctionDeclaration(Symbol *s)
|
||||
{
|
||||
if (!s)
|
||||
return 0;
|
||||
return nullptr;
|
||||
Declaration *declaration = s->asDeclaration();
|
||||
if (!declaration)
|
||||
return 0;
|
||||
return nullptr;
|
||||
Function *type = s->type()->asFunctionType();
|
||||
if (!type || type->isPureVirtual())
|
||||
return 0;
|
||||
return nullptr;
|
||||
return declaration;
|
||||
}
|
||||
|
||||
@@ -497,9 +490,9 @@ static InsertionLocation nextToSurroundingDefinitions(Symbol *declaration,
|
||||
|
||||
// scan preceding declarations for a function declaration (and see if it is defined)
|
||||
SymbolFinder symbolFinder;
|
||||
Function *definitionFunction = 0;
|
||||
Function *definitionFunction = nullptr;
|
||||
QString prefix, suffix;
|
||||
Declaration *surroundingFunctionDecl = 0;
|
||||
Declaration *surroundingFunctionDecl = nullptr;
|
||||
for (int i = declIndex - 1; i >= 0; --i) {
|
||||
Symbol *s = klass->memberAt(i);
|
||||
if (s->isGenerated() || !(surroundingFunctionDecl = isNonVirtualFunctionDeclaration(s)))
|
||||
@@ -512,7 +505,7 @@ static InsertionLocation nextToSurroundingDefinitions(Symbol *declaration,
|
||||
prefix = QLatin1String("\n\n");
|
||||
break;
|
||||
}
|
||||
definitionFunction = 0;
|
||||
definitionFunction = nullptr;
|
||||
}
|
||||
}
|
||||
if (!definitionFunction) {
|
||||
@@ -530,7 +523,7 @@ static InsertionLocation nextToSurroundingDefinitions(Symbol *declaration,
|
||||
suffix = QLatin1String("\n\n");
|
||||
break;
|
||||
}
|
||||
definitionFunction = 0;
|
||||
definitionFunction = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
static QString accessSpecToString(InsertionPointLocator::AccessSpec xsSpec);
|
||||
|
||||
public:
|
||||
InsertionPointLocator(const CppRefactoringChanges &refactoringChanges);
|
||||
explicit InsertionPointLocator(const CppRefactoringChanges &refactoringChanges);
|
||||
|
||||
InsertionLocation methodDeclarationInClass(const QString &fileName,
|
||||
const CPlusPlus::Class *clazz,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user