C++: fix implicit this

This commit is contained in:
Erik Krogh Kristensen
2021-10-14 09:49:53 +02:00
committed by Mathias Vorreiter Pedersen
parent b2e4276bc8
commit fe891746bf
97 changed files with 1739 additions and 1571 deletions

View File

@@ -68,12 +68,12 @@ class VariableDeclarationLine extends TVariableDeclarationInfo {
/**
* Gets the start column of the first `VariableDeclarationEntry` on this line.
*/
int getStartColumn() { result = min(getAVDE().getLocation().getStartColumn()) }
int getStartColumn() { result = min(this.getAVDE().getLocation().getStartColumn()) }
/**
* Gets the end column of the last `VariableDeclarationEntry` on this line.
*/
int getEndColumn() { result = max(getAVDE().getLocation().getEndColumn()) }
int getEndColumn() { result = max(this.getAVDE().getLocation().getEndColumn()) }
/**
* Gets the rank of this `VariableDeclarationLine` in its file and class
@@ -89,14 +89,14 @@ class VariableDeclarationLine extends TVariableDeclarationInfo {
*/
VariableDeclarationLine getNext() {
result = TVariableDeclarationLine(c, f, _) and
result.getRank() = getRank() + 1
result.getRank() = this.getRank() + 1
}
/**
* Gets the `VariableDeclarationLine` following this one, if it is nearby.
*/
VariableDeclarationLine getProximateNext() {
result = getNext() and
result = this.getNext() and
result.getLine() <= this.getLine() + 3
}
@@ -114,14 +114,14 @@ class VariableDeclarationGroup extends VariableDeclarationLine {
// there is no `VariableDeclarationLine` within three lines previously
not any(VariableDeclarationLine prev).getProximateNext() = this and
// `end` is the last transitively proximate line
end = getProximateNext*() and
end = this.getProximateNext*() and
not exists(end.getProximateNext())
}
predicate hasLocationInfo(string path, int startline, int startcol, int endline, int endcol) {
path = f.getAbsolutePath() and
startline = getLine() and
startcol = getStartColumn() and
startline = this.getLine() and
startcol = this.getStartColumn() and
endline = end.getLine() and
endcol = end.getEndColumn()
}
@@ -132,18 +132,18 @@ class VariableDeclarationGroup extends VariableDeclarationLine {
int getCount() {
result =
count(VariableDeclarationLine l |
l = getProximateNext*()
l = this.getProximateNext*()
|
l.getAVDE().getVariable().getName()
)
}
override string toString() {
getCount() = 1 and
result = "declaration of " + getAVDE().getVariable().getName()
this.getCount() = 1 and
result = "declaration of " + this.getAVDE().getVariable().getName()
or
getCount() > 1 and
result = "group of " + getCount() + " fields here"
this.getCount() > 1 and
result = "group of " + this.getCount() + " fields here"
}
}