summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2017-06-01 13:33:47 +0200
committerNikolai Kosjar <nikolai.kosjar@qt.io>2017-06-01 13:33:27 +0000
commit3e203e12086a7c16c1ad7c814462f68c7a2547b8 (patch)
tree5a05b4fc433f0739dc351eb6ffb55d272694a9d5
parent39dea0979463fa834d99b76c6d286c0cb045f4d3 (diff)
downloadqt-creator-3e203e12086a7c16c1ad7c814462f68c7a2547b8.tar.gz
CppTools: Fix uninitialized values warnings
...from coverity scan. Change-Id: I7f4c3de39279cfffab2246aa84ae2ac13916bd1e Reviewed-by: Robert Loehning <robert.loehning@qt.io>
-rw-r--r--src/plugins/cpptools/cppcodeformatter.cpp12
-rw-r--r--src/plugins/cpptools/cppcodeformatter.h17
-rw-r--r--src/plugins/cpptools/cppcompletionassist.cpp7
-rw-r--r--src/plugins/cpptools/indexitem.h6
-rw-r--r--src/plugins/cpptools/insertionpointlocator.cpp2
5 files changed, 13 insertions, 31 deletions
diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp
index e27832a2ff..68c83f29f9 100644
--- a/src/plugins/cpptools/cppcodeformatter.cpp
+++ b/src/plugins/cpptools/cppcodeformatter.cpp
@@ -40,18 +40,6 @@ using namespace CppTools;
using namespace TextEditor;
using namespace CppTools::Internal;
-CodeFormatter::BlockData::BlockData()
- : m_blockRevision(-1)
-{
-}
-
-CodeFormatter::CodeFormatter()
- : m_indentDepth(0)
- , m_paddingDepth(0)
- , m_tabSize(4)
-{
-}
-
CodeFormatter::~CodeFormatter()
{
}
diff --git a/src/plugins/cpptools/cppcodeformatter.h b/src/plugins/cpptools/cppcodeformatter.h
index e48199d3a3..86accb647a 100644
--- a/src/plugins/cpptools/cppcodeformatter.h
+++ b/src/plugins/cpptools/cppcodeformatter.h
@@ -48,7 +48,6 @@ class CPPTOOLS_EXPORT CodeFormatter
{
Q_GADGET
public:
- CodeFormatter();
virtual ~CodeFormatter();
// updates all states up until block if necessary
@@ -73,13 +72,11 @@ protected:
class BlockData
{
public:
- BlockData();
-
QStack<State> m_beginState;
QStack<State> m_endState;
- int m_indentDepth;
- int m_paddingDepth;
- int m_blockRevision;
+ int m_indentDepth = 0;
+ int m_paddingDepth = 0;
+ int m_blockRevision = -1;
};
virtual void saveBlockData(QTextBlock *block, const BlockData &data) const = 0;
@@ -242,12 +239,12 @@ private:
CPlusPlus::Tokens m_tokens;
QString m_currentLine;
CPlusPlus::Token m_currentToken;
- int m_tokenIndex;
+ int m_tokenIndex = 0;
- int m_indentDepth;
- int m_paddingDepth;
+ int m_indentDepth = 0;
+ int m_paddingDepth = 0;
- int m_tabSize;
+ int m_tabSize = 4;
friend class Internal::CppCodeFormatterData;
};
diff --git a/src/plugins/cpptools/cppcompletionassist.cpp b/src/plugins/cpptools/cppcompletionassist.cpp
index 6a5e70954d..0a31d52b84 100644
--- a/src/plugins/cpptools/cppcompletionassist.cpp
+++ b/src/plugins/cpptools/cppcompletionassist.cpp
@@ -83,9 +83,6 @@ struct CompleteFunctionDeclaration
class CppAssistProposalItem final : public AssistProposalItem
{
public:
- CppAssistProposalItem() :
- m_isOverloaded(false) {}
-
~CppAssistProposalItem() Q_DECL_NOEXCEPT {}
bool prematurelyApplies(const QChar &c) const override;
void applyContextualContent(TextDocumentManipulatorInterface &manipulator, int basePosition) const override;
@@ -101,9 +98,9 @@ public:
private:
QSharedPointer<TypeOfExpression> m_typeOfExpression;
- unsigned m_completionOperator;
+ unsigned m_completionOperator = T_EOF_SYMBOL;
mutable QChar m_typedChar;
- bool m_isOverloaded;
+ bool m_isOverloaded = false;
};
} // Internal
diff --git a/src/plugins/cpptools/indexitem.h b/src/plugins/cpptools/indexitem.h
index edfa9a75fa..4370bca422 100644
--- a/src/plugins/cpptools/indexitem.h
+++ b/src/plugins/cpptools/indexitem.h
@@ -123,9 +123,9 @@ private:
QString m_symbolScope;
QString m_fileName;
QIcon m_icon;
- ItemType m_type;
- int m_line;
- int m_column;
+ ItemType m_type = All;
+ int m_line = 0;
+ int m_column = 0;
QVector<IndexItem::Ptr> m_children;
};
diff --git a/src/plugins/cpptools/insertionpointlocator.cpp b/src/plugins/cpptools/insertionpointlocator.cpp
index 41e074219b..0fe27dbcc1 100644
--- a/src/plugins/cpptools/insertionpointlocator.cpp
+++ b/src/plugins/cpptools/insertionpointlocator.cpp
@@ -354,7 +354,7 @@ public:
class FindMethodDefinitionInsertPoint : protected ASTVisitor
{
QList<const Identifier *> _namespaceNames;
- int _currentDepth;
+ int _currentDepth = 0;
HighestValue<int, unsigned> _bestToken;
public: