From 7cd4c295c71c7aca2db7ef5a76272f86a51fc2ae Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 30 Jan 2023 09:45:11 +0200 Subject: [PATCH] CppEditor: Initialize member in GetterSetterRefactoringHelper Reported by Coverity. Change-Id: I0b6a1a36a33fe9b1cd81d2b314c80f42054d3d11 Reviewed-by: Christian Kandeler --- src/plugins/cppeditor/cppquickfixes.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index da2bf677f10..3dae225cea3 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -3475,7 +3475,6 @@ public: } bool hasSourceFile() const { return m_headerFile != m_sourceFile; } - bool isHeaderHeaderFile() const { return m_isHeaderHeaderFile; } protected: void insertAndIndent(const RefactoringFilePtr &file, @@ -3671,6 +3670,7 @@ protected: const CppRefactoringChanges m_changes; const InsertionPointLocator m_locator; const CppRefactoringFilePtr m_headerFile; + bool m_isHeaderHeaderFile = false; // the "header" (where the class is defined) can be a source file const CppRefactoringFilePtr m_sourceFile; CppQuickFixSettings *const m_settings = CppQuickFixProjectsSettings::getQuickFixSettings( ProjectExplorer::ProjectTree::currentProject()); @@ -3683,7 +3683,6 @@ private: InsertionLocation m_sourceFileInsertionPoint; QString m_sourceFileCode; QMap m_headerFileCode; - bool m_isHeaderHeaderFile; // the "header" (where the class is defined) can be a source file }; class GenerateGetterSetterOp : public CppQuickFixOperation @@ -9018,7 +9017,7 @@ private: addSourceFileCode(implCode); } else if (constructorLocation == CppQuickFixSettings::FunctionLocation::OutsideClass) { - if (isHeaderHeaderFile()) + if (m_isHeaderHeaderFile) implCode.prepend("inline "); insertAndIndent(m_headerFile, implLoc, implCode); }