[PATCH] D142592: [clang-tidy][libc] Add an inline function checker for the libc project.

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 26 07:26:14 PST 2023


ClockMan added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/llvmlibc/InlineFunctionDeclCheck.cpp:20
+void InlineFunctionDeclCheck::registerMatchers(MatchFinder *Finder) {
+  Finder->addMatcher(decl(functionDecl()).bind("func_decl"), this);
+}
----------------
carlosgalvezp wrote:
> ClockMan wrote:
> > or maybe even better:
> > Finder->addMatcher(functionDecl(unless(isExpansionInMainFile()), isInline()).bind("func_decl"), this);
> > Instead of line 26 and 32.
> I'm not sure that works - if we pass a header directly to clang-tidy, it will consider it as the "main file", right? That's why the established pattern is based on `HeaderFileExtensions`, please check out other checks.
Yes you right, but isInline still can be checked here.
As for HeaderFileExtensions never used it from both developer and user point of view.
When running clang-tidy on headers is still better simply create file with single include.
Maybe if there would be AST_MATCHER for HeaderFileExtensions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142592/new/

https://reviews.llvm.org/D142592



More information about the cfe-commits mailing list