зеркало из https://github.com/github/codeql.git
C++: Fix explicit this-> FP.
This commit is contained in:
Родитель
29d7c0e21b
Коммит
28bd591107
|
@ -13,10 +13,10 @@ import semmle.code.cpp.commons.Exclusions
|
|||
|
||||
/** Gets the sub-expression of 'e' with the earliest-starting Location */
|
||||
Expr normalizeExpr(Expr e) {
|
||||
if forex(Expr q | q = e.(Call).getQualifier() | not q instanceof ThisExpr)
|
||||
if forex(Expr q | q = e.(Call).getQualifier() | not q.(ThisExpr).isCompilerGenerated())
|
||||
then result = normalizeExpr(e.(Call).getQualifier())
|
||||
else
|
||||
if forex(Expr q | q = e.(FieldAccess).getQualifier() | not q instanceof ThisExpr)
|
||||
if forex(Expr q | q = e.(FieldAccess).getQualifier() | not q.(ThisExpr).isCompilerGenerated())
|
||||
then result = normalizeExpr(e.(FieldAccess).getQualifier())
|
||||
else
|
||||
if e.hasExplicitConversion()
|
||||
|
|
|
@ -40,6 +40,10 @@ int Foo::test(int (*baz)(int))
|
|||
(void)i, // GOOD
|
||||
(void)j;
|
||||
|
||||
if (i)
|
||||
this->foo(i), // GOOD
|
||||
foo(i);
|
||||
|
||||
if (i)
|
||||
(void)i, // BAD
|
||||
(void)j;
|
||||
|
|
Загрузка…
Ссылка в новой задаче