File tree Expand file tree Collapse file tree 1 file changed +41
-1
lines changed Expand file tree Collapse file tree 1 file changed +41
-1
lines changed Original file line number Diff line number Diff line change 33misc-shadowed-namespace-function
44================================
55
6- FIXME: Describe what patterns does the check detect and why. Give examples.
6+ Detects free functions in the global namespace that shadow functions declared
7+ in other namespaces. This check helps prevent accidental shadowing of namespace
8+ functions, which can lead to confusion about which function is being called and
9+ potential linking errors.
10+
11+ Examples
12+ --------
13+
14+ .. code-block :: c++
15+
16+ namespace utils {
17+ void process();
18+ void calculate();
19+ }
20+
21+ // Warning: free function shadows utils::process
22+ void process() {}
23+
24+ // No warning - static function
25+ static void calculate() {}
26+
27+ The check will suggest adding the appropriate namespace qualification:
28+
29+ .. code-block :: diff
30+
31+ - void process() {}
32+ + void utils::process() {}
33+
34+ Options
35+ -------
36+
37+ None
38+
39+ Limitations
40+ -----------
41+
42+ - Does not warn about functions in anonymous namespaces
43+ - Does not warn about template functions
44+ - Does not warn about static functions or member functions
45+ - Does not warn about the ``main `` function
46+ - Only considers functions declared before the global definition
You can’t perform that action at this time.
0 commit comments