code_junkie

Finding invocations of a certain function in a c++ file using python

Nov 12th, 2011
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. from pygccxml.declarations import call_invocation
  2.  
  3. def test_is_call_invocation(call):
  4. if call_invocation.is_call_invocation(call):
  5. print call_invocation.name(call)
  6. for arg in call_invocation.args(call):
  7. print " ",arg
  8. else:
  9. print "not a function invocation"
  10.  
  11. from pygccxml import parser
  12. from pygccxml import declarations
  13.  
  14. decls = parser.parse( ['main.cpp'] )
  15. # ...
  16.  
  17. void foo()
  18. {}
  19.  
  20. void bar()
  21. {
  22. foo();
  23. }
Add Comment
Please, Sign In to add comment