C++: Add a test of charLoc and subsumes.

This commit is contained in:
Geoffrey White
2021-06-04 11:05:25 +01:00
parent ffad65be40
commit ea96826810
3 changed files with 21 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
void test()
{
1;
2 + 3;
(
4);
}

View File

@@ -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 |

View 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(), ", ")