Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
200 commits
Select commit Hold shift + click to select a range
ec81539
Test flow out of varargs parameter in source function
owen-mc Feb 4, 2026
d6c8767
Test flow out of varargs parameter in function model
owen-mc Feb 4, 2026
4b830c1
Test varargs flow with models-as-data
owen-mc Feb 4, 2026
7632bdb
(Misc) fix variable names
owen-mc Feb 4, 2026
408ba2e
(Misc) Delete spuriously committed binary file
owen-mc Feb 4, 2026
57ce0b3
Accept data flow consistency result
owen-mc Feb 5, 2026
26dca55
Initial plan
Copilot May 6, 2026
f5b17b0
Add SSRF tests and stubs for Apache Http fluent Request models
Copilot May 6, 2026
043ec85
Replace fluent SSRF changes with Apache HttpClient execute model tests
Copilot May 6, 2026
dd35bc0
Update test output
owen-mc May 7, 2026
dc86476
Add change note
owen-mc May 7, 2026
71cd5be
Python: Add self-validating CFG tests
tausbn Apr 28, 2026
3a979ac
Python: Add some CFG-validation queries
tausbn Apr 28, 2026
fc2bc26
Python: Add BasicBlockOrdering test
tausbn Apr 28, 2026
c30d6ae
Python: Add NeverReachable test
tausbn Apr 28, 2026
f5c3b63
Python: Add ConsecutiveTimestamps test
tausbn Apr 28, 2026
9dddd93
unified: add field declarations for statements and members
tausbn May 8, 2026
75c0799
unified: regenerate files
tausbn May 8, 2026
c75d819
unified: Add `effect` field
tausbn May 12, 2026
d6ef467
unified: Add more fields
tausbn May 12, 2026
853a988
unified: Regenerate files
tausbn May 12, 2026
732cc7b
unified: Add fields to inheritance specifiers and calls
tausbn May 12, 2026
0499932
unified: Fix fields in await_expression
tausbn May 12, 2026
15d84b3
unified: More $children fixes
tausbn May 12, 2026
bc96ae6
unified: Add `lambda` and `arguments` fields
tausbn May 12, 2026
5784ef2
unified: Unify more fields
tausbn May 12, 2026
e6eac37
unified: Consolidate fields in `if_let_binding`
tausbn May 12, 2026
9902bed
unified: add proper fields for availability_condition
tausbn May 12, 2026
6ff404a
unified: More miscellaneous field additions
tausbn May 12, 2026
5e14a75
unified: make compilation_condition named and add fields
tausbn May 12, 2026
e1a0e20
unified: Promote enum_type_parameter to named and add fields
tausbn May 12, 2026
eba9f35
unified: Get rid of $children* on key_path_expression
tausbn May 12, 2026
6e5e650
unified: Add fields for macro_declaration
tausbn May 12, 2026
406a02f
unified: Add fields to switch_entry
tausbn May 12, 2026
2010844
unified: Add fields to property_declaration
tausbn May 12, 2026
2eee2e5
unified: clean up patterns
tausbn May 12, 2026
1ef557c
Python: Address Copilot's comments
tausbn May 12, 2026
eb480d1
unified: Make parenthesized_type named
tausbn May 12, 2026
52d7283
unified: Fix multiline_comment issue
tausbn May 12, 2026
bfe5aa8
unified: Regenerate files
tausbn May 12, 2026
f668b99
Unified: Add support for tree-sitter-style corpus tests
asgerf May 7, 2026
49f1909
Yeast: add reachable_node_ids()
asgerf May 7, 2026
a049850
Yeast: add type-checking errors in AST dump
asgerf May 7, 2026
c3a9218
Yeast: Add one-shot phase kind
asgerf May 8, 2026
bb9e996
Shared: Do not emit ReservedWord class when there are no unnamed tokens
asgerf May 7, 2026
5d0cb9e
YEAST: fix one-shot rules for unnamed nodes and self-captures
asgerf May 12, 2026
8a2a48d
Unified extractor: add AST schema, swift translation rules, and corpu…
asgerf May 12, 2026
72b683d
Unified: Add Swift corpus tests
asgerf May 12, 2026
5772ee4
YEAST: add NodeRef type, YeastDisplay trait, and source text storage
asgerf May 12, 2026
9283801
Unified: Add some more AST nodes and rules
asgerf May 11, 2026
2307839
Yeast: Change how patterns with repetition are parsed
asgerf May 11, 2026
6b58482
Yeast: Fix text associated with synthesized nodes
asgerf May 11, 2026
a966dff
Unified: Add more patterns and some fixes to the AST
asgerf May 11, 2026
ccc1dd5
Unified: Add tuple_pattern
asgerf May 11, 2026
3b7a53f
yeast-macros: merge repeated field declarations and support repetitio…
asgerf May 11, 2026
cbe4c81
Unified: add tuple_pattern and sequence_condition; refine if-let/guar…
asgerf May 11, 2026
55194dd
Unified: Support for calls and member access
asgerf May 11, 2026
600a496
Unified: Simplify concatenation of arguments
asgerf May 12, 2026
7fa6c4e
Unified: Update test output after rebasing on grammar changes
asgerf May 13, 2026
b031e5b
Unified: regenerate QL and make tests not crash
asgerf May 13, 2026
554bdf1
Yeast: fix warning about unnecessary mutability
asgerf May 13, 2026
5d6dc5c
unified: Clean up statements/block mess
tausbn May 13, 2026
ea6f3a9
unified: Encapsulate function parameters
tausbn May 13, 2026
c8f7c3d
unified: Group more paired items
tausbn May 13, 2026
9787a8b
unified: Group enum entries
tausbn May 13, 2026
caef72b
unified: Introduced named `property_binding` node
tausbn May 13, 2026
f4f85b5
unified: Remove some pointless fields
tausbn May 13, 2026
dd9c066
unified: Regenerate files
tausbn May 13, 2026
cb0fc78
Ruby: Minor cleanup, Callable is a StmtSequence.
aschackmull May 18, 2026
42aaae7
C#: Add test case for property calls and update test expected for oth…
michaelnebel May 19, 2026
a2ac0ab
C#: Add test case for indexer calls and update test expected for othe…
michaelnebel May 19, 2026
9d0d4e4
C#: Add ref return info for accessors.
michaelnebel May 19, 2026
c3bb5e8
C#: Use ref return getters for properties/indexers in write contexts.
michaelnebel May 19, 2026
1c01bb3
C#: Update test expected output.
michaelnebel May 19, 2026
c0273ae
C#: Update other affected tests (including database quality).
michaelnebel May 19, 2026
6825ccc
C#: Add change-note.
michaelnebel May 19, 2026
b6c2915
Ruby: Split callable and its body into two AST nodes.
aschackmull May 19, 2026
7dcd2d6
Ruby: Adjust CFG to updated AST.
aschackmull May 21, 2026
3adb704
Ruby: Fix pre-existing bug.
aschackmull May 22, 2026
e07f45f
Ruby: Accept test changes.
aschackmull May 22, 2026
26da373
C#: Update Roslyn and other pinned dependencies.
michaelnebel May 26, 2026
769b195
C#: Update generated files.
michaelnebel May 26, 2026
7f2fb2e
C#: Use the generic version of the associated implementation.
michaelnebel May 26, 2026
fbc861e
unified: Clarify grammar comment
tausbn May 26, 2026
7862922
C++: Remove deprecated code
jketema May 26, 2026
f18cdcf
Merge pull request #21848 from asgerf/asgerf/swift-yeast
asgerf May 26, 2026
3aa6982
Ruby: Skip BodyStmt in ErbDirective.getAChildStmt.
aschackmull May 26, 2026
780591d
Ruby: Remove spurious parent-child edges for Ruby::SimpleSymbol.
aschackmull May 26, 2026
35364a0
C++: Update expected test results after extractor changes
jketema May 27, 2026
362c48c
C++: Add change note
jketema May 27, 2026
e66b1e4
Potential fix for pull request finding
jketema May 27, 2026
b44bca9
Swift: Add HashFunction protocol and other realism to the CryptoKit t…
geoffw0 May 19, 2026
d9c0b9c
Swift: Additional test cases for CryptoKit.
geoffw0 May 26, 2026
98b7659
Swift: Add a special case sink for weak sensitive data hashing sinks …
geoffw0 May 20, 2026
2b4ea18
Swift: Add a similar sink for password hashing as well.
geoffw0 May 26, 2026
c902c75
Swift: Add change note.
geoffw0 May 26, 2026
94e6ec6
Swift: Widen the new sinks to cover more cases the MaD sinks are miss…
geoffw0 May 27, 2026
c6c3e14
Swift: Add a few more test cases for simple missing models.
geoffw0 May 27, 2026
f962eac
Swift: Fill the simple gaps in modelling.
geoffw0 May 26, 2026
42c4d8a
Merge pull request #21897 from jketema/jketema/missing-friend
jketema May 27, 2026
6b55f86
C#: Update integration test expected output.
michaelnebel May 27, 2026
d4c7b5b
C#: Update encoding of SBCS to UTF8 with BOM.
michaelnebel May 27, 2026
7723324
Merge pull request #21896 from jketema/jketema/deprecated
jketema May 27, 2026
d6e7e38
Unified: merge in `main`
tausbn May 27, 2026
41fd59c
Unified: regenerate Ast.qll and dbscheme
tausbn May 27, 2026
5f54a86
C++: Small cleanup. This has no effect on semantics.
MathiasVP May 27, 2026
6042ade
move identical java and cs bound.qll to shared library
BazookaMusic May 27, 2026
acb5c0e
missed changes
BazookaMusic May 27, 2026
35faec3
Python: Address review comments
tausbn May 27, 2026
4fbea4e
Swift: Autoformat.
geoffw0 May 27, 2026
5c2488e
Swift: Fix typo.
geoffw0 May 27, 2026
cc12740
remove check for files in sync
BazookaMusic May 27, 2026
6be9e23
Merge pull request #21841 from github/tausbn/unified-swift-named-body…
asgerf May 27, 2026
ad56ebd
Unified: update test output
asgerf May 27, 2026
313500e
Unified: update test outputs
asgerf May 27, 2026
17fe3e4
Merge pull request #21901 from asgerf/unified-fix-test
asgerf May 27, 2026
3e09961
Shared: Add local name binding library
hvitved May 27, 2026
e061586
Rust: More local variable tests
hvitved May 21, 2026
c08cf81
Rust: Adopt shared local name resolution library
hvitved May 27, 2026
aeb8285
Rust: Run codegen
hvitved May 21, 2026
7718fe4
Ruby: Add more variable tests
hvitved May 27, 2026
a159dc1
Change variable name in test
owen-mc May 28, 2026
37589dd
Improve how `org.apache.http.client.HttpClient` is created in test
owen-mc May 28, 2026
8937e22
Add summary models for `org.apache.http.client.methods.RequestBuilder`
owen-mc May 28, 2026
d95d998
Build `RequestBuilder` more realistically
owen-mc May 28, 2026
ed8b9c2
Merge pull request #21866 from michaelnebel/csharp/refreturnindexerpr…
michaelnebel May 28, 2026
34d4e9a
Merge pull request #21898 from geoffw0/swiftflow
geoffw0 May 28, 2026
f8ab76e
Swift: Update the new metatype sinks to not rely on name matching '.T…
geoffw0 May 28, 2026
8393b40
C++: Use the new extensionals to map template functions and classes t…
MathiasVP May 27, 2026
9f211ce
C++: Accept test changes.
MathiasVP May 27, 2026
2d58150
C++: Fix Copilot comments.
MathiasVP May 28, 2026
2eac889
Merge pull request #21893 from michaelnebel/cshar/updateroslyn
michaelnebel May 28, 2026
6165623
Merge pull request #21724 from github/tausbn/python-add-self-validati…
tausbn May 28, 2026
0937133
Ruby: Adopt shared local name resolution library
hvitved May 28, 2026
4c31866
Merge pull request #21867 from aschackmull/ruby/callable-body
aschackmull May 29, 2026
caae5a8
Apply suggestions from code review
hvitved May 29, 2026
43c1152
Merge pull request #21905 from geoffw0/swiftflow2
geoffw0 May 29, 2026
a16f1c5
Merge pull request #21912 from github/post-release-prep/codeql-cli-2.…
henrymercer May 29, 2026
e18448d
C++: Add more tests.
MathiasVP May 29, 2026
5e5a043
Shared CFG: allow init stmts for IfStmt
owen-mc May 30, 2026
22b08f1
C++: Add a test with a kind of "partial function template" instantiat…
MathiasVP May 31, 2026
d2f474d
Address review comments
hvitved May 29, 2026
ab4a575
Merge pull request #21899 from MathiasVP/use-new-prototype-extensionals
jketema Jun 1, 2026
c695c15
Rust: Rename `Impl::getTrait` to `Impl::getTraitTy`
hvitved Jun 1, 2026
00e95a0
Rust: Add `Impl::getSelf()` and `Impl::getTrait()`
hvitved Jun 1, 2026
d5f9447
Rust: DB upgrade/downgrade scripts
hvitved Jun 1, 2026
62207f1
Potential fix for pull request finding
hvitved Jun 1, 2026
56822f8
Tree-sitter-extactor: More helpful panic message
asgerf May 27, 2026
ef9306d
Yeast: Allow rules that return an empty sequence
asgerf May 27, 2026
e3b3888
Yeast: Fix handling of captures with multiple results
asgerf May 27, 2026
1ecdc36
Yeast: Fix matching against extras like comments
asgerf May 27, 2026
ac8eb50
Yeast: Allow 'r#type' to escape the 'type' keyword in macro
asgerf May 28, 2026
1751d70
Fix parsing of corpus tests when --- delimiter is missing
asgerf May 28, 2026
21f216a
yeast-macros: omit empty fields produced by .. splice
asgerf May 28, 2026
3f3bed6
yeast: type-check for missing required fields
asgerf May 29, 2026
71a3635
formatting
BazookaMusic Jun 1, 2026
d1226b7
formatting
BazookaMusic Jun 1, 2026
c1c9287
restore file header
BazookaMusic Jun 1, 2026
019a5c0
Merge branch 'main' into bazookamusic/range-analysis-bound-move-to-sh…
BazookaMusic Jun 1, 2026
fa63dad
change note
BazookaMusic Jun 1, 2026
c610af8
fix comment and add overlay[local?]
BazookaMusic Jun 1, 2026
2a3cff3
more specific comment
BazookaMusic Jun 1, 2026
9618e9b
Merge pull request #21873 from hvitved/local-name-resolution
hvitved Jun 1, 2026
8d099cb
Recognize more non-returning logging functions
owen-mc Jun 13, 2024
f3e3647
Improve noretFunctions test
owen-mc May 31, 2026
c99dab1
Improve glog (and klog) modelling
owen-mc May 31, 2026
45b1253
Improve glog and klog tests
owen-mc Jun 1, 2026
28bb1a6
Add change note
owen-mc Jun 1, 2026
1a747dd
(Trivial) Fix QLDoc grammar
owen-mc Jun 1, 2026
8a1e6d4
Add missing QLDocs
owen-mc Jun 1, 2026
e706c5f
Improve test for non-returning fns
owen-mc Jun 1, 2026
adc9b77
Accept changed test output
owen-mc Jun 1, 2026
e6e8e3d
Taint doesn't flow through panicking functions
owen-mc Jun 2, 2026
703cea2
Model panicking log functions better
owen-mc Jun 2, 2026
0547e9c
Rust: Path resolution for `static` items
hvitved Jun 1, 2026
c4e3720
Rust: Run codegen
hvitved Jun 1, 2026
1fd31d0
Rust: Data flow for `const`s and `static`s
hvitved Jun 1, 2026
be9c785
Fix incorrect QLDoc
owen-mc Jun 2, 2026
9dbe9ad
Update tests
owen-mc Jun 2, 2026
566a92e
formatting again
BazookaMusic Jun 2, 2026
61a5cec
Merge branch 'main' into bazookamusic/range-analysis-bound-move-to-sh…
BazookaMusic Jun 2, 2026
aaa3b36
Merge pull request #21929 from owen-mc/go/no-ret-functions
owen-mc Jun 2, 2026
dc0c7d7
Fix `commment` typos
hvitved Jun 2, 2026
9d5dfea
JS: Add Vue to `file_coverage_languages` and `github_api_languages`
jketema Jun 2, 2026
d11fc3a
Merge pull request #21932 from jketema/jketema/vue
jketema Jun 2, 2026
af45e53
Rust: Rename parameter in DB upgrade script
hvitved Jun 2, 2026
167c837
Merge pull request #21914 from owen-mc/shared/cfg/if-init
owen-mc Jun 2, 2026
7edf010
Merge pull request #21924 from asgerf/asgerf/yeast-changes
asgerf Jun 3, 2026
0a80144
review comments
BazookaMusic Jun 3, 2026
f342756
No duplicate Ssa and remove release changenot
BazookaMusic Jun 3, 2026
d55ff83
Merge pull request #21269 from owen-mc/go/improve-tests-for-varargs-flow
owen-mc Jun 3, 2026
52f2a58
Merge pull request #21804 from github/copilot/add-tests-for-models
owen-mc Jun 3, 2026
0430c71
Merge pull request #21922 from hvitved/rust/static-const-resolution
hvitved Jun 3, 2026
3da195f
Merge pull request #21918 from hvitved/rust/expose-resolution
hvitved Jun 3, 2026
5576d30
Add changed framework coverage reports
github-actions[bot] Jun 4, 2026
d2972cb
Add back alias for module
BazookaMusic Jun 4, 2026
d6892ea
Merge pull request #21900 from github/bazookamusic/range-analysis-bou…
BazookaMusic Jun 4, 2026
cd2398a
Merge pull request #21936 from github/workflow/coverage/update
owen-mc Jun 4, 2026
b32573b
update codeql documentation
invalid-email-address Jun 4, 2026
2f3524d
Merge branch 'rc/3.22' into codeql-spark-run-26947645690
henrymercer Jun 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions config/identical-files.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
"java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/SignAnalysisCommon.qll",
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SignAnalysisCommon.qll"
],
"Bound Java/C#": [
"java/ql/lib/semmle/code/java/dataflow/Bound.qll",
"csharp/ql/lib/semmle/code/csharp/dataflow/Bound.qll"
],
"ModulusAnalysis Java/C#": [
"java/ql/lib/semmle/code/java/dataflow/ModulusAnalysis.qll",
"csharp/ql/lib/semmle/code/csharp/dataflow/ModulusAnalysis.qll"
Expand Down
16 changes: 2 additions & 14 deletions cpp/ql/lib/DefaultOptions.qll
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class Options extends string {
predicate overrideReturnsNull(Call call) {
// Used in CVS:
call.(FunctionCall).getTarget().hasGlobalName("Xstrdup")
or
CustomOptions::overrideReturnsNull(call) // old Options.qll
}

/**
Expand All @@ -45,8 +43,6 @@ class Options extends string {
// Used in CVS:
call.(FunctionCall).getTarget().hasGlobalName("Xstrdup") and
nullValue(call.getArgument(0))
or
CustomOptions::returnsNull(call) // old Options.qll
}

/**
Expand All @@ -65,8 +61,6 @@ class Options extends string {
f.hasGlobalOrStdName([
"exit", "_exit", "_Exit", "abort", "__assert_fail", "longjmp", "__builtin_unreachable"
])
or
CustomOptions::exits(f) // old Options.qll
}

/**
Expand All @@ -79,19 +73,15 @@ class Options extends string {
* runtime, the program's behavior is undefined)
*/
predicate exprExits(Expr e) {
e.(AssumeExpr).getChild(0).(CompileTimeConstantInt).getIntValue() = 0 or
CustomOptions::exprExits(e) // old Options.qll
e.(AssumeExpr).getChild(0).(CompileTimeConstantInt).getIntValue() = 0
}

/**
* Holds if function `f` should always have its return value checked.
*
* By default holds only for `fgets`.
*/
predicate alwaysCheckReturnValue(Function f) {
f.hasGlobalOrStdName("fgets") or
CustomOptions::alwaysCheckReturnValue(f) // old Options.qll
}
predicate alwaysCheckReturnValue(Function f) { f.hasGlobalOrStdName("fgets") }

/**
* Holds if it is reasonable to ignore the return value of function
Expand All @@ -107,8 +97,6 @@ class Options extends string {
// common way of sleeping using select:
fc.getTarget().hasGlobalName("select") and
fc.getArgument(0).getValue() = "0"
or
CustomOptions::okToIgnoreReturnValue(fc) // old Options.qll
}
}

Expand Down
54 changes: 0 additions & 54 deletions cpp/ql/lib/Options.qll
Original file line number Diff line number Diff line change
Expand Up @@ -98,57 +98,3 @@ class CustomMutexType extends MutexType {
*/
override predicate unlockAccess(FunctionCall fc, Expr arg) { none() }
}

/**
* DEPRECATED: customize `CustomOptions.overrideReturnsNull` instead.
*
* This predicate is required to support backwards compatibility for
* older `Options.qll` files. It should not be removed or modified by
* end users.
*/
predicate overrideReturnsNull(Call call) { none() }

/**
* DEPRECATED: customize `CustomOptions.returnsNull` instead.
*
* This predicate is required to support backwards compatibility for
* older `Options.qll` files. It should not be removed or modified by
* end users.
*/
predicate returnsNull(Call call) { none() }

/**
* DEPRECATED: customize `CustomOptions.exits` instead.
*
* This predicate is required to support backwards compatibility for
* older `Options.qll` files. It should not be removed or modified by
* end users.
*/
predicate exits(Function f) { none() }

/**
* DEPRECATED: customize `CustomOptions.exprExits` instead.
*
* This predicate is required to support backwards compatibility for
* older `Options.qll` files. It should not be removed or modified by
* end users.
*/
predicate exprExits(Expr e) { none() }

/**
* DEPRECATED: customize `CustomOptions.alwaysCheckReturnValue` instead.
*
* This predicate is required to support backwards compatibility for
* older `Options.qll` files. It should not be removed or modified by
* end users.
*/
predicate alwaysCheckReturnValue(Function f) { none() }

/**
* DEPRECATED: customize `CustomOptions.okToIgnoreReturnValue` instead.
*
* This predicate is required to support backwards compatibility for
* older `Options.qll` files. It should not be removed or modified by
* end users.
*/
predicate okToIgnoreReturnValue(FunctionCall fc) { none() }
15 changes: 15 additions & 0 deletions cpp/ql/lib/change-notes/2026-05-27-deprecated-removal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
category: breaking
---
* Removed the deprecated `overrideReturnsNull` predicate from `Options.qll`. Use `CustomOptions.overrideReturnsNull` instead.
* Removed the deprecated `returnsNull` predicate from `Options.qll`. Use `CustomOptions.returnsNull` instead.
* Removed the deprecated `exits` predicate from `Options.qll`. Use `CustomOptions.exits` instead.
* Removed the deprecated `exprExits` predicate from `Options.qll`. Use `CustomOptions.exprExits` instead.
* Removed the deprecated `alwaysCheckReturnValue` predicate from `Options.qll`. Use `CustomOptions.alwaysCheckReturnValue` instead.
* Removed the deprecated `okToIgnoreReturnValue` predicate from `Options.qll`. Use `CustomOptions.okToIgnoreReturnValue` instead.
* Removed the deprecated `semmle.code.cpp.Member`. Import `semmle.code.cpp.Element` and/or `semmle.code.cpp.Type` directly.
* Removed the deprecated `UnknownDefaultLocation` class. Use `UnknownLocation` instead.
* Removed the deprecated `UnknownExprLocation` class. Use `UnknownLocation` instead.
* Removed the deprecated `UnknownStmtLocation` class. Use `UnknownLocation` instead.
* Removed the deprecated `TemplateParameter` class. Use `TypeTemplateParameter` instead.
* Support for class resolution across link targets has been removed for databases which were created with CodeQL versions before 1.23.0.
1 change: 0 additions & 1 deletion cpp/ql/lib/cpp.qll
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import semmle.code.cpp.Class
import semmle.code.cpp.Struct
import semmle.code.cpp.Union
import semmle.code.cpp.Enum
import semmle.code.cpp.Member
import semmle.code.cpp.Field
import semmle.code.cpp.Function
import semmle.code.cpp.MemberFunction
Expand Down
25 changes: 0 additions & 25 deletions cpp/ql/lib/semmle/code/cpp/Location.qll
Original file line number Diff line number Diff line change
Expand Up @@ -148,28 +148,3 @@ class UnknownLocation extends Location {
this.getFile().getAbsolutePath() = "" and locations_default(this, _, 0, 0, 0, 0)
}
}

