Next: , Previous: , Up: Cross-Referencing Facility   [Contents][Index]


12.2 Querying the cross-reference database

CMUCL provides a number of functions in the XREF package that may be used to query the cross-reference database:

Function: xref:who-calls function

Returns the list of xref-contexts where function (either a symbol that names a function, or a function object) may be called at runtime. XREF does not record calls to macro-functions (such as defun) or to special forms (such as eval-when).

Function: xref:who-references global-variable

Returns the list of program contexts that may reference global-variable.

Function: xref:who-binds global-variable

Returns a list of program contexts where the specified global variable may be bound at runtime (for example using LET).

Function: xref:who-sets global-variable

Returns a list of program contexts where the given global variable may be modified at runtime (for example using SETQ).

An xref-context is the originating site of a cross-reference. It identifies a portion of a program, and is defined by an xref-context structure, that comprises a name, a source file and a source-path.

Function: xref:xref-context-name context

Returns the name slot of an xref-context, which is one of:

Function: xref:xref-context-file context

Return the truename (in the sense of the variable compile-file-truename) of the source file from which the referencing forms were compiled. This slot will be nil if the code was compiled from a stream, or interactively from the listener.

Function: xref:xref-context-source-path context

Return a list of positive integers identifying the form that contains the cross-reference. The first integer in the source-path is the number of the top-level form containing the cross-reference (for example, 2 identifies the second top-level form in the source file). The second integer in the source-path identifies the form within this top-level form that contains the cross-reference, and so on. This function will always return nil if the file slot of an xref-context is nil.


Next: , Previous: , Up: Cross-Referencing Facility   [Contents][Index]