findCalls: Get the names of all routines called in any code in a...

findCallsR Documentation

Get the names of all routines called in any code in a translation unit

Description

This function finds the names of routines that are called by other code. It traverses the specified code, i.e. a translation unit, a source file or a routine and finds the calls.

Usage

findCalls(file, fileFilter = character(), n = 10000, ...)

Arguments

file

the name of a source code file, a previously parsed translation unit or a CXCursor object, e.g. representing a routine

fileFilter

a character vector. This is used to identify the files/directories of interest and to identify the cursors we want in the results. This can be a single string that is a regular expression. Alternatively, it can be a vector of directory or file names. For a vector of values, we check which correspond to actual file or directory names. For these, we filter the cursors based on whether they are in the specified file names, within files in the specified directories. For elements that are not files or directories, we use these as regular expressions. This mechanism allows us to include cursors by explicit file name, explicit directory, or by regular expression.

n

a guess as to how many calls we are likely to encounter. This is used to preallocate memory to store the calls. The only down side to this being too small is extra memory allocation steps.

...

additional arguments that are passed to createTU if file is the name of a source file.

Value

A list in which each element is the CXCursor for the corresponding call.

Author(s)

Duncan Temple Lang

References

libclang http://clang.llvm.org/doxygen/group__CINDEX.html

See Also

getRoutines createTU visitCursor

Examples

fcalls = findCalls(system.file("exampleCode", "fib.c", package = "RCIndex"))

omegahat/RClangSimple documentation built on Jan. 17, 2024, 6:27 p.m.