/**
* A dummy location which is used when something doesn't have a location in
* the source code but needs to have a `Location` associated with it.
*
* DEPRECATED: use `UnknownLocation`
*/
deprecated class UnknownDefaultLocation extends UnknownLocation { }

/**
* A dummy location which is used when an expression doesn't have a
* location in the source code but needs to have a `Location` associated
* with it.
*
* DEPRECATED: use `UnknownLocation`
*/
deprecated class UnknownExprLocation extends UnknownLocation { }

/**
* A dummy location which is used when a statement doesn't have a location
* in the source code but needs to have a `Location` associated with it.
*
* DEPRECATED: use `UnknownLocation`
*/
deprecated class UnknownStmtLocation extends UnknownLocation { }
6 changes: 0 additions & 6 deletions cpp/ql/lib/semmle/code/cpp/Member.qll

This file was deleted.

7 changes: 0 additions & 7 deletions cpp/ql/lib/semmle/code/cpp/TemplateParameter.qll
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ class NonTypeTemplateParameter extends Literal, TemplateParameterImpl {
override string getAPrimaryQlClass() { result = "NonTypeTemplateParameter" }
}

/**
* A C++ `typename` (or `class`) template parameter.
*
* DEPRECATED: Use `TypeTemplateParameter` instead.
*/
deprecated class TemplateParameter = TypeTemplateParameter;

