mirror of
https://github.com/github/codeql.git
synced 2025-12-21 19:26:31 +01:00
C++: Fix "LHS-end = RHS-begin" FP
This commit is contained in:
@@ -20,13 +20,14 @@ Expr normalizeExpr(Expr e) {
|
||||
else result = e
|
||||
}
|
||||
|
||||
from CommaExpr ce, Expr left, Expr right, int leftStartColumn, int rightStartColumn
|
||||
from CommaExpr ce, Expr left, Expr right, Location leftLoc, Location rightLoc
|
||||
where
|
||||
ce.fromSource() and
|
||||
not isFromMacroDefinition(ce) and
|
||||
left = normalizeExpr(ce.getLeftOperand()) and
|
||||
right = normalizeExpr(ce.getRightOperand()) and
|
||||
leftStartColumn = left.getLocation().getStartColumn() and
|
||||
rightStartColumn = right.getLocation().getStartColumn() and
|
||||
leftStartColumn > rightStartColumn
|
||||
leftLoc = left.getLocation() and
|
||||
rightLoc = right.getLocation() and
|
||||
leftLoc.getEndLine() < rightLoc.getStartLine() and
|
||||
leftLoc.getStartColumn() > rightLoc.getStartColumn()
|
||||
select right, "The indentation level after the comma can be misleading (for some tab sizes)."
|
||||
|
||||
@@ -113,7 +113,7 @@ int test(int i, int j, int (*foo)(int), int (*bar)(int, int))
|
||||
|
||||
int k = (foo(
|
||||
i++
|
||||
), j++); // GOOD? [FALSE POSITIVE]
|
||||
), j++); // GOOD?
|
||||
|
||||
// Weird case:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user