mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
CPP: Exclude template classes from the query.
This commit is contained in:
@@ -93,6 +93,10 @@ predicate assignOperatorWithWrongResult(Operator op, string msg) {
|
||||
|
||||
from Operator op, string msg
|
||||
where
|
||||
assignOperatorWithWrongType(op, msg) or
|
||||
assignOperatorWithWrongResult(op, msg)
|
||||
(
|
||||
assignOperatorWithWrongType(op, msg) or
|
||||
assignOperatorWithWrongResult(op, msg)
|
||||
) and
|
||||
// exclude template classes which may have incomplete function bodies
|
||||
not op.getDeclaringType() instanceof TemplateClass
|
||||
select op, msg
|
||||
|
||||
@@ -209,7 +209,7 @@ public:
|
||||
}
|
||||
|
||||
Obj3<T> &operator=(const Obj3<T> &other) {
|
||||
return subFunc(other); // GOOD (returns *this) [FALSE POSITIVE]
|
||||
return subFunc(other); // GOOD (returns *this)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
| AV Rule 82.cpp:18:9:18:17 | operator= | Assignment operator in class Bad1 does not return a reference to *this. |
|
||||
| AV Rule 82.cpp:24:8:24:16 | operator= | Assignment operator in class Bad2 should have return type Bad2&. Otherwise a copy is created at each call. |
|
||||
| AV Rule 82.cpp:63:29:63:29 | operator= | Assignment operator in class TemplateReturnAssignment<int> does not return a reference to *this. |
|
||||
| AV Rule 82.cpp:63:29:63:37 | operator= | Assignment operator in class TemplateReturnAssignment<T> does not return a reference to *this. |
|
||||
| AV Rule 82.cpp:199:52:199:52 | operator= | Assignment operator in class TemplatedAssignmentBad should have return type TemplatedAssignmentBad&. Otherwise a copy is created at each call. |
|
||||
| AV Rule 82.cpp:211:12:211:20 | operator= | Assignment operator in class Obj3<T> does not return a reference to *this. |
|
||||
|
||||
Reference in New Issue
Block a user