Skip to content

Commit a1c7fd8

Browse files
committed
C++: Remove the workaround for CPP-331.
1 parent 5150bf3 commit a1c7fd8

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

cpp/ql/src/Best Practices/Hiding/DeclarationHidesParameter.ql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ ParameterDeclarationEntry functionParameterNames(Function f, string name) {
2424
result.getFunctionDeclarationEntry() = fe and
2525
fe.getFunction() = f and
2626
fe.getLocation() = f.getDefinitionLocation() and
27-
result.getFile() = fe.getFile() and // Work around CPP-331
2827
strictcount(f.getDefinitionLocation()) = 1 and
2928
result.getName() = name
3029
)

cpp/ql/test/query-tests/Best Practices/Hiding/DeclarationHidesParameter/DeclarationHidesParameter.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
| hiding.cpp:45:7:45:7 | a | Local variable 'a' hides a $@. | hiding.cpp:39:20:39:20 | definition of a | parameter of the same name |
55
| hiding.cpp:47:7:47:7 | c | Local variable 'c' hides a $@. | hiding.cpp:39:34:39:34 | definition of c | parameter of the same name |
66
| hiding.cpp:64:11:64:11 | i | Local variable 'i' hides a $@. | hiding.cpp:61:20:61:20 | definition of i | parameter of the same name |
7+
| hiding.cpp:76:7:76:15 | protoArg1 | Local variable 'protoArg1' hides a $@. | hiding.h:5:21:5:29 | definition of protoArg1 | parameter of the same name |
8+
| hiding.cpp:77:5:77:13 | protoArg2 | Local variable 'protoArg2' hides a $@. | hiding.h:5:34:5:42 | definition of protoArg2 | parameter of the same name |
79
| hiding.cpp:78:7:78:10 | arg1 | Local variable 'arg1' hides a $@. | hiding.cpp:74:28:74:31 | definition of arg1 | parameter of the same name |
810
| hiding.cpp:79:5:79:8 | arg2 | Local variable 'arg2' hides a $@. | hiding.cpp:74:36:74:39 | definition of arg2 | parameter of the same name |

cpp/ql/test/query-tests/Best Practices/Hiding/DeclarationHidesParameter/hiding.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ void myClass::myCaller(void) {
7373
template <typename T>
7474
void myClass::myMethod(int arg1, T arg2) {
7575
{
76-
int protoArg1;
77-
T protoArg2;
76+
int protoArg1; // [FALSE POSITIVE]
77+
T protoArg2; // [FALSE POSITIVE]
7878
int arg1; // local variable hides global variable
7979
T arg2; // local variable hides global variable
8080
}

0 commit comments

Comments
 (0)