Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void UseInternalLinkageCheck::registerMatchers(MatchFinder *Finder) {
exportDecl()))))));
Finder->addMatcher(
functionDecl(Common, hasBody(),
unless(anyOf(cxxMethodDecl(),
unless(anyOf(cxxMethodDecl(), isConsteval(),
isAllocationOrDeallocationOverloadedFunction(),
isMain())))
.bind("fn"),
Expand Down
6 changes: 3 additions & 3 deletions clang-tools-extra/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ Changes in existing checks

- Improved :doc:`misc-use-internal-linkage
<clang-tidy/checks/misc/use-internal-linkage>` check to insert ``static``
keyword before type qualifiers such as ``const`` and ``volatile`` and fix
false positives for function declaration without body and fix false positives
for C++20 export declarations and fix false positives for global scoped
keyword before type qualifiers such as ``const`` and ``volatile``. Also, fix
false positives for function declaration without body, C++20 consteval
functions, C++20 export declarations, and global scoped
overloaded ``operator new`` and ``operator delete``.

- Improved :doc:`modernize-avoid-c-arrays
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// RUN: %check_clang_tidy -std=c++20 %s misc-use-internal-linkage %t -- -- -I%S/Inputs/use-internal-linkage

consteval void gh122096() {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also check constexpr void func_constexpr()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, added


constexpr void cxf() {}
// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: function 'cxf'
// CHECK-FIXES: static constexpr void cxf() {}
Loading