Fixed #6291 and #6293: Support :: in front of function name in checkUnusedFunctions

Simplified code in CheckUnusedFunctions