CLion 2018.2 Help

Analyzing applications

Dependencies analysis

CLion suggests the following means of analyzing dependencies in your projects:

  • Analysis of usages, which helps you locate all references to a certain class, variable, function or parameter. This facility includes search and view usages across the project and highlighting usages in a file.
  • Possibility to view file structure.
  • Possibility to explore hierarchy of the types, functions, and function calls.

Viewing Structure and Hierarchy of the Source Code

Building hierarchies

CLion provides facilities for building the following hierarchies:

  • Type hierarchies that show parent and children classes of a class.
  • Method hierarchies that show classes where a method:
    • Is defined.
    • Is not defined.
    • Should be defined if the class is not abstract.
  • Call hierarchies that show callers (supertypes) or callees (subtypes) of a method.

When built, a hierarchy can be immediately viewed and examined in the Hierarchy tool window. By default, every new built hierarchy overwrites the contents of the current tab. You can retain the current tab and have the next hierarchy built in a new one.

To build a hierarchy of types

  1. Select the desired class in the Project tool window or open it in the editor.
  2. On the main menu, choose Navigate | Type Hierarchy or just press Ctrl+H.

To build a hierarchy of imports

  1. Open the file in the editor or select it in the Project view.
  2. On the main menu, choose Navigate | Imports Hierarchy.

To retain a hierarchy tab

  • In the Hierarchy tool window, click the Pin Tab button pin.png on the toolbar.

Viewing hierarchies

Once built, hierarchies can be brought up for close examination in the Hierarchy tool window.

Showing the Hierarchy tool window

The Hierarchy tool window is not shown when there are no hierarchies to display. You have to build hierarchies first.

To open the Hierarchy tool window, do one of the following:

  • On the main menu, choose View | Tool Windows | Hierarchy.
  • Use Alt+8 keyboard shortcut.

Do one of the following:

  • Right-click the currently displayed tab, and choose Select Next Tab/Select Previous Tab on the context menu.
  • Use the Alt+Right and Alt+Left keyboard shortcuts.
  • Click the currently displayed tab, and choose the next tab to display.

Toggling between views

Toggling between views means showing ascending or descending hierarchy (callee vs. caller methods, parent vs. children classes etc.) To toggle between views, use the toolbar of the Hierarchy tool window:

  • Click hierarchyClassSupertypes to show supertypes.
  • Click hierarchyClassSubtypes to show subtypes.

Viewing structure of a source file

You can examine the structure of the file currently opened in the editor using the Structure tool window or the Structure pop-up window.

By default, CLion shows all the classes, methods, etc. presented in the current file.

To have other members displayed, click the corresponding buttons on the toolbar of the Structure tool window.

You can also have class members shown in the Project tool window.

To view the file structure, do one of the following

Viewing members

To have class fields displayed

  • Click icons nodes field svg on the toolbar of the Structure tool window.

To have inherited members displayed

  • Click show inherited on the toolbar of the Structure tool window.

By default, CLion shows only methods, constants, and fields defined in the current class. If shown, inherited members are displayed gray.

To have class members shown in the Project tool window

  • Turn on the Show members item on the context menu of the Project tool window title bar. If this option is on, the files in the tree that contain classes turn into nodes. When such node is unfolded, the contained classes with their fields, methods, and other members of the selected item are shown.
Last modified: 16 June 2018