Skip to content

Commit d23364c

Browse files
committed
C++: make files/folders instances of location
1 parent 08a6acc commit d23364c

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,21 @@ 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+
name != "" and
64+
container = c and
65+
this = c and
66+
startline = 0 and
67+
startcolumn = 0 and
68+
endline = 0 and
69+
endcolumn = 0
70+
)
5971
}
6072

6173
/**

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)