Skip to content

Commit 30a1a77

Browse files
committed
Record externs in the functions map so that --callee can find them.
1 parent d132fa5 commit 30a1a77

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

cally.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ def full_call_graph(functions, **kwargs):
531531

532532
print_buf(std_buf, '"{}" -> "{}";'.format(func, caller))
533533

534-
if caller not in functions:
534+
if (caller not in functions) or (len(functions[caller]["files"]) == 0):
535535
print_buf(std_buf, '"{}" [style=dashed]'.
536536
format(caller))
537537

@@ -648,9 +648,9 @@ def main():
648648
match = re.match(function, line)
649649
if match is not None:
650650
function_name = match.group("function")
651-
if function_name in functions:
651+
if function_name in functions and functions[function_name]["files"]:
652652
if not config.no_warnings:
653-
print_err("WARNING: Function {} defined in multiple"
653+
print_err("WARNING: Function {} defined in multiple "
654654
"files \"{}\"!".
655655
format(function_name,
656656
', '.join(map(
@@ -673,6 +673,13 @@ def main():
673673
match = re.match(call, line)
674674
if match is not None:
675675
target = match.group("target")
676+
if not config.no_externs and target not in functions:
677+
functions[target] = dict()
678+
functions[target]["files"] = list()
679+
functions[target]["calls"] = dict()
680+
functions[target]["refs"] = dict()
681+
functions[target]["callee_calls"] = dict()
682+
functions[target]["callee_refs"] = dict()
676683
if target not in functions[function_name]["calls"]:
677684
functions[function_name]["calls"][target] = True
678685
else:

0 commit comments

Comments
 (0)