@@ -227,21 +227,6 @@ public static String construct(
227227 IAnalysisCacheView cache = new AnalysisCacheImpl(AstIRFactory.makeDefaultFactory(),
228228 options.getSSAOptions());
229229
230- // set cyclomatic complexity for callables in the symbol table
231- int numClasses = cha.getNumberOfClasses();
232- for (Iterator<IClass> classIter = cha.iterator(); classIter.hasNext(); ) {
233- IClass cls = classIter.next();
234- for (IMethod method: cls.getAllMethods()) {
235- Callable callable = getCallableFromSymbolTable(method).getRight();
236- if (callable != null) {
237- IR ir = cache.getIR(method);
238- if (ir != null) {
239- callable.setCyclomaticComplexity(getCyclomaticComplexity(ir));
240- }
241- }
242- }
243- }
244-
245230 // Build call graph
246231 Log.info("Building call graph.");
247232
@@ -264,6 +249,14 @@ public static String construct(
264249 Log.done("Finished construction of call graph. Took "
265250 + Math.ceil((double) (System.currentTimeMillis() - start_time) / 1000) + " seconds.");
266251
252+ // set cyclomatic complexity for callables in the symbol table
253+ callGraph.forEach(cgNode -> {
254+ Callable callable = getCallableFromSymbolTable(cgNode.getMethod()).getRight();
255+ if (callable != null) {
256+ callable.setCyclomaticComplexity(getCyclomaticComplexity(cgNode.getIR()));
257+ }
258+ });
259+
267260 // Build SDG graph
268261 Log.info("Building System Dependency Graph.");
269262 SDG<? extends InstanceKey> sdg = new SDG<>(
0 commit comments