[all-commits] [llvm/llvm-project] d6dcd9: [clang-tidy] Fix `thread_local` false positives in...

Baranov Victor via All-commits all-commits at lists.llvm.org
Fri Mar 28 06:34:20 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d6dcd985c03bec4b77872be00a81d92454fedc32
      https://github.com/llvm/llvm-project/commit/d6dcd985c03bec4b77872be00a81d92454fedc32
  Author: Baranov Victor <bar.victor.2002 at gmail.com>
  Date:   2025-03-28 (Fri, 28 Mar 2025)

  Changed paths:
    M clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-var.cpp

  Log Message:
  -----------
  [clang-tidy] Fix `thread_local` false positives in `misc-use-internal-linkage` check  (#132573)

Based on C++ standard (see issue
https://github.com/llvm/llvm-project/issues/131679) and
[StackOverflow](https://stackoverflow.com/questions/22794382/are-c11-thread-local-variables-automatically-static)
`thread_local` variables are implicitly `static` so we should not
suggest adding `static` on a `thread_local` variables. I'd appreciate if
someone else will confirm this too because reading standard is tricky.

However, many people still use `static` and `thread_local` together:
[github
code-search](https://github.com/search?type=code&q=%22static+thread_local%22+language%3AC%2B%2B).
Maybe disabling warnings on `thread_local` should be made as a flag?
WDYT?

Closes https://github.com/llvm/llvm-project/issues/131679.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list