2.6 Symbol References

Semantic can interface with external symbol reference tools, such as GNU Global and GNU Idutils. These tools provide information about where different tags or symbols appear.

By default, Semantic tries to look for the best external symbol reference tool that can be used. The supported tools are GNU Global, GNU Idutils, CScope, and Grep (the fallback method). For best results, use GNU Global. However, Semantic does not manage your GNU Global tables for you; you must manage them yourself.

Variable: semantic-symref-tool

The value of this variable is a symbol that determines the external symbol reference tool to use. The default value, detect, says to look for the best available tool. Other possible values are global, idutils, cscope, and grep. Note that grep is much slower than the others.

The commands to display symbol references are C-c , g (semantic-symref-symbol and C-c , G (semantic-symref). These key bindings are available whenever Semantic mode is enabled (see Semantic mode user commands).

Command: semantic-symref-symbol sym

This command (normally bound to C-c , g) prompts for a symbol name, and uses an external reference tool to find references to that tag.

Command: semantic-symref

This command (normally bound to C-c , G) uses an external reference tool to find references to the current tag.

Both semantic-symref-symbol and semantic-symref display a list of symbol references in a separate buffer. The entries are organized by file, and by function name. Typing RET on the ‘[+]’ next to each function name “expands” that entry, listing all references to the target symbol occurring within that function. Typing RET on a reference line jumps to that reference.