forked from qt-creator/qt-creator
CppEditor: New quick fix "Optimize For Loop"
Rewrites post increment/decrement operators (++ and --) as pre increment/decrement operators and moves non string/numeric literals and non id expressions from loops condition to loops initializer. Change-Id: Id95334b6df6fcaa9af436cc1d2d0982d38bf8fe2 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
committed by
Nikolai Kosjar
parent
7811cad178
commit
02825b5894
@@ -584,6 +584,16 @@ private:
|
||||
InsertVirtualMethodsDialog *m_dialog;
|
||||
};
|
||||
|
||||
/*!
|
||||
Optimizes a for loop to avoid permanent condition check and forces to use preincrement
|
||||
or predecrement operators in the expression of the for loop.
|
||||
*/
|
||||
class OptimizeForLoop : public CppQuickFixFactory
|
||||
{
|
||||
public:
|
||||
void match(const CppQuickFixInterface &interface, TextEditor::QuickFixOperations &result);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CppEditor
|
||||
|
||||
|
||||
Reference in New Issue
Block a user