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);


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);
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to