CppTools: Fix uninitialized values warnings

...from coverity scan.

Change-Id: I7f4c3de39279cfffab2246aa84ae2ac13916bd1e
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
This commit is contained in:
Nikolai Kosjar
2017-06-01 13:33:47 +02:00
parent 39dea09794
commit 3e203e1208
5 changed files with 13 additions and 31 deletions

View File

@@ -40,18 +40,6 @@ using namespace CppTools;
using namespace TextEditor; using namespace TextEditor;
using namespace CppTools::Internal; using namespace CppTools::Internal;
CodeFormatter::BlockData::BlockData()
: m_blockRevision(-1)
{
}
CodeFormatter::CodeFormatter()
: m_indentDepth(0)
, m_paddingDepth(0)
, m_tabSize(4)
{
}
CodeFormatter::~CodeFormatter() CodeFormatter::~CodeFormatter()
{ {
} }

View File

@@ -48,7 +48,6 @@ class CPPTOOLS_EXPORT CodeFormatter
{ {
Q_GADGET Q_GADGET
public: public:
CodeFormatter();
virtual ~CodeFormatter(); virtual ~CodeFormatter();
// updates all states up until block if necessary // updates all states up until block if necessary
@@ -73,13 +72,11 @@ protected:
class BlockData class BlockData
{ {
public: public:
BlockData();
QStack<State> m_beginState; QStack<State> m_beginState;
QStack<State> m_endState; QStack<State> m_endState;
int m_indentDepth; int m_indentDepth = 0;
int m_paddingDepth; int m_paddingDepth = 0;
int m_blockRevision; int m_blockRevision = -1;
}; };
virtual void saveBlockData(QTextBlock *block, const BlockData &data) const = 0; virtual void saveBlockData(QTextBlock *block, const BlockData &data) const = 0;
@@ -242,12 +239,12 @@ private:
CPlusPlus::Tokens m_tokens; CPlusPlus::Tokens m_tokens;
QString m_currentLine; QString m_currentLine;
CPlusPlus::Token m_currentToken; CPlusPlus::Token m_currentToken;
int m_tokenIndex; int m_tokenIndex = 0;
int m_indentDepth; int m_indentDepth = 0;
int m_paddingDepth; int m_paddingDepth = 0;
int m_tabSize; int m_tabSize = 4;
friend class Internal::CppCodeFormatterData; friend class Internal::CppCodeFormatterData;
}; };

View File

@@ -83,9 +83,6 @@ struct CompleteFunctionDeclaration
class CppAssistProposalItem final : public AssistProposalItem class CppAssistProposalItem final : public AssistProposalItem
{ {
public: public:
CppAssistProposalItem() :
m_isOverloaded(false) {}
~CppAssistProposalItem() Q_DECL_NOEXCEPT {} ~CppAssistProposalItem() Q_DECL_NOEXCEPT {}
bool prematurelyApplies(const QChar &c) const override; bool prematurelyApplies(const QChar &c) const override;
void applyContextualContent(TextDocumentManipulatorInterface &manipulator, int basePosition) const override; void applyContextualContent(TextDocumentManipulatorInterface &manipulator, int basePosition) const override;
@@ -101,9 +98,9 @@ public:
private: private:
QSharedPointer<TypeOfExpression> m_typeOfExpression; QSharedPointer<TypeOfExpression> m_typeOfExpression;
unsigned m_completionOperator; unsigned m_completionOperator = T_EOF_SYMBOL;
mutable QChar m_typedChar; mutable QChar m_typedChar;
bool m_isOverloaded; bool m_isOverloaded = false;
}; };
} // Internal } // Internal

View File

@@ -123,9 +123,9 @@ private:
QString m_symbolScope; QString m_symbolScope;
QString m_fileName; QString m_fileName;
QIcon m_icon; QIcon m_icon;
ItemType m_type; ItemType m_type = All;
int m_line; int m_line = 0;
int m_column; int m_column = 0;
QVector<IndexItem::Ptr> m_children; QVector<IndexItem::Ptr> m_children;
}; };

View File

@@ -354,7 +354,7 @@ public:
class FindMethodDefinitionInsertPoint : protected ASTVisitor class FindMethodDefinitionInsertPoint : protected ASTVisitor
{ {
QList<const Identifier *> _namespaceNames; QList<const Identifier *> _namespaceNames;
int _currentDepth; int _currentDepth = 0;
HighestValue<int, unsigned> _bestToken; HighestValue<int, unsigned> _bestToken;
public: public: