shell - Searching for calls to a function with a certain number of arguments / where the N-th argument matches a regex -
i looking unix command line tools (to used on linux , mac os x gnu tools installed) allows me search through source code of large c++ (or java, or ...) project , 1 or both of following:
given name of function , positive integer n,
find calls function n-th parameter equal value resp. matches regex
find calls function number of arguments function n (alternatively: @ least / @ / less / greater than).
of course in full generallity, may arbitrarily hard, assuming here code base sufficiently nice, parameters function calls strings, numbers, other function calls, arithmetic expressions, etc., not, say, lambda expressions or other crazy stuff. not mind occassional false positive, , don't worry class names / templates etc. being confused function name.
indeed, if 1 worries false positives / negatives, variation list occurance of function name, , each list number of arguments, or unknown
if script failed determine it.
i pretty sure write perl script of need, seems such useful tool wondering (hoping? :) whether wrote something -- perhaps based on, say, clang, , using ast each source file. though soemthing based on plain text parsing might better in easy adapt other languages.
any pointers appreciated!
Comments
Post a Comment