[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 01:40:44 PST 2023


ClockMan added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/llvmlibc/InlineFunctionDeclCheck.cpp:31
+  // Consider functions only in header files.
+  if (!Result.SourceManager->getFilename(SrcBegin).ends_with(".h"))
+    return;
----------------
Probably better would be to check if this isn't main source Result.SourceManager->isInMainFile(SrcBegin)


================
Comment at: clang-tools-extra/clang-tidy/llvmlibc/InlineFunctionDeclCheck.cpp:35
+  auto Loc = FullSourceLoc(SrcBegin, *Result.SourceManager);
+  if (Loc.getBufferData().starts_with("LIBC_INLINE"))
+    return;
----------------
Maybe put this LIBC_INLINE into some configuration, so check could be used by someone else also for other macros.


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