mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
C++: Add a test of charLoc and subsumes.
This commit is contained in:
8
cpp/ql/test/library-tests/locations/charloc/charloc.cpp
Normal file
8
cpp/ql/test/library-tests/locations/charloc/charloc.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
void test()
|
||||
{
|
||||
1;
|
||||
2 + 3;
|
||||
(
|
||||
4);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
| charloc.cpp | 1 | 39 | 39 | 1 |
|
||||
| charloc.cpp | 2 | 48 | 48 | 2 |
|
||||
| charloc.cpp | 3 | 52 | 52 | 3 |
|
||||
| charloc.cpp | 4 | 64 | 64 | 4 |
|
||||
| charloc.cpp | (...) | 65 | 65 | (...) |
|
||||
| charloc.cpp | ... + ... | 48 | 52 | ... + ..., 2, 3 |
|
||||
7
cpp/ql/test/library-tests/locations/charloc/charloc.ql
Normal file
7
cpp/ql/test/library-tests/locations/charloc/charloc.ql
Normal file
@@ -0,0 +1,7 @@
|
||||
import cpp
|
||||
|
||||
from File f, Expr e, Location l, int start, int end
|
||||
where
|
||||
e.getLocation() = l and
|
||||
l.charLoc(f, start, end)
|
||||
select f.getBaseName(), e.toString(), start, end, concat(Expr e2, Location l2 | e2.getLocation() = l2 and l.subsumes(l2) | e2.toString(), ", ")
|
||||
Reference in New Issue
Block a user