/*** @name Function is never called* @description Unused functions may increase object size, decrease readability, and create the possibility of misuse.* @kind problem* @id cpp/dead-code-function* @problem.severity warning* @tags maintainability* external/cwe/cwe-561*/import cpppredicate limitedScope(Function f) {f.isStatic() and not f instanceof MemberFunctionorf.(MemberFunction).isPrivate()}predicate uncalled(Function f) {limitedScope(f) andnot exists(Function g | g = f or g = f.(VirtualFunction).getAnOverriddenFunction+() |exists(g.getACallToThisFunction()) orexists(FunctionAccess fa | fa.getTarget() = g))}from Function fwhereuncalled(f) andforall(Function instance | f.(TemplateFunction).getAnInstantiation() = instance |uncalled(instance)) and// tweaks for good results:exists(f.getBlock()) andnot (f instanceof Constructor or f instanceof Destructor or f.hasName("operator="))select f, "Dead Code: this function is never called."
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。