From 53744407ad389a0d5aa295b7843a3015b069fc8e Mon Sep 17 00:00:00 2001 From: Arthur Baars Date: Fri, 18 Oct 2024 15:57:35 +0200 Subject: [PATCH 1/3] Rust: add localDefinitions.ql --- .../localDefinitions.ql | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 rust/ql/lib/ide-contextual-queries/localDefinitions.ql diff --git a/rust/ql/lib/ide-contextual-queries/localDefinitions.ql b/rust/ql/lib/ide-contextual-queries/localDefinitions.ql new file mode 100644 index 000000000000..5c2cb01f178c --- /dev/null +++ b/rust/ql/lib/ide-contextual-queries/localDefinitions.ql @@ -0,0 +1,23 @@ +/** + * @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 rus/ide-jump-to-definition + * @tags ide-contextual-queries/local-definitions + */ + +import codeql.IDEContextual +import codeql.rust.elements.Variable +import codeql.rust.elements.Locatable + +external string selectedSourceFile(); + +predicate localVariable(Locatable e, Variable def) { e = def.getAnAccess() } + +from Locatable e, Variable def, string kind +where + e.getLocation().getFile() = getFileBySourceArchiveName(selectedSourceFile()) and + localVariable(e, def) and + kind = "local variable" +select e, def, kind From c9372b91f82d7e8d2ce584807d4b1d594525bd2e Mon Sep 17 00:00:00 2001 From: Arthur Baars Date: Fri, 18 Oct 2024 15:58:31 +0200 Subject: [PATCH 2/3] Rust: move ide-contextual-queries to the library pack --- rust/ql/{src/queries => lib}/ide-contextual-queries/printAst.ql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename rust/ql/{src/queries => lib}/ide-contextual-queries/printAst.ql (100%) diff --git a/rust/ql/src/queries/ide-contextual-queries/printAst.ql b/rust/ql/lib/ide-contextual-queries/printAst.ql similarity index 100% rename from rust/ql/src/queries/ide-contextual-queries/printAst.ql rename to rust/ql/lib/ide-contextual-queries/printAst.ql From 4a5a48a5b630d4548b356f68e8b921e6fdd408f2 Mon Sep 17 00:00:00 2001 From: Arthur Baars Date: Fri, 18 Oct 2024 16:02:57 +0200 Subject: [PATCH 3/3] Rust: move PrintCfg to ide-contextual-queries --- .../controlflow/internal => ide-contextual-queries}/PrintCfg.ql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename rust/ql/lib/{codeql/rust/controlflow/internal => ide-contextual-queries}/PrintCfg.ql (100%) diff --git a/rust/ql/lib/codeql/rust/controlflow/internal/PrintCfg.ql b/rust/ql/lib/ide-contextual-queries/PrintCfg.ql similarity index 100% rename from rust/ql/lib/codeql/rust/controlflow/internal/PrintCfg.ql rename to rust/ql/lib/ide-contextual-queries/PrintCfg.ql