mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
CPP:Add preliminary local jump to def queries
This commit is contained in:
@@ -132,7 +132,7 @@ private predicate constructorCallTypeMention(ConstructorCall cc, TypeMention tm)
|
||||
* - `"X"` for macro accesses
|
||||
* - `"I"` for import / include directives
|
||||
*/
|
||||
Top definitionOf(Top e, string kind) {
|
||||
cached Top definitionOf(Top e, string kind) {
|
||||
(
|
||||
// call -> function called
|
||||
kind = "M" and
|
||||
|
||||
21
cpp/ql/src/localDefinitions.ql
Normal file
21
cpp/ql/src/localDefinitions.ql
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @name Jump-to-definition links
|
||||
* @description Generates use-definition pairs that provide the data
|
||||
* for jump-to-definition in the code viewer.
|
||||
* @kind definitions
|
||||
* @id cpp/jump-to-definition
|
||||
*/
|
||||
|
||||
import definitions
|
||||
|
||||
external string selectedSourceFile();
|
||||
|
||||
cached File getEncodedFile(string name) {
|
||||
result.getAbsolutePath().replaceAll(":", "_") = name
|
||||
}
|
||||
|
||||
|
||||
|
||||
from Top e, Top def, string kind
|
||||
where def = definitionOf(e, kind) and e.getFile() = getEncodedFile(selectedSourceFile())
|
||||
select e, def, kind
|
||||
21
cpp/ql/src/localReferences.ql
Normal file
21
cpp/ql/src/localReferences.ql
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @name Jump-to-definition links
|
||||
* @description Generates use-definition pairs that provide the data
|
||||
* for jump-to-definition in the code viewer.
|
||||
* @kind definitions
|
||||
* @id cpp/jump-to-definition
|
||||
*/
|
||||
|
||||
import definitions
|
||||
|
||||
external string selectedSourceFile();
|
||||
|
||||
cached File getEncodedFile(string name) {
|
||||
result.getAbsolutePath().replaceAll(":", "_") = name
|
||||
}
|
||||
|
||||
|
||||
|
||||
from Top e, Top def, string kind
|
||||
where def = definitionOf(e, kind) and def.getFile() = getEncodedFile(selectedSourceFile())
|
||||
select e, def, kind
|
||||
Reference in New Issue
Block a user