| 44 | } |
| 45 | |
| 46 | const FunctionDecl * |
| 47 | TCTExtractor::getDefinedFuncDecl(const clang::Expr *E) const { |
| 48 | const auto *DRE = dyn_cast_or_null<DeclRefExpr>(E); |
| 49 | if (!DRE) |
| 50 | return nullptr; |
| 51 | |
| 52 | const auto *D = dyn_cast_or_null<FunctionDecl>(DRE->getDecl()); |
| 53 | if (!D) |
| 54 | return nullptr; |
| 55 | |
| 56 | std::string Tag = "DefinedFuncDecl"; |
| 57 | auto Matcher = functionDecl(hasBody(compoundStmt()), isDefinition(), |
| 58 | hasName(D->getNameAsString())) |
| 59 | .bind(Tag); |
| 60 | |
| 61 | for (const auto *ASTUnit : SrcCollection.getASTUnits()) |
| 62 | for (auto &Node : |
| 63 | match(Matcher, *const_cast<ASTContext *>(&ASTUnit->getASTContext()))) { |
| 64 | const auto *FD = Node.getNodeAs<FunctionDecl>(Tag); |
| 65 | if (!FD) |
| 66 | continue; |
| 67 | return FD; |
| 68 | } |
| 69 | return nullptr; |
| 70 | } |
| 71 | |
| 72 | const VarDecl *TCTExtractor::getTCArray(const ASTContext &Ctx) const { |
| 73 | std::string Tag = "TCArray"; |
nothing calls this directly
no test coverage detected