10 Commits

Author SHA1 Message Date
Baranov Victor
d6dcd985c0
[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.
2025-03-28 21:33:58 +08:00
Congcong Cai
6f7570c200
[clang-tidy][misc-use-internal-linkage] fix false positives for function or variable in header file which contains macro expansion (#129594)
When check whether in main file, spelling loc will lead to `<scratch
space>`. instead, expansion loc is close to loc after preprocess. It is
suitable to analyze linkage.
2025-03-08 13:41:24 +08:00
maflcko
6504546abc
[clang-tidy][use-internal-linkage] fix false positive for consteval function (#122141)
Fixes https://github.com/llvm/llvm-project/issues/122096

---------

Co-authored-by: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>
2025-01-10 09:24:24 +01:00
Congcong Cai
010317e173
[clang-tidy][use-internal-linkage]fix false positives for ExportDecl (#117901)
Fixed: #97190
2024-12-02 13:59:55 +08:00
Congcong Cai
f89fa238fa
[clang-tidy][use-internal-linkage]fix false positives for global overloaded operator new and operator delete (#117945) 2024-11-30 22:14:36 +08:00
Congcong Cai
e3aafe407a
[clang-tidy] fix false positive use-internal-linkage for func decl without body (#117490)
If in one TU, function only have declaration without body, this function
should be external linkage.
Fixed #117488
2024-11-25 06:46:10 +08:00
Congcong Cai
6f21a7bdee
[clang-tidy] insert `static` keyword in correct position for misc-use-internal-linkage (#108792)
Fixes: #108760

---------

Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2024-10-17 23:55:37 +08:00
Carlos Galvez
29896db09c
[clang-tidy] Do not warn on const variables in misc-use-internal-linkage (#97969)
Since in C++ they already have implicit internal linkage.

Fixes #97947
2024-07-09 12:20:44 +02:00
Congcong Cai
019f525716
[clang-tidy] add fixhint for misc-use-internal-linkage (#96203) 2024-06-26 22:30:15 +08:00
Congcong Cai
c4f83a004b
[clang-tidy] new check misc-use-internal-linkage (#90830)
Add new check misc-use-internal-linkage to detect variable and function
can be marked as static.

---------

Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2024-06-08 06:46:39 +08:00