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.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Missing test
clang-tools-extra/clang-tidy/llvmlibc/InlineFunctionDeclCheck.cpp | ||
---|---|---|
43 | auto -> const auto |
clang-tools-extra/clang-tidy/llvmlibc/InlineFunctionDeclCheck.cpp | ||
---|---|---|
43 | Since there are 2 lines under this if, please add braces for better readability. | |
clang-tools-extra/test/clang-tidy/checkers/llvmlibc/inline-function-decl.hpp | ||
64–67 | Not needed, simply write a plain comment explaining why the check should not warn here. |
Address nit
clang-tools-extra/test/clang-tidy/checkers/llvmlibc/inline-function-decl.hpp | ||
---|---|---|
64–67 | Since I've already written it I think we should be able to keep it. If really you don't like the extra check lines I can remove them. |
From functional point of view it's looking good.
clang-tools-extra/clang-tidy/llvmlibc/InlineFunctionDeclCheck.cpp | ||
---|---|---|
42 | NOTE: This comment refers also to inline exclusion in line 33.
I don't think is needed, or you can extract line 33 and 43 into separate function like isExternalyVisibleDeclaration, and to be honest for check that there are other ways, some checks already do that, because simply then you can ask your self, what about coonstexpr functions, what about static functions, functions in anonymous namespace In theory they also may be catch here. Even that inline keyword could be redundant. | |
clang-tools-extra/test/clang-tidy/checkers/llvmlibc/inline-function-decl.hpp | ||
66 | NOTE: If this warning were printed then we got other issue in this check.
Implicit functions are checked, would be good to exclude them:
functionDecl(unless(isImplicit())). |
The log says that it failed because of the CMake version. I don't think I can fix that.
clang-tools-extra/test/clang-tidy/checkers/llvmlibc/inline-function-decl.hpp | ||
---|---|---|
66 | That was printed without this patch. Are you saying we should have a separate check for these types of functions? |
clang-tools-extra/test/clang-tidy/checkers/llvmlibc/inline-function-decl.hpp | ||
---|---|---|
66 | I'm just telling that this shouldn't be printed in first place because they are implicit, so there is no place to add macro. |
Additionally, lambdas are always going to have internal linkage so they will not differ accross TUs.
This isn't true - if a lambda appears in a header in any way, it probably has linkage the same as an inline function, not internal.
(eg: a lambda inside an inline function has linkage so it gets deduplicated with other copies from different inclusions of a header)