llvm / llvm/llvm-project

[clang-tidy] Option to flag decls with internal linkage in misc-definitions-in-headers

Open
#197,546 2 comments 0 reactions 0 assignees View on GitHub
clang-tidy enhancement
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Currently, this seems to be intentionally left out in the current implementation.

> // internal linkage variable definitions are ignored for now.
// Although these might also cause ODR violations, we can be less certain and
// should try to keep the false-positive rate down.

Personally, I haven't really had a case where I had ODR issues with variables that have internal linkages in header files but they are hard to track as project grows and bloat binary sizes.

I assume specially making static non-const variables inline might actually change behavior in same parts but const static variables should be more safe.

https://clang.llvm.org/extra/clang-tidy/checks/misc/definitions-in-headers.html

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.