Cursor.canonical

Retrieve the canonical cursor corresponding to the given cursor.

In the C family of languages, many kinds of entities can be declared several times within a single translation unit. For example, a structure type can be forward-declared (possibly multiple times) and later defined:

1 struct X;
2 struct X;
3 struct X {
4  int member;
5 }

The declarations and the definition of X are represented by three different cursors, all of which are declarations of the same underlying entity. One of these cursor is considered the "canonical" cursor, which is effectively the representative for the underlying entity. One can determine if two cursors are declarations of the same underlying entity by comparing their canonical cursors.

Return: The canonical cursor for the entity referred to by the given cursor.

struct Cursor
@property
canonical
@trusted const
(
)

Meta