| 87 | return true; |
| 88 | } |
| 89 | bool VisitFunctionDecl(clang::FunctionDecl *d) { |
| 90 | if(!shouldProcess(d)) return false; |
| 91 | std::string typeText; |
| 92 | { |
| 93 | llvm::raw_string_ostream typeTextStream(typeText); |
| 94 | |
| 95 | bool isConst = false; |
| 96 | if (clang::CXXMethodDecl *cxx = llvm::dyn_cast<clang::CXXMethodDecl>(d)) { |
| 97 | if (cxx->isStatic()) |
| 98 | typeTextStream << "static "; |
| 99 | isConst = cxx->isConst(); |
| 100 | if (cxx->isThisDeclarationADefinition()) { |
| 101 | for (auto it = cxx->begin_overridden_methods(); it != cxx->end_overridden_methods(); ++it) { |
| 102 | const clang::CXXMethodDecl *ovr = (*it)->getCanonicalDecl(); |
| 103 | annotator.registerOverride(d, const_cast<clang::CXXMethodDecl*>(ovr), d->getNameInfo().getBeginLoc()); |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | typeTextStream << annotator.getTypeRef(getResultType(d)) << " " << d->getQualifiedNameAsString() << "("; |
| 108 | for (uint i = 0; i < d->getNumParams(); i++) { |
| 109 | if (i!=0) typeTextStream << ", "; |
| 110 | clang::ParmVarDecl* PVD = d->getParamDecl(i); |
| 111 | typeTextStream << annotator.getTypeRef(PVD->getType()) << " " << PVD->getName(); |
| 112 | if (PVD->hasDefaultArg() && !PVD->hasUninstantiatedDefaultArg()) { |
| 113 | typeTextStream << " = "; |
| 114 | PVD->getDefaultArg()->printPretty(typeTextStream, 0, annotator.getLangOpts()); |
| 115 | } |
| 116 | } |
| 117 | typeTextStream << ")"; |
| 118 | if (isConst) { |
| 119 | typeTextStream << " const"; |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | bool isDefinition = d->isThisDeclarationADefinition() || d->hasAttr<clang::AliasAttr>(); |
| 124 | |
| 125 | annotator.registerReference(d, d->getNameInfo().getSourceRange(), Annotator::Decl, |
| 126 | isDefinition ? Annotator::Definition : Annotator::Declaration, |
| 127 | typeText); |
| 128 | return true; |
| 129 | } |
| 130 | bool VisitEnumConstantDecl(clang::EnumConstantDecl *d) { |
| 131 | annotator.registerReference(d, d->getLocation(), Annotator::EnumDecl, Annotator::Declaration, d->getInitVal().toString(10)); |
| 132 | return true; |
nothing calls this directly
no test coverage detected