mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
C++: Test for DeclarationHidesVariable FP
This commit is contained in:
@@ -1,2 +1,5 @@
|
||||
| hiding.cpp:6:17:6:17 | i | Variable i hides another variable of the same name (on $@). | hiding.cpp:4:13:4:13 | i | line 4 |
|
||||
| hiding.cpp:18:15:18:15 | k | Variable k hides another variable of the same name (on $@). | hiding.cpp:15:11:15:11 | k | line 15 |
|
||||
| hiding.cpp:30:5:30:5 | (__begin) | Variable (__begin) hides another variable of the same name (on $@). | hiding.cpp:29:3:29:3 | (__begin) | line 29 |
|
||||
| hiding.cpp:30:5:30:5 | (__end) | Variable (__end) hides another variable of the same name (on $@). | hiding.cpp:29:3:29:3 | (__end) | line 29 |
|
||||
| hiding.cpp:30:5:30:5 | (__range) | Variable (__range) hides another variable of the same name (on $@). | hiding.cpp:29:3:29:3 | (__range) | line 29 |
|
||||
|
||||
@@ -3,7 +3,7 @@ void f(void) {
|
||||
if (1) {
|
||||
int i;
|
||||
|
||||
for(int i = 1; i < 10; i++) {
|
||||
for(int i = 1; i < 10; i++) { // BAD
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace foo {
|
||||
int k;
|
||||
try {
|
||||
for (i = 0; i < 3; i++) {
|
||||
int k;
|
||||
int k; // BAD
|
||||
}
|
||||
}
|
||||
catch (int e) {
|
||||
@@ -24,4 +24,9 @@ namespace foo {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void nestedRangeBasedFor() {
|
||||
int xs[4], ys[4];
|
||||
for (auto x : xs)
|
||||
for (auto y : ys) // GOOD [FALSE POSITIVE]
|
||||
x = y = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user