52 const auto *
FuncDecl = Result.Nodes.getNodeAs<FunctionDecl>(
"func_decl");
58 SourceLocation SrcBegin =
FuncDecl->getBeginLoc();
62 if (
const TemplateParameterList *TemplateParams =
63 getLastTemplateParameterList(
FuncDecl)) {
64 SrcBegin = TemplateParams->getRAngleLoc();
65 std::optional<Token> NextToken =
67 SrcBegin, *Result.SourceManager, Result.Context->getLangOpts());
69 SrcBegin = NextToken->getLocation();
74 HeaderFileExtensions))
78 if (
const auto *MethodDecl = dyn_cast<CXXMethodDecl>(
FuncDecl))
79 if (MethodDecl->getParent()->isLambda())
83 auto Loc = FullSourceLoc(Result.SourceManager->getFileLoc(SrcBegin),
84 *Result.SourceManager);
85 llvm::StringRef SrcText = Loc.getBufferData().drop_front(Loc.getFileOffset());
86 if (SrcText.starts_with(
"LIBC_INLINE"))
89 diag(SrcBegin,
"%0 must be tagged with the LIBC_INLINE macro; the macro "
90 "should be placed at the beginning of the declaration")
91 <<
FuncDecl << FixItHint::CreateInsertion(Loc,
"LIBC_INLINE ");
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.