diff --git a/ql/ql/src/codeql/Locations.qll b/ql/ql/src/codeql/Locations.qll index ae8058c916d..e03c84f98fa 100644 --- a/ql/ql/src/codeql/Locations.qll +++ b/ql/ql/src/codeql/Locations.qll @@ -1,4 +1,6 @@ /** Provides classes for working with locations. */ +overlay[local] +module; import files.FileSystem diff --git a/ql/ql/src/codeql/files/FileSystem.qll b/ql/ql/src/codeql/files/FileSystem.qll index 5a219f3b7f0..52174250af0 100644 --- a/ql/ql/src/codeql/files/FileSystem.qll +++ b/ql/ql/src/codeql/files/FileSystem.qll @@ -1,4 +1,6 @@ /** Provides classes for working with files and folders. */ +overlay[local?] +module; private import codeql_ql.ast.internal.TreeSitter private import codeql.Locations diff --git a/ql/ql/src/codeql_ql/StructuredLogs.qll b/ql/ql/src/codeql_ql/StructuredLogs.qll index 4c0ef69fd55..87527eae1d2 100644 --- a/ql/ql/src/codeql_ql/StructuredLogs.qll +++ b/ql/ql/src/codeql_ql/StructuredLogs.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import ql private import codeql_ql.ast.internal.TreeSitter private import experimental.RA @@ -23,6 +26,7 @@ private float stringToTimestamp(string str) { } bindingset[s] +overlay[global] private Predicate getPredicateFromPosition(string s) { exists(string r, string filepath, int startline | r = "(.*):(\\d+),(\\d+)-(\\d+),(\\d+)" | filepath = s.regexpCapture(r, 1) and @@ -397,6 +401,7 @@ module KindPredicatesLog { string getPosition() { result = this.getString("position") } + overlay[global] Predicate getPredicate() { result = getPredicateFromPosition(this.getPosition()) } /** diff --git a/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll b/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll index 2d4a9d65465..c81830e1d59 100644 --- a/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll +++ b/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll @@ -23,6 +23,7 @@ private predicate discardLocation(@location_default loc) { ) } +overlay[local] module QL { /** The base class for all AST nodes */ class AstNode extends @ql_ast_node { @@ -67,7 +68,6 @@ module QL { } /** Gets the file containing the given `node`. */ - overlay[local] private @file getNodeFile(@ql_ast_node node) { exists(@location_default loc | ql_ast_node_location(node, loc) | locations_default(loc, result, _, _, _, _) @@ -75,7 +75,6 @@ module QL { } /** Holds if `node` is in the `file` and is part of the overlay base database. */ - overlay[local] private predicate discardableAstNode(@file file, @ql_ast_node node) { not isOverlay() and file = getNodeFile(node) } @@ -1315,6 +1314,7 @@ module QL { } } +overlay[local] module Dbscheme { /** The base class for all AST nodes */ class AstNode extends @dbscheme_ast_node { @@ -1359,7 +1359,6 @@ module Dbscheme { } /** Gets the file containing the given `node`. */ - overlay[local] private @file getNodeFile(@dbscheme_ast_node node) { exists(@location_default loc | dbscheme_ast_node_location(node, loc) | locations_default(loc, result, _, _, _, _) @@ -1367,7 +1366,6 @@ module Dbscheme { } /** Holds if `node` is in the `file` and is part of the overlay base database. */ - overlay[local] private predicate discardableAstNode(@file file, @dbscheme_ast_node node) { not isOverlay() and file = getNodeFile(node) } @@ -1673,6 +1671,7 @@ module Dbscheme { } } +overlay[local] module Blame { /** The base class for all AST nodes */ class AstNode extends @blame_ast_node { @@ -1717,7 +1716,6 @@ module Blame { } /** Gets the file containing the given `node`. */ - overlay[local] private @file getNodeFile(@blame_ast_node node) { exists(@location_default loc | blame_ast_node_location(node, loc) | locations_default(loc, result, _, _, _, _) @@ -1725,7 +1723,6 @@ module Blame { } /** Holds if `node` is in the `file` and is part of the overlay base database. */ - overlay[local] private predicate discardableAstNode(@file file, @blame_ast_node node) { not isOverlay() and file = getNodeFile(node) } @@ -1808,6 +1805,7 @@ module Blame { } } +overlay[local] module JSON { /** The base class for all AST nodes */ class AstNode extends @json_ast_node { @@ -1852,7 +1850,6 @@ module JSON { } /** Gets the file containing the given `node`. */ - overlay[local] private @file getNodeFile(@json_ast_node node) { exists(@location_default loc | json_ast_node_location(node, loc) | locations_default(loc, result, _, _, _, _) @@ -1860,7 +1857,6 @@ module JSON { } /** Holds if `node` is in the `file` and is part of the overlay base database. */ - overlay[local] private predicate discardableAstNode(@file file, @json_ast_node node) { not isOverlay() and file = getNodeFile(node) } diff --git a/ql/ql/src/experimental/RA.qll b/ql/ql/src/experimental/RA.qll index 7187ebfc8c7..5eb80455562 100644 --- a/ql/ql/src/experimental/RA.qll +++ b/ql/ql/src/experimental/RA.qll @@ -1,6 +1,5 @@ -/** - * Parses RA expressions. - */ +overlay[local] +module; /** * A predicate that contains RA. diff --git a/ql/ql/src/queries/performance/LargeTupleSum.ql b/ql/ql/src/queries/performance/LargeTupleSum.ql index e5bbed79bbd..4e5ca6622e8 100644 --- a/ql/ql/src/queries/performance/LargeTupleSum.ql +++ b/ql/ql/src/queries/performance/LargeTupleSum.ql @@ -6,6 +6,7 @@ import ql import codeql_ql.StructuredLogs import KindPredicatesLog +overlay[local] module SumCounts implements Fold { int base(PipeLineRun run) { result = sum(int i | | run.getCount(i)) } diff --git a/ql/ql/test/experimental/raparser.ql b/ql/ql/test/experimental/raparser.ql index 29489e2a968..5704b0facdb 100644 --- a/ql/ql/test/experimental/raparser.ql +++ b/ql/ql/test/experimental/raparser.ql @@ -1,5 +1,6 @@ import experimental.RA +overlay[local] class TestPredicate extends string { TestPredicate() { this = "p1" } diff --git a/ruby/ql/lib/codeql/Locations.qll b/ruby/ql/lib/codeql/Locations.qll index 148c6b01f2d..df52d6822a2 100644 --- a/ruby/ql/lib/codeql/Locations.qll +++ b/ruby/ql/lib/codeql/Locations.qll @@ -1,4 +1,6 @@ /** Provides classes for working with locations. */ +overlay[local] +module; import files.FileSystem diff --git a/ruby/ql/lib/codeql/files/FileSystem.qll b/ruby/ql/lib/codeql/files/FileSystem.qll index 528dde52fd9..6cc771fad9d 100644 --- a/ruby/ql/lib/codeql/files/FileSystem.qll +++ b/ruby/ql/lib/codeql/files/FileSystem.qll @@ -1,4 +1,6 @@ /** Provides classes for working with files and folders. */ +overlay[local] +module; private import codeql.Locations private import codeql.util.FileSystem diff --git a/ruby/ql/lib/codeql/ruby/AST.qll b/ruby/ql/lib/codeql/ruby/AST.qll index bd42696a8db..2c2dbdfa532 100644 --- a/ruby/ql/lib/codeql/ruby/AST.qll +++ b/ruby/ql/lib/codeql/ruby/AST.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + import codeql.Locations import ast.Call import ast.Control diff --git a/ruby/ql/lib/codeql/ruby/Diagnostics.qll b/ruby/ql/lib/codeql/ruby/Diagnostics.qll index 58de14b8fcf..5b55eec3809 100644 --- a/ruby/ql/lib/codeql/ruby/Diagnostics.qll +++ b/ruby/ql/lib/codeql/ruby/Diagnostics.qll @@ -1,4 +1,6 @@ /** Provides classes relating to extraction diagnostics. */ +overlay[local] +module; private import codeql.Locations diff --git a/ruby/ql/lib/codeql/ruby/ast/Call.qll b/ruby/ql/lib/codeql/ruby/ast/Call.qll index 8a69ebd36fb..3a82d0d39b3 100644 --- a/ruby/ql/lib/codeql/ruby/ast/Call.qll +++ b/ruby/ql/lib/codeql/ruby/ast/Call.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import internal.AST private import internal.Call @@ -52,6 +55,7 @@ class Call extends Expr instanceof CallImpl { final int getNumberOfArguments() { result = super.getNumberOfArgumentsImpl() } /** Gets a potential target of this call, if any. */ + overlay[global] final Callable getATarget() { exists(DataFlowCall c | this = c.asCall().getExpr() and @@ -153,6 +157,7 @@ class MethodCall extends Call instanceof MethodCallImpl { * TODO: When API Graphs is able to resolve calls to methods like `Kernel.send` * this class is no longer necessary and should be removed. */ +overlay[global] class UnknownMethodCall extends MethodCall { UnknownMethodCall() { not exists(this.(Call).getATarget()) } } diff --git a/ruby/ql/lib/codeql/ruby/ast/Constant.qll b/ruby/ql/lib/codeql/ruby/ast/Constant.qll index fef057bc88e..9c7ac62e542 100644 --- a/ruby/ql/lib/codeql/ruby/ast/Constant.qll +++ b/ruby/ql/lib/codeql/ruby/ast/Constant.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import internal.AST private import internal.Constant diff --git a/ruby/ql/lib/codeql/ruby/ast/Control.qll b/ruby/ql/lib/codeql/ruby/ast/Control.qll index 18182d8268a..5d83e7a62fd 100644 --- a/ruby/ql/lib/codeql/ruby/ast/Control.qll +++ b/ruby/ql/lib/codeql/ruby/ast/Control.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import internal.AST private import internal.Control diff --git a/ruby/ql/lib/codeql/ruby/ast/Erb.qll b/ruby/ql/lib/codeql/ruby/ast/Erb.qll index 4dbcca73425..4def19f7ceb 100644 --- a/ruby/ql/lib/codeql/ruby/ast/Erb.qll +++ b/ruby/ql/lib/codeql/ruby/ast/Erb.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import internal.Erb private import internal.TreeSitter diff --git a/ruby/ql/lib/codeql/ruby/ast/Expr.qll b/ruby/ql/lib/codeql/ruby/ast/Expr.qll index 5f916fbec5c..8ab203aed87 100644 --- a/ruby/ql/lib/codeql/ruby/ast/Expr.qll +++ b/ruby/ql/lib/codeql/ruby/ast/Expr.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import codeql.ruby.CFG private import internal.AST diff --git a/ruby/ql/lib/codeql/ruby/ast/Literal.qll b/ruby/ql/lib/codeql/ruby/ast/Literal.qll index cdeae9e64a6..a32ca16e24c 100644 --- a/ruby/ql/lib/codeql/ruby/ast/Literal.qll +++ b/ruby/ql/lib/codeql/ruby/ast/Literal.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import codeql.ruby.Regexp as RE private import internal.AST @@ -387,6 +390,7 @@ class RegExpLiteral extends StringlikeLiteral instanceof RegExpLiteralImpl { final predicate hasFreeSpacingFlag() { this.getFlagString().charAt(_) = "x" } /** Returns the root node of the parse tree of this regular expression. */ + overlay[global] final RE::RegExpTerm getParsed() { result = RE::getParsedRegExp(this) } } diff --git a/ruby/ql/lib/codeql/ruby/ast/Method.qll b/ruby/ql/lib/codeql/ruby/ast/Method.qll index 61ee58019d1..60c0c705b31 100644 --- a/ruby/ql/lib/codeql/ruby/ast/Method.qll +++ b/ruby/ql/lib/codeql/ruby/ast/Method.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import codeql.ruby.controlflow.ControlFlowGraph private import internal.AST diff --git a/ruby/ql/lib/codeql/ruby/ast/Module.qll b/ruby/ql/lib/codeql/ruby/ast/Module.qll index 9e2ca31ee61..671910bfaef 100644 --- a/ruby/ql/lib/codeql/ruby/ast/Module.qll +++ b/ruby/ql/lib/codeql/ruby/ast/Module.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import codeql.ruby.CFG private import internal.AST diff --git a/ruby/ql/lib/codeql/ruby/ast/Operation.qll b/ruby/ql/lib/codeql/ruby/ast/Operation.qll index 2e005a207e3..b9046a930b3 100644 --- a/ruby/ql/lib/codeql/ruby/ast/Operation.qll +++ b/ruby/ql/lib/codeql/ruby/ast/Operation.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import internal.AST private import internal.TreeSitter diff --git a/ruby/ql/lib/codeql/ruby/ast/Parameter.qll b/ruby/ql/lib/codeql/ruby/ast/Parameter.qll index c4b233b62b6..5b3994378c1 100644 --- a/ruby/ql/lib/codeql/ruby/ast/Parameter.qll +++ b/ruby/ql/lib/codeql/ruby/ast/Parameter.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import internal.AST private import internal.Variable diff --git a/ruby/ql/lib/codeql/ruby/ast/Pattern.qll b/ruby/ql/lib/codeql/ruby/ast/Pattern.qll index ef778664031..f705bf28301 100644 --- a/ruby/ql/lib/codeql/ruby/ast/Pattern.qll +++ b/ruby/ql/lib/codeql/ruby/ast/Pattern.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import internal.AST private import internal.Pattern diff --git a/ruby/ql/lib/codeql/ruby/ast/Scope.qll b/ruby/ql/lib/codeql/ruby/ast/Scope.qll index 3e8437f79b3..334b36b583f 100644 --- a/ruby/ql/lib/codeql/ruby/ast/Scope.qll +++ b/ruby/ql/lib/codeql/ruby/ast/Scope.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import internal.AST private import internal.Scope diff --git a/ruby/ql/lib/codeql/ruby/ast/Statement.qll b/ruby/ql/lib/codeql/ruby/ast/Statement.qll index 24e18fe4c36..dcd51dbb327 100644 --- a/ruby/ql/lib/codeql/ruby/ast/Statement.qll +++ b/ruby/ql/lib/codeql/ruby/ast/Statement.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import codeql.ruby.CFG private import internal.AST diff --git a/ruby/ql/lib/codeql/ruby/ast/Variable.qll b/ruby/ql/lib/codeql/ruby/ast/Variable.qll index fa00cfb4cc7..f5fb4b60604 100644 --- a/ruby/ql/lib/codeql/ruby/ast/Variable.qll +++ b/ruby/ql/lib/codeql/ruby/ast/Variable.qll @@ -1,4 +1,6 @@ /** Provides classes for modeling program variables. */ +overlay[local] +module; private import codeql.ruby.AST private import internal.AST diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/AST.qll b/ruby/ql/lib/codeql/ruby/ast/internal/AST.qll index badcf1d6c6f..ee46fbe8b66 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/AST.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/AST.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + import codeql.Locations private import TreeSitter private import codeql.ruby.ast.internal.Call diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/Call.qll b/ruby/ql/lib/codeql/ruby/ast/internal/Call.qll index 5bb34989a90..4f3c236f102 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/Call.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/Call.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import TreeSitter private import Variable private import codeql.ruby.AST diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/Constant.qll b/ruby/ql/lib/codeql/ruby/ast/internal/Constant.qll index a04efc1ec94..133cea315c3 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/Constant.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/Constant.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import codeql.ruby.ast.internal.AST private import codeql.ruby.ast.internal.Literal diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/Control.qll b/ruby/ql/lib/codeql/ruby/ast/internal/Control.qll index 7b95d67efc4..dd57a0d197d 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/Control.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/Control.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import TreeSitter private import codeql.ruby.AST private import codeql.ruby.ast.internal.AST diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/Erb.qll b/ruby/ql/lib/codeql/ruby/ast/internal/Erb.qll index 7a69bf5b783..29960486907 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/Erb.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/Erb.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + import codeql.Locations private import TreeSitter private import codeql.ruby.ast.Erb diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/Expr.qll b/ruby/ql/lib/codeql/ruby/ast/internal/Expr.qll index ba4f9e51f4e..fdeec446a93 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/Expr.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/Expr.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import codeql.ruby.CFG private import AST diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/Literal.qll b/ruby/ql/lib/codeql/ruby/ast/internal/Literal.qll index 8af4673d916..6a2df06b349 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/Literal.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/Literal.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import AST private import Constant diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/Method.qll b/ruby/ql/lib/codeql/ruby/ast/internal/Method.qll index 075ac5fb8fa..c4dd1abbee0 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/Method.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/Method.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import AST private import TreeSitter diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/Module.qll b/ruby/ql/lib/codeql/ruby/ast/internal/Module.qll index 6905dd5ff2d..d222316bf26 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/Module.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/Module.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import Scope as Scope diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/Operation.qll b/ruby/ql/lib/codeql/ruby/ast/internal/Operation.qll index 54c763e24d3..eeec2198b62 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/Operation.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/Operation.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import AST private import TreeSitter diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/Parameter.qll b/ruby/ql/lib/codeql/ruby/ast/internal/Parameter.qll index dc7fb8c7695..8f07554fb0c 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/Parameter.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/Parameter.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import AST private import TreeSitter diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/Pattern.qll b/ruby/ql/lib/codeql/ruby/ast/internal/Pattern.qll index c59898d88ee..a30cce32c7c 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/Pattern.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/Pattern.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.AST private import codeql.ruby.ast.internal.Expr private import codeql.ruby.ast.internal.Parameter diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/Scope.qll b/ruby/ql/lib/codeql/ruby/ast/internal/Scope.qll index 8f5bde5aeec..9ec237012bc 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/Scope.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/Scope.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import TreeSitter private import codeql.ruby.AST private import codeql.ruby.ast.internal.AST diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/Synthesis.qll b/ruby/ql/lib/codeql/ruby/ast/internal/Synthesis.qll index 5d1ee81c013..f2be91a63e5 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/Synthesis.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/Synthesis.qll @@ -1,4 +1,6 @@ /** Provides predicates for synthesizing AST nodes. */ +overlay[local] +module; private import AST private import TreeSitter diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll b/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll index 4d9cd901f23..dbc7b38b84e 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll @@ -23,6 +23,7 @@ private predicate discardLocation(@location_default loc) { ) } +overlay[local] module Ruby { /** The base class for all AST nodes */ class AstNode extends @ruby_ast_node { @@ -67,7 +68,6 @@ module Ruby { } /** Gets the file containing the given `node`. */ - overlay[local] private @file getNodeFile(@ruby_ast_node node) { exists(@location_default loc | ruby_ast_node_location(node, loc) | locations_default(loc, result, _, _, _, _) @@ -75,7 +75,6 @@ module Ruby { } /** Holds if `node` is in the `file` and is part of the overlay base database. */ - overlay[local] private predicate discardableAstNode(@file file, @ruby_ast_node node) { not isOverlay() and file = getNodeFile(node) } @@ -1967,6 +1966,7 @@ module Ruby { } } +overlay[local] module Erb { /** The base class for all AST nodes */ class AstNode extends @erb_ast_node { @@ -2011,7 +2011,6 @@ module Erb { } /** Gets the file containing the given `node`. */ - overlay[local] private @file getNodeFile(@erb_ast_node node) { exists(@location_default loc | erb_ast_node_location(node, loc) | locations_default(loc, result, _, _, _, _) @@ -2019,7 +2018,6 @@ module Erb { } /** Holds if `node` is in the `file` and is part of the overlay base database. */ - overlay[local] private predicate discardableAstNode(@file file, @erb_ast_node node) { not isOverlay() and file = getNodeFile(node) } diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/Variable.qll b/ruby/ql/lib/codeql/ruby/ast/internal/Variable.qll index bea1ddadbfb..7c130220a86 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/Variable.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/Variable.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import TreeSitter private import codeql.ruby.AST private import codeql.ruby.CFG diff --git a/ruby/ql/lib/codeql/ruby/controlflow/BasicBlocks.qll b/ruby/ql/lib/codeql/ruby/controlflow/BasicBlocks.qll index f70062ad24f..93253371198 100644 --- a/ruby/ql/lib/codeql/ruby/controlflow/BasicBlocks.qll +++ b/ruby/ql/lib/codeql/ruby/controlflow/BasicBlocks.qll @@ -1,4 +1,6 @@ /** Provides classes representing basic blocks. */ +overlay[local] +module; private import codeql.ruby.AST private import codeql.ruby.ast.internal.AST diff --git a/ruby/ql/lib/codeql/ruby/controlflow/CfgNodes.qll b/ruby/ql/lib/codeql/ruby/controlflow/CfgNodes.qll index c822450bf89..16d0a69fcc3 100644 --- a/ruby/ql/lib/codeql/ruby/controlflow/CfgNodes.qll +++ b/ruby/ql/lib/codeql/ruby/controlflow/CfgNodes.qll @@ -1,4 +1,6 @@ /** Provides classes representing nodes in a control flow graph. */ +overlay[local] +module; private import codeql.ruby.AST private import codeql.ruby.controlflow.BasicBlocks diff --git a/ruby/ql/lib/codeql/ruby/controlflow/ControlFlowGraph.qll b/ruby/ql/lib/codeql/ruby/controlflow/ControlFlowGraph.qll index dee31d8e901..f3c5dcd08f3 100644 --- a/ruby/ql/lib/codeql/ruby/controlflow/ControlFlowGraph.qll +++ b/ruby/ql/lib/codeql/ruby/controlflow/ControlFlowGraph.qll @@ -1,4 +1,6 @@ /** Provides classes representing the control flow graph. */ +overlay[local] +module; private import codeql.ruby.AST private import codeql.ruby.controlflow.BasicBlocks diff --git a/ruby/ql/lib/codeql/ruby/controlflow/internal/Completion.qll b/ruby/ql/lib/codeql/ruby/controlflow/internal/Completion.qll index 83ea11e9d23..b8edf83c20d 100644 --- a/ruby/ql/lib/codeql/ruby/controlflow/internal/Completion.qll +++ b/ruby/ql/lib/codeql/ruby/controlflow/internal/Completion.qll @@ -3,6 +3,8 @@ * * A completion represents how a statement or expression terminates. */ +overlay[local] +module; private import codeql.ruby.AST private import codeql.ruby.ast.internal.AST diff --git a/ruby/ql/lib/codeql/ruby/controlflow/internal/ControlFlowGraphImpl.qll b/ruby/ql/lib/codeql/ruby/controlflow/internal/ControlFlowGraphImpl.qll index dd672ba982d..d0d418a839f 100644 --- a/ruby/ql/lib/codeql/ruby/controlflow/internal/ControlFlowGraphImpl.qll +++ b/ruby/ql/lib/codeql/ruby/controlflow/internal/ControlFlowGraphImpl.qll @@ -2,6 +2,8 @@ * Provides an implementation for constructing control-flow graphs (CFGs) from * abstract syntax trees (ASTs), using the shared library from `codeql.controlflow.Cfg`. */ +overlay[local] +module; private import codeql.controlflow.Cfg as CfgShared private import codeql.ruby.AST diff --git a/ruby/ql/lib/codeql/ruby/controlflow/internal/Guards.qll b/ruby/ql/lib/codeql/ruby/controlflow/internal/Guards.qll index 1161a061581..a60102e017c 100644 --- a/ruby/ql/lib/codeql/ruby/controlflow/internal/Guards.qll +++ b/ruby/ql/lib/codeql/ruby/controlflow/internal/Guards.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ruby.CFG /** Holds if the guard `guard` controls block `bb` upon evaluating to `branch`. */ diff --git a/ruby/ql/lib/codeql/ruby/controlflow/internal/NonReturning.qll b/ruby/ql/lib/codeql/ruby/controlflow/internal/NonReturning.qll index e1927a0b1c9..45b299a5d2b 100644 --- a/ruby/ql/lib/codeql/ruby/controlflow/internal/NonReturning.qll +++ b/ruby/ql/lib/codeql/ruby/controlflow/internal/NonReturning.qll @@ -1,4 +1,6 @@ /** Provides a simple analysis for identifying calls that will not return. */ +overlay[local] +module; private import codeql.ruby.AST private import Completion diff --git a/ruby/ql/lib/codeql/ruby/controlflow/internal/Splitting.qll b/ruby/ql/lib/codeql/ruby/controlflow/internal/Splitting.qll index 5331a3d26b6..146d5927479 100644 --- a/ruby/ql/lib/codeql/ruby/controlflow/internal/Splitting.qll +++ b/ruby/ql/lib/codeql/ruby/controlflow/internal/Splitting.qll @@ -1,6 +1,8 @@ /** * Provides classes and predicates relevant for splitting the control flow graph. */ +overlay[local] +module; private import codeql.ruby.AST as Ast private import Completion as Comp diff --git a/ruby/ql/lib/codeql/ruby/dataflow/SSA.qll b/ruby/ql/lib/codeql/ruby/dataflow/SSA.qll index 07721d33334..1478d9ed9d6 100644 --- a/ruby/ql/lib/codeql/ruby/dataflow/SSA.qll +++ b/ruby/ql/lib/codeql/ruby/dataflow/SSA.qll @@ -1,6 +1,8 @@ /** * Provides the module `Ssa` for working with static single assignment (SSA) form. */ +overlay[local] +module; /** * Provides classes for working with static single assignment (SSA) form. diff --git a/ruby/ql/lib/codeql/ruby/dataflow/internal/SsaImpl.qll b/ruby/ql/lib/codeql/ruby/dataflow/internal/SsaImpl.qll index adbec18be64..3e1d27a17ba 100644 --- a/ruby/ql/lib/codeql/ruby/dataflow/internal/SsaImpl.qll +++ b/ruby/ql/lib/codeql/ruby/dataflow/internal/SsaImpl.qll @@ -1,3 +1,6 @@ +overlay[local] +module; + private import codeql.ssa.Ssa as SsaImplCommon private import codeql.ruby.AST private import codeql.ruby.CFG as Cfg @@ -393,6 +396,7 @@ private module Cached { signature predicate guardChecksSig(Cfg::CfgNodes::AstCfgNode g, Cfg::CfgNode e, boolean branch); + overlay[global] cached // nothing is actually cached module BarrierGuard { private predicate guardChecksAdjTypes( diff --git a/shared/tree-sitter-extractor/src/generator/mod.rs b/shared/tree-sitter-extractor/src/generator/mod.rs index d9e6e00a121..5e58611092b 100644 --- a/shared/tree-sitter-extractor/src/generator/mod.rs +++ b/shared/tree-sitter-extractor/src/generator/mod.rs @@ -120,6 +120,7 @@ pub fn generate( qldoc: None, name: &language.name, body, + overlay: Some(ql::OverlayAnnotation::Local), })], )?; } diff --git a/shared/tree-sitter-extractor/src/generator/ql.rs b/shared/tree-sitter-extractor/src/generator/ql.rs index e4c87b61bdb..b1e319afb1e 100644 --- a/shared/tree-sitter-extractor/src/generator/ql.rs +++ b/shared/tree-sitter-extractor/src/generator/ql.rs @@ -95,6 +95,7 @@ pub struct Module<'a> { pub qldoc: Option, pub name: &'a str, pub body: Vec>, + pub overlay: Option, } impl fmt::Display for Module<'_> { @@ -102,6 +103,14 @@ impl fmt::Display for Module<'_> { if let Some(qldoc) = &self.qldoc { write!(f, "/** {} */", qldoc)?; } + if let Some(overlay_annotation) = &self.overlay { + write!(f, "overlay[")?; + match overlay_annotation { + OverlayAnnotation::Local => write!(f, "local")?, + OverlayAnnotation::DiscardEntity => write!(f, "discard_entity")?, + } + write!(f, "] ")?; + } writeln!(f, "module {} {{ ", self.name)?; for decl in &self.body { writeln!(f, " {}", decl)?; diff --git a/shared/tree-sitter-extractor/src/generator/ql_gen.rs b/shared/tree-sitter-extractor/src/generator/ql_gen.rs index 8b6c9c18c6f..2cfaf5715ca 100644 --- a/shared/tree-sitter-extractor/src/generator/ql_gen.rs +++ b/shared/tree-sitter-extractor/src/generator/ql_gen.rs @@ -286,7 +286,7 @@ pub fn create_get_node_file_predicate<'a>( overridden: false, is_private: true, is_final: false, - overlay: Some(ql::OverlayAnnotation::Local), + overlay: None, return_type: Some(ql::Type::At("file")), formal_parameters: vec![ql::FormalParameter { name: "node", @@ -327,7 +327,7 @@ pub fn create_discardable_ast_node_predicate(ast_node_name: &str) -> ql::Predica overridden: false, is_private: true, is_final: false, - overlay: Some(ql::OverlayAnnotation::Local), + overlay: None, return_type: None, formal_parameters: vec![ ql::FormalParameter {