Find Definitions and References (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Code Editor Context Menu

Overview

Our Clang-enhanced C++ Compilers (BCC64, BCCIOSARM, BCCIOSARM64, and BCCAARM) now support a C++ indexing feature that provides the Find Definitions and Find References commands in the Code Editor. After you enable indexing in RAD Studio, the Find menu of commands becomes available on the context menu when you right-click a C++ identifier in the Code Editor. Depending on the identifier type, the Find Definitions and Find References commands return various information that help you increase the productivity of your work.

For example, you can get information such as the following:

  • The identifier declaration.
  • The base or derived classes (when the identifier refers to a class).
  • A tree view of all references to the selected identifier in the entire project.

For details, see the individual command descriptions in Find Menu Commands.

Note: You cannot use this feature on the 32-bit Windows and macOS target platforms.

Enabling Find Definitions and Find References

To enable the Find Definitions and Find References feature, you should first index the files of your C++ project to create an index file. During the indexing process, RAD Studio creates a SQLite index file that stores all necessary information. The file name is <project GUID>.db.

To Create an Index File for the Current Project

  1. Choose Project > Options > Project Properties.
  2. Under C++ Project Properties, select Index files for 'Definitions and References', and then click OK.

Project Options.png

To Index All Newly Created Projects

  1. Choose Tools > Options > Environment Options > C++ Options > Project Properties.
  2. Under Default C++ Project Properties (applies to new projects only), select Index files for 'Definitions and References', and then click OK.

Tools Options.png

Note: You can use Find Definitions and Find References only in the active project. To activate a project, right-click it in the Projects Window, and then select Activate on the context menu.

About the Indexing Process

When RAD Studio builds an index file, the IDE displays the progress on the Indexer tab of the Messages pane:

Indexer Tab.png

When indexing C++ project files, consider the following key aspects:

  • RAD Studio builds the project index on a file-by-file basis.
  • You can index only the active project. To activate a project, right-click the project file (.cbproj file) in the Projects Window, and then select Activate on the context menu.
  • If the operation succeeds, the Indexer tab displays the *** Full Index Ready *** message.
    • Otherwise, the tab displays the list of files that cannot be indexed. In this case, ensure that those files are correct and compilable.
  • RAD Studio automatically recreates the index file in the following cases:
    • When you change any of the project files, and then save your changes.
    • When you change the project options.

Find Menu Commands

In the Code Editor, the Find menu is available on the context menu when you right-click an identifier. The Find menu provides a set of commands that search the entire active project for required information, such as references or definitions of the selected identifier, and then display the search results. Depending on a command, RAD Studio IDE can open the Code Editor positioned on the source code with the found information, or display the search results into a separate pane. This pane allows you to navigate to the source code.

The following commands are supported:

Note: Depending on the selected identifier type, some of the Find menu commands might be disabled.

See Also