[Qt-creator] Code Analysis for Refactorings in QtCreator
Nikolai Kosjar
nikolai.kosjar at digia.com
Fri Aug 29 10:08:31 CEST 2014
Hi!
On Mon, 25. Aug 15:47, Pascal Kesseli wrote:
> I am also trying to give a short description as to which of these algorithms
> have already made it into commercial products. Is there any group, person or
> piece of documentation that I could consult as to which smell detection and
> refactoring application algorithms are used in QtCreator?
Here is a overview of the provided refactoring actions in Qt Creator:
http://qt-project.org/doc/qtcreator-3.2/creator-editor-refactoring.html
As a user manual it does not provide any information about the
algorithms.
Here are some pointers to the implementations:
For renaming, look into
* CppEditorWidget::renameSymbolUnderCursor
* QmlJSEditorWidget::renameUsages
You can find all implementations of other refactoring operations by
inspecting the sub classes of TextEditor::QuickFixFactory [1]. All C++
refactoring actions are implemnted in
src/plugins/cppeditor/cppquickfixes.{h,cpp}.
> The algorithm categories are the following:
> - (AST) Pattern Matching
Maybe CPlusPlus::ASTMatcher.
> - Abstract Interpretation (e.g. symbolic execution)
CPlusPlus::Bind is an ASTVisitor that generates symbols that are then
accessible as a tree via CPlusPlus::Document::globalNamespace().
> - Metadata (comments, annotations, method/class names)
A CPlusPlus::Document has a TranslationUnit that provides the
comments via
TranslationUnit::commentCount()
TranslationUnit::commentAt()
Annotations are not saved.
For the indexed data (functions, classes), see CppTools::IndexItem.
> - Slicing (Forward/Backward)
> - Software Metrics
> - (Meta-)heuristics
> - Contracts/Invariants
> - Clustering
> - Model Checking (state space exploration)
Can't say anything to these. Maybe provide some concrete examples.
Nikolai
[1] If you open the Qt Creator project in Qt Creator itself, hit
Ctrl+Shift+T (Open Type Hierarchy) on "TextEditor::QuickFixFactory" in
e.g. /src/plugins/cppeditor/cppquickfix.h to get all sub classes
displayed in the sidebar.
More information about the Qt-creator
mailing list