Symbol declaration and cross-reference information (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Delphi Compiler Directives (List) Index

Type

Switch

Syntax

{$Y+}, {$Y-}, or {$YD}; {$REFERENCEINFO ON}, {DEFINITIONINFO OFF} or {$REFERENCEINFO OFF}, or {DEFINITIONINFO ON}

Default

{$YD} {$DEFINITIONINFO ON}

Scope

Global



Remarks

The $Y directive controls generation of symbol reference information used by the Project Manager, Code Explorer, and Code editor. This information consists of tables that provide the source-code line numbers for all declarations of and (in the {$Y+} state) references to identifiers in a module. For units, the information is recorded in the .dcu file along with the unit's object code. Symbol reference information increases the size of .dcu files, but it does not affect the size or speed of the executable program.

When a program or unit is compiled in the default {$YD} (or {DEFINITIONINFO ON}) state, the compiler records information about where each identifier is defined. For most identifiers, variables, constants, classes, and so forth the compiler records the location of the declaration. For procedures, functions, and methods, the compiler records the location of the implementation. This enables code browsing.

When a program or unit is compiled in the {$Y+} (or {REFERENCEINFO ON}) state, the compiler records information about where every identifier is used as well as where it is defined. This enables the References page of the Code Browsing feature.

When a program or unit is compiled in the {$Y-} (or {DEFINITIONINFO OFF} or {REFERENCEINFO OFF}) state, no symbol reference information is recorded. This disables code browsing and the References page of the Code Browsing feature.

The $Y switch is usually used in conjunction with the $D and $L switches, which control generation of debug information and local symbol information. The $Y directive has no effect unless both $D and $L are enabled.

Note: Generating full cross-reference information ({$Y+}) can slow the compile/link cycle, so you should not use this except when you need the Project Manager References page.