Skip to content

Commit a93246d

Browse files
committed
C++: Fix maxCols.
1 parent ea96826 commit a93246d

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

cpp/ql/src/semmle/code/cpp/Location.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ deprecated library class LocationExpr extends Location, @location_expr { }
128128
* Gets the length of the longest line in file `f`.
129129
*/
130130
pragma[nomagic]
131-
private int maxCols(File f) { result = max(Location l | l.getFile() = f | l.getEndColumn()) }
131+
private int maxCols(File f) { result = max(Location l | l.getFile() = f | [l.getStartColumn(), l.getEndColumn()]) }
132132

133133
/**
134134
* A C/C++ element that has a location in a file
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
| charloc.cpp | 1 | 39 | 39 | 1 |
2-
| charloc.cpp | 2 | 48 | 48 | 2 |
3-
| charloc.cpp | 3 | 52 | 52 | 3 |
4-
| charloc.cpp | 4 | 64 | 64 | 4 |
5-
| charloc.cpp | (...) | 65 | 65 | (...) |
6-
| charloc.cpp | ... + ... | 48 | 52 | ... + ..., 2, 3 |
1+
| charloc.cpp | 1 | 47 | 47 | 1 |
2+
| charloc.cpp | 2 | 58 | 58 | 2 |
3+
| charloc.cpp | 3 | 62 | 62 | 3 |
4+
| charloc.cpp | 4 | 78 | 78 | 4 |
5+
| charloc.cpp | (...) | 77 | 79 | (...), 4 |
6+
| charloc.cpp | ... + ... | 58 | 62 | ... + ..., 2, 3 |

cpp/ql/test/query-tests/definitions/locationInfo.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Link extends Top {
1111
* Gets the length of the longest line in file `f`.
1212
*/
1313
pragma[nomagic]
14-
private int maxCols(File f) { result = max(Location l | l.getFile() = f | l.getEndColumn()) }
14+
private int maxCols(File f) { result = max(Location l | l.getFile() = f | [l.getStartColumn(), l.getEndColumn()]) }
1515

1616
/**
1717
* Gets the location of an element that has a link-to-definition (in a similar manner to

0 commit comments

Comments
 (0)