Skip to content

Commit a1ce908

Browse files
committed
C++: make files/folders instances of location
1 parent e42ccc2 commit a1ce908

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,20 @@ class Location extends @location {
5353
predicate fullLocationInfo(
5454
Container container, int startline, int startcolumn, int endline, int endcolumn
5555
) {
56-
locations_default(this, unresolveElement(container), startline, startcolumn, endline, endcolumn) or
57-
locations_expr(this, unresolveElement(container), startline, startcolumn, endline, endcolumn) or
56+
locations_default(this, unresolveElement(container), startline, startcolumn, endline, endcolumn)
57+
or
58+
locations_expr(this, unresolveElement(container), startline, startcolumn, endline, endcolumn)
59+
or
5860
locations_stmt(this, unresolveElement(container), startline, startcolumn, endline, endcolumn)
61+
or
62+
exists(@container c, string name | files(c, name) or folders(c, name) |
63+
container = c and
64+
this = c and
65+
startline = 0 and
66+
startcolumn = 0 and
67+
endline = 0 and
68+
endcolumn = 0
69+
)
5970
}
6071

6172
/**

cpp/ql/lib/semmlecode.cpp.dbscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ header_to_external_package(
224224
int package : @external_package ref
225225
);
226226

227-
@location = @location_stmt | @location_expr | @location_default ;
227+
@location = @location_stmt | @location_expr | @location_default | @container;
228228

229229
/**
230230
* The location of a statement.

0 commit comments

Comments
 (0)