21 const TemplateParameterList *ReturnList =
22 FuncDecl->getDescribedTemplateParams();
25 const unsigned NumberOfTemplateParameterLists =
26 FuncDecl->getNumTemplateParameterLists();
28 if (NumberOfTemplateParameterLists > 0)
29 ReturnList =
FuncDecl->getTemplateParameterList(
30 NumberOfTemplateParameterLists - 1);
47 const auto *
FuncDecl = Result.Nodes.getNodeAs<FunctionDecl>(
"func_decl");
53 SourceLocation SrcBegin =
FuncDecl->getBeginLoc();
57 if (
const TemplateParameterList *TemplateParams =
59 SrcBegin = TemplateParams->getRAngleLoc();
60 std::optional<Token> NextToken =
62 SrcBegin, *Result.SourceManager, Result.Context->getLangOpts());
64 SrcBegin = NextToken->getLocation();
69 getHeaderFileExtensions()))
73 if (
const auto *MethodDecl = dyn_cast<CXXMethodDecl>(
FuncDecl))
74 if (MethodDecl->getParent()->isLambda())
78 auto Loc = FullSourceLoc(Result.SourceManager->getFileLoc(SrcBegin),
79 *Result.SourceManager);
80 const StringRef SrcText = Loc.getBufferData().drop_front(Loc.getFileOffset());
81 if (SrcText.starts_with(
"LIBC_INLINE"))
84 diag(SrcBegin,
"%0 must be tagged with the LIBC_INLINE macro; the macro "
85 "should be placed at the beginning of the declaration")
86 <<
FuncDecl << FixItHint::CreateInsertion(Loc,
"LIBC_INLINE ");
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.