mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
C/C++ overlay: Add overlay support for discarding functions
This commit is contained in:
@@ -20,9 +20,13 @@ private string getLocationFilePath(@location_default loc) {
|
|||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local]
|
||||||
private string getSingleLocationFilePath(@element e) {
|
private string getSingleLocationFilePath(@element e) {
|
||||||
// @var_decl has a direct location in the var_decls relation
|
exists(@location_default loc |
|
||||||
exists(@location_default loc | var_decls(e, _, _, _, loc) | result = getLocationFilePath(loc))
|
var_decls(e, _, _, _, loc)
|
||||||
//TODO: add other kinds of elements with single locations
|
or
|
||||||
|
fun_decls(e, _, _, _, loc)
|
||||||
|
|
|
||||||
|
result = getLocationFilePath(loc)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,11 +34,13 @@ private string getSingleLocationFilePath(@element e) {
|
|||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local]
|
||||||
private string getMultiLocationFilePath(@element e) {
|
private string getMultiLocationFilePath(@element e) {
|
||||||
// @variable gets its location(s) from its @var_decl(s)
|
exists(@location_default loc |
|
||||||
exists(@var_decl vd, @location_default loc | var_decls(vd, e, _, _, loc) |
|
exists(@var_decl vd | var_decls(vd, e, _, _, loc))
|
||||||
|
or
|
||||||
|
exists(@fun_decl fd | fun_decls(fd, e, _, _, loc))
|
||||||
|
|
|
||||||
result = getLocationFilePath(loc)
|
result = getLocationFilePath(loc)
|
||||||
)
|
)
|
||||||
//TODO: add other kinds of elements with multiple locations
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user