/**
* A C++ `typename` (or `class`) template parameter.
*
Expand Down
80 changes: 76 additions & 4 deletions cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,45 @@ private predicate isClassConstructedFrom(Class c, Class templateClass) {
not c.isConstructedFrom(_) and c = templateClass
}

/** Gets the fully templated version of `c`. */
private Class getFullyTemplatedClassOld(Class c) {
not c.isFromUninstantiatedTemplate(_) and
isClassConstructedFrom(c, result)
}

private TemplateClass getOriginalClassTemplate(TemplateClass tc) {
result = tc.getOriginalTemplate()
or
not exists(tc.getOriginalTemplate()) and
result = tc
}

/** Gets the fully templated version of `c`. */
private Class getFullyTemplatedClassNew(Class c) {
not c.isFromUninstantiatedTemplate(_) and
exists(Class mid |
c.isConstructedFrom(mid)
or
not c.isConstructedFrom(_) and c = mid
|
result = getOriginalClassTemplate(mid)
or
not mid instanceof TemplateClass and mid = result
)
}

/** Gets the fully templated version of `c`. */
private Class getFullyTemplatedClass(Class c) {
// The `Class::getOriginalTemplate` predicate was introduced in CodeQL
// version 2.25.6 and the upgrade script leaves the
// `class_template_generated_from` extensionals empty if the database
// was generated with an older extractor. So we use the old implementation
// if the `class_template_generated_from` extensional is empty.
if class_template_generated_from(_, _)
then result = getFullyTemplatedClassNew(c)
else result = getFullyTemplatedClassOld(c)
}

/**
* Holds if `f` is an instantiation of a function template `templateFunc`, or
* holds with `f = templateFunc` if `f` is not an instantiation of any function
Expand All @@ -292,7 +331,7 @@ private predicate isFunctionConstructedFrom(Function f, Function templateFunc) {
}

/** Gets the fully templated version of `f`. */
Function getFullyTemplatedFunction(Function f) {
private Function getFullyTemplatedFunctionOld(Function f) {
not f.isFromUninstantiatedTemplate(_) and
(
exists(Class c, Class templateClass, int i |
Expand All @@ -306,13 +345,46 @@ Function getFullyTemplatedFunction(Function f) {
)
}

private TemplateFunction getOriginalFunctionTemplate(TemplateFunction tf) {
result = tf.getOriginalTemplate()
or
not exists(tf.getOriginalTemplate()) and
result = tf
}

/** Gets the fully templated version of `f`. */
private Function getFullyTemplatedFunctionNew(Function f) {
not f.isFromUninstantiatedTemplate(_) and
exists(Function mid |
f.isConstructedFrom(mid)
or
not f.isConstructedFrom(_) and f = mid
|
result = getOriginalFunctionTemplate(mid)
or
not mid instanceof TemplateFunction and mid = result
)
}

/** Gets the fully templated version of `f`. */
Function getFullyTemplatedFunction(Function f) {
// The `Function::getOriginalTemplate` predicate was introduced in CodeQL
// version 2.25.6 and the upgrade script leaves the
// `function_template_generated_from` extensionals empty if the database
// was generated with an older extractor. So we use the old implementation
// if the `function_template_generated_from` extensional is empty.
if function_template_generated_from(_, _)
then result = getFullyTemplatedFunctionNew(f)
else result = getFullyTemplatedFunctionOld(f)
}

/** Prefixes `const` to `s` if `t` is const, or returns `s` otherwise. */
bindingset[s, t]
private string withConst(string s, Type t) {
if t.isConst() then result = "const " + s else result = s
}

/** Prefixes `volatile` to `s` if `t` is const, or returns `s` otherwise. */
/** Prefixes `volatile` to `s` if `t` is volatile, or returns `s` otherwise. */
bindingset[s, t]
private string withVolatile(string s, Type t) {
if t.isVolatile() then result = "volatile " + s else result = s
Expand Down Expand Up @@ -490,7 +562,7 @@ pragma[nomagic]
private string getTypeNameWithoutClassTemplates(Function f, int n, int remaining) {
// If there is a declaring type then we start by expanding the function templates
exists(Class template |
isClassConstructedFrom(f.getDeclaringType(), template) and
template = getFullyTemplatedClass(f.getDeclaringType()) and
remaining = getNumberOfSupportedClassTemplateArguments(template) and
result = getTypeNameWithoutFunctionTemplates(f, n, 0)
)
Expand All @@ -502,7 +574,7 @@ private string getTypeNameWithoutClassTemplates(Function f, int n, int remaining
or
exists(string mid, TypeTemplateParameter tp, Class template |
mid = getTypeNameWithoutClassTemplates(f, n, remaining + 1) and
isClassConstructedFrom(f.getDeclaringType(), template) and
template = getFullyTemplatedClass(f.getDeclaringType()) and
tp = getSupportedClassTemplateArgument(template, remaining)
|
result = mid.replaceAll(tp.getName(), "class:" + remaining.toString())
Expand Down
57 changes: 0 additions & 57 deletions cpp/ql/lib/semmle/code/cpp/internal/ResolveClass.qll
Original file line number Diff line number Diff line change
@@ -1,59 +1,5 @@
import semmle.code.cpp.Type

/** For upgraded databases without mangled name info. */
pragma[noinline]
private string getTopLevelClassName(@usertype c) {
not mangled_name(_, _, _) and
isClass(c) and
usertypes(c, result, _) and
not namespacembrs(_, c) and // not in a namespace
not member(_, _, c) and // not in some structure
not class_instantiation(c, _) // not a template instantiation
}

/**
* For upgraded databases without mangled name info.
* Holds if `d` is a unique complete class named `name`.
*/
pragma[noinline]
private predicate existsCompleteWithName(string name, @usertype d) {
not mangled_name(_, _, _) and
is_complete(d) and
name = getTopLevelClassName(d) and
onlyOneCompleteClassExistsWithName(name)
}

/** For upgraded databases without mangled name info. */
pragma[noinline]
private predicate onlyOneCompleteClassExistsWithName(string name) {
not mangled_name(_, _, _) and
strictcount(@usertype c | is_complete(c) and getTopLevelClassName(c) = name) = 1
}

/**
* For upgraded databases without mangled name info.
* Holds if `c` is an incomplete class named `name`.
*/
pragma[noinline]
private predicate existsIncompleteWithName(string name, @usertype c) {
not mangled_name(_, _, _) and
not is_complete(c) and
name = getTopLevelClassName(c)
}

/**
* For upgraded databases without mangled name info.
* Holds if `c` is an incomplete class, and there exists a unique complete class `d`
* with the same name.
*/
private predicate oldHasCompleteTwin(@usertype c, @usertype d) {
not mangled_name(_, _, _) and
exists(string name |
existsIncompleteWithName(name, c) and
existsCompleteWithName(name, d)
)
}

pragma[noinline]
private @mangledname getClassMangledName(@usertype c) {
isClass(c) and
Expand Down Expand Up @@ -103,10 +49,7 @@ private module Cached {
@usertype resolveClass(@usertype c) {
hasCompleteTwin(c, result)
or
oldHasCompleteTwin(c, result)
or
not hasCompleteTwin(c, _) and
not oldHasCompleteTwin(c, _) and
result = c
}

Expand Down
Loading
Loading