Skip to content

Commit 28bd591

Browse files
committed
C++: Fix explicit this-> FP.
1 parent 29d7c0e commit 28bd591

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

cpp/ql/src/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import semmle.code.cpp.commons.Exclusions
1313

1414
/** Gets the sub-expression of 'e' with the earliest-starting Location */
1515
Expr normalizeExpr(Expr e) {
16-
if forex(Expr q | q = e.(Call).getQualifier() | not q instanceof ThisExpr)
16+
if forex(Expr q | q = e.(Call).getQualifier() | not q.(ThisExpr).isCompilerGenerated())
1717
then result = normalizeExpr(e.(Call).getQualifier())
1818
else
19-
if forex(Expr q | q = e.(FieldAccess).getQualifier() | not q instanceof ThisExpr)
19+
if forex(Expr q | q = e.(FieldAccess).getQualifier() | not q.(ThisExpr).isCompilerGenerated())
2020
then result = normalizeExpr(e.(FieldAccess).getQualifier())
2121
else
2222
if e.hasExplicitConversion()

cpp/ql/test/query-tests/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation/test.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ int Foo::test(int (*baz)(int))
4040
(void)i, // GOOD
4141
(void)j;
4242

43+
if (i)
44+
this->foo(i), // GOOD
45+
foo(i);
46+
4347
if (i)
4448
(void)i, // BAD
4549
(void)j;

0 commit comments

Comments
 (0)