Find Definitions and References (C++)
Go Up to Code Editor Context Menu
Contents
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 OS X 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
- Choose Project > Options > Project Properties.
- Under C++ Project Properties, select Index files for 'Definitions and References', and then click OK.
To Index All Newly Created Projects
- Choose Tools > Options > Environment Options > C++ Options > Project Properties.
- Under Default C++ Project Properties (applies to new projects only), select Index files for 'Definitions and References', and then click OK.
Note: You can use Find Definitions and Find References only in the active project. To activate a project, right-click it in the Project Manager, 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:
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 Project Manager, 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:
- Find Definition (C++): searches the entire active project for definitions of the selected identifier.
- Find References (C++): searches the entire active project for all references to the selected identifier.
- Show Base Types (C++): displays the base types of classes or methods of the selected identifier.
- Show Derived Types (C++): displays the derived types of classes or methods of the selected identifier.
- Show Type Hierarchy (C++): displays the hierarchy of classes or methods of the selected identifier.
- Go to Type Declaration (C++): navigates to the declaration of the selected identifier type.
- Header Dependency (C++): displays a tree view of all headers on which the selected header depends.
- Navigate To (C++): searches the entire active project for identifiers and constants that meet the specified search criteria.
Note: Depending on the selected identifier type, some of the Find menu commands might be disabled.