CppTools: Simplify/Modernize SemanticInfo

Change-Id: I7bef1dee81678f77f5c0d8a6d22488aa63f981e7
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Nikolai Kosjar
2017-06-15 12:13:44 +02:00
parent 210b9aa227
commit d3d3e2ace5
4 changed files with 9 additions and 48 deletions

View File

@@ -1,33 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "cppsemanticinfo.h"
using namespace CppTools;
SemanticInfo::SemanticInfo()
: revision(0), complete(true), localUsesUpdated(false)
{
}

View File

@@ -42,11 +42,9 @@ public:
{ {
const QString fileName; const QString fileName;
const QByteArray code; const QByteArray code;
const unsigned revision; const unsigned revision = 0;
CPlusPlus::Snapshot snapshot; CPlusPlus::Snapshot snapshot;
const bool force; const bool force = false;
Source() : revision(0), force(false) {}
Source(const QString &fileName, Source(const QString &fileName,
const QByteArray &code, const QByteArray &code,
@@ -62,20 +60,18 @@ public:
}; };
public: public:
typedef TextEditor::HighlightingResult Use; using Use = TextEditor::HighlightingResult;
using LocalUseMap = QHash<CPlusPlus::Symbol *, QList<Use>>;
using LocalUseIterator = QHashIterator<CPlusPlus::Symbol *, QList<Use>>;
typedef QHash<CPlusPlus::Symbol *, QList<Use> > LocalUseMap; // Document specific
typedef QHashIterator<CPlusPlus::Symbol *, QList<Use> > LocalUseIterator; unsigned revision = 0;
bool complete = true;
SemanticInfo();
unsigned revision;
bool complete;
CPlusPlus::Snapshot snapshot; CPlusPlus::Snapshot snapshot;
CPlusPlus::Document::Ptr doc; CPlusPlus::Document::Ptr doc;
// Widget specific (e.g. related to cursor position) // Widget specific (e.g. related to cursor position)
bool localUsesUpdated; bool localUsesUpdated = false;
LocalUseMap localUses; LocalUseMap localUses;
}; };

View File

@@ -135,7 +135,6 @@ SOURCES += \
cpprawprojectpart.cpp \ cpprawprojectpart.cpp \
cpprefactoringchanges.cpp \ cpprefactoringchanges.cpp \
cppselectionchanger.cpp \ cppselectionchanger.cpp \
cppsemanticinfo.cpp \
cppsemanticinfoupdater.cpp \ cppsemanticinfoupdater.cpp \
cppsourceprocessor.cpp \ cppsourceprocessor.cpp \
cpptoolsjsextension.cpp \ cpptoolsjsextension.cpp \

View File

@@ -135,7 +135,6 @@ Project {
"cpprefactoringchanges.h", "cpprefactoringchanges.h",
"cppselectionchanger.cpp", "cppselectionchanger.cpp",
"cppselectionchanger.h", "cppselectionchanger.h",
"cppsemanticinfo.cpp",
"cppsemanticinfo.h", "cppsemanticinfo.h",
"cppsemanticinfoupdater.cpp", "cppsemanticinfoupdater.cpp",
"cppsemanticinfoupdater.h", "cppsemanticinfoupdater.h",