Description Usage Arguments Value Note Author(s) References See Also Examples
This actually works on arbitrary nodes within the translation unit parser array of nodes. So it can be used for examining code blocks, e.g. body of an if statement or a while loop.
1 | getCallGraph(nodes, defs = getRoutines(nodes), visited = new.env())
|
nodes |
the parser or array of nodes, used to lookup the
references to other nodes within the |
defs |
for the caller, this is the routine returned from
|
visited |
this is not intended to be supplied by the top-level caller, but rather is passed between the recursive calls to store information about which nodes have already been visited and so are not to be processed again should there be another node that refers to it. |
A named vector giving the names of the routines that were found to be called within the routine/language node along with the position in the parser array of nodes so that one can quickly identify the actual declaration/definition.
This does not handle invocations via "function pointers" in the C code. It can be made to understand them, but not know which routine will be called. That is a run-time decision.
Duncan Temple Lang
c-tree.texi in the gcc source distribution.
1 2 3 4 5 6 7 8 9 10 11 | ## Not run:
filename = system.file("examples", "phast", "msa.c.tu", package = "RGCCTranslationUnit")
p = parseTU(filename, language = "C")
routines = getRoutines(p, "msa.c")
calls = getCallGraph(p, routines$msa_new_from_file)
names(calls)
counts = table(names(calls))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.