[PATCH] D148444: [clang-tidy] Prevent `llvmlibc-inline-function-decl` triggering on lambdas
Joseph Huber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 15 16:34:20 PDT 2023
jhuber6 created this revision.
jhuber6 added reviewers: lntue, michaelrj, sivachandra, gchatelet, goldstein.w.n.
Herald added subscribers: PiotrZSL, carlosgalvezp, xazax.hun.
Herald added a reviewer: njames93.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.
The `llvmlibc-inline-function-decl` check is intended to be used to
allow declarations in the `libc` project's header to be changed per-TU.
However, it is impossible to place this macro in front of a lambda so
this is not helpful. Additionally, lambdas are always going to have
internal linkage so they will not differ accross TUs.
Fixes https://github.com/llvm/llvm-project/issues/62147
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D148444
Files:
clang-tools-extra/clang-tidy/llvmlibc/InlineFunctionDeclCheck.cpp
Index: clang-tools-extra/clang-tidy/llvmlibc/InlineFunctionDeclCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/llvmlibc/InlineFunctionDeclCheck.cpp
+++ clang-tools-extra/clang-tidy/llvmlibc/InlineFunctionDeclCheck.cpp
@@ -39,6 +39,11 @@
HeaderFileExtensions))
return;
+ // Consider only functions with a external and visible declaration.
+ if (auto *MemberDecl = dyn_cast<CXXMethodDecl>(FuncDecl))
+ if (MemberDecl->getParent()->isLambda())
+ return;
+
// Check if decl starts with LIBC_INLINE
auto Loc = FullSourceLoc(Result.SourceManager->getFileLoc(SrcBegin),
*Result.SourceManager);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148444.513947.patch
Type: text/x-patch
Size: 742 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230415/5bb7e973/attachment.bin>
More information about the cfe-commits
mailing list