forked from qt-creator/qt-creator
CppEditor: Initialize member in GetterSetterRefactoringHelper
Reported by Coverity. Change-Id: I0b6a1a36a33fe9b1cd81d2b314c80f42054d3d11 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
2afe3a6ff2
commit
7cd4c295c7
@@ -3475,7 +3475,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool hasSourceFile() const { return m_headerFile != m_sourceFile; }
|
bool hasSourceFile() const { return m_headerFile != m_sourceFile; }
|
||||||
bool isHeaderHeaderFile() const { return m_isHeaderHeaderFile; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void insertAndIndent(const RefactoringFilePtr &file,
|
void insertAndIndent(const RefactoringFilePtr &file,
|
||||||
@@ -3671,6 +3670,7 @@ protected:
|
|||||||
const CppRefactoringChanges m_changes;
|
const CppRefactoringChanges m_changes;
|
||||||
const InsertionPointLocator m_locator;
|
const InsertionPointLocator m_locator;
|
||||||
const CppRefactoringFilePtr m_headerFile;
|
const CppRefactoringFilePtr m_headerFile;
|
||||||
|
bool m_isHeaderHeaderFile = false; // the "header" (where the class is defined) can be a source file
|
||||||
const CppRefactoringFilePtr m_sourceFile;
|
const CppRefactoringFilePtr m_sourceFile;
|
||||||
CppQuickFixSettings *const m_settings = CppQuickFixProjectsSettings::getQuickFixSettings(
|
CppQuickFixSettings *const m_settings = CppQuickFixProjectsSettings::getQuickFixSettings(
|
||||||
ProjectExplorer::ProjectTree::currentProject());
|
ProjectExplorer::ProjectTree::currentProject());
|
||||||
@@ -3683,7 +3683,6 @@ private:
|
|||||||
InsertionLocation m_sourceFileInsertionPoint;
|
InsertionLocation m_sourceFileInsertionPoint;
|
||||||
QString m_sourceFileCode;
|
QString m_sourceFileCode;
|
||||||
QMap<InsertionPointLocator::AccessSpec, QString> m_headerFileCode;
|
QMap<InsertionPointLocator::AccessSpec, QString> m_headerFileCode;
|
||||||
bool m_isHeaderHeaderFile; // the "header" (where the class is defined) can be a source file
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class GenerateGetterSetterOp : public CppQuickFixOperation
|
class GenerateGetterSetterOp : public CppQuickFixOperation
|
||||||
@@ -9018,7 +9017,7 @@ private:
|
|||||||
addSourceFileCode(implCode);
|
addSourceFileCode(implCode);
|
||||||
} else if (constructorLocation
|
} else if (constructorLocation
|
||||||
== CppQuickFixSettings::FunctionLocation::OutsideClass) {
|
== CppQuickFixSettings::FunctionLocation::OutsideClass) {
|
||||||
if (isHeaderHeaderFile())
|
if (m_isHeaderHeaderFile)
|
||||||
implCode.prepend("inline ");
|
implCode.prepend("inline ");
|
||||||
insertAndIndent(m_headerFile, implLoc, implCode);
|
insertAndIndent(m_headerFile, implLoc, implCode);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user