I run diff with the -p option so the output will include the name of the function where each change occurred. Is there an analogous option for
diff
-p
Assuming you are searching for foobar:
grep -e "^\w.*[(]" -e foobar *.h *.cpp | grep -B 1 foobar
greps for all functions and all foobar, then greps for just foobar and the preceding lines - which will be only foobars and the containing functions.
tested on cygwin on windows version