getInclusions: Collect all of the include files for a source file

getInclusionsR Documentation

Collect all of the include files for a source file

Description

This function computes which header files a source file includes, both directly and indirectly and which file includes which other files.

Usage

getInclusions(file, flat = FALSE,
              fun = if(flat)
                   genInclusionCollector()
                 else
                   genHierarchicalInclusionCollector(),
               ...)  

Arguments

file

the name of a source file or a previously parsed translation unit

flat

a logical value indicating whether we want the inclusion information organized as a flat character vector or with the files grouped by their "includer".

fun

a visitory function or object used to process the callbacks by libclang.

...

additional arguments that are passed to createTU if file is a file name and not a translation unit.

Value

a collection of the included files. If flat is TRUE, this is a character vector with an element for each file included. The corresponding element name is the file that included it.

If flat is FALSE, this returns a list with a character vector for each element. The names of the list are the names of the files that include others. The corresponding character vector contains the names of the files that that file includes.

One can get transform the flat version to the non-flat version with a simple call split(inc, names(inc)).

Author(s)

Duncan Temple Lang

References

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

See Also

createTU

Examples

inc = getInclusions(system.file("exampleCode", "file1.c", package = "RCIndex"), FALSE)

omegahat/RClangSimple documentation built on April 25, 2024, 4:18 a.m.