virtual void run(const MatchFinder::MatchResult &results) { FunctionDecl *functionDecl = (FunctionDecl *) results.Nodes.getNodeAs<FunctionDecl>("functionDecl"); if (functionDecl) { CyclomaticComplexityMetric ccnMetric; EXPECT_EQ(_ccn, ccnMetric.calculate(functionDecl)); } else { FAIL(); } }
extern "C" int getCyclomaticComplexity(clang::Decl *decl) { CyclomaticComplexityMetric ccnMetric; return ccnMetric.calculate(decl); }