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 @@ -130,7 +130,10 @@ void UseInternalLinkageCheck::registerMatchers(MatchFinder *Finder) {
isMain())))
.bind("fn"),
this);
Finder->addMatcher(varDecl(Common, hasGlobalStorage()).bind("var"), this);
Finder->addMatcher(
varDecl(Common, hasGlobalStorage(), unless(hasThreadStorageDuration()))
.bind("var"),
this);
}

static constexpr StringRef Message =
Expand Down
4 changes: 3 additions & 1 deletion clang-tools-extra/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ Changes in existing checks

- Improved :doc:`misc-use-internal-linkage
<clang-tidy/checks/misc/use-internal-linkage>` check by fix false positives
for function or variable in header file which contains macro expansion.
for function or variable in header file which contains macro expansion and
excluding variables with ``thread_local`` storage class specifier from being
matched.

- Improved :doc:`modernize-use-default-member-init
<clang-tidy/checks/modernize/use-default-member-init>` check by matching
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ extern int global_extern;

static int global_static;

thread_local int global_thread_local;

namespace {
static int global_anonymous_ns;
namespace NS {
Expand All @@ -41,6 +43,7 @@ static int global_anonymous_ns;
static void f(int para) {
int local;
static int local_static;
thread_local int local_thread_local;
}

struct S {
Expand Down