mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
C++: Fix explicit this-> FP.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user