From 3786ad4277c7b63a9901a0dd4ae211383dd48f12 Mon Sep 17 00:00:00 2001 From: Napalys Date: Mon, 18 Nov 2024 12:44:49 +0100 Subject: [PATCH 01/47] JS: Add: test case for Map.groupBy --- javascript/ql/test/library-tests/TaintTracking/tst.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/javascript/ql/test/library-tests/TaintTracking/tst.js b/javascript/ql/test/library-tests/TaintTracking/tst.js index a5142e29685..6ea2e755df4 100644 --- a/javascript/ql/test/library-tests/TaintTracking/tst.js +++ b/javascript/ql/test/library-tests/TaintTracking/tst.js @@ -68,4 +68,7 @@ function test() { sink(x.toReversed()) // NOT OK const xReversed = x.toReversed(); sink(xReversed) // NOT OK + + sink(Map.groupBy(x, z => z)); // NOT OK -- This should be marked via taint step, but it is not. + sink(Custom.groupBy(x, z => z)); // OK } From c02ad65fdc27142b10d21b26915c9425422957ff Mon Sep 17 00:00:00 2001 From: Napalys Date: Mon, 18 Nov 2024 12:50:06 +0100 Subject: [PATCH 02/47] JS: Add: taint step for Map.groupBy function --- javascript/ql/lib/semmle/javascript/Collections.qll | 13 +++++++++++++ .../TaintTracking/BasicTaintTracking.expected | 1 + .../ql/test/library-tests/TaintTracking/tst.js | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/javascript/ql/lib/semmle/javascript/Collections.qll b/javascript/ql/lib/semmle/javascript/Collections.qll index a0e251554ff..ff64a5568d1 100644 --- a/javascript/ql/lib/semmle/javascript/Collections.qll +++ b/javascript/ql/lib/semmle/javascript/Collections.qll @@ -151,4 +151,17 @@ private module CollectionDataFlow { ) } } + + /** + * A step for a call to `groupBy` on an iterable object. + */ + private class GroupByTaintStep extends TaintTracking::SharedTaintStep { + override predicate heapStep(DataFlow::Node pred, DataFlow::Node succ) { + exists(DataFlow::MethodCallNode call | + call = DataFlow::globalVarRef("Map").getAMemberCall("groupBy") and + pred = call.getArgument(0) and + succ = call + ) + } + } } diff --git a/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected b/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected index 88465784205..248a35b907f 100644 --- a/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected +++ b/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected @@ -244,6 +244,7 @@ typeInferenceMismatch | tst.js:2:13:2:20 | source() | tst.js:66:10:66:16 | xSorted | | tst.js:2:13:2:20 | source() | tst.js:68:10:68:23 | x.toReversed() | | tst.js:2:13:2:20 | source() | tst.js:70:10:70:18 | xReversed | +| tst.js:2:13:2:20 | source() | tst.js:72:10:72:31 | Map.gro ... z => z) | | xml.js:5:18:5:25 | source() | xml.js:8:14:8:17 | text | | xml.js:12:17:12:24 | source() | xml.js:13:14:13:19 | result | | xml.js:23:18:23:25 | source() | xml.js:20:14:20:17 | attr | diff --git a/javascript/ql/test/library-tests/TaintTracking/tst.js b/javascript/ql/test/library-tests/TaintTracking/tst.js index 6ea2e755df4..c69895625ca 100644 --- a/javascript/ql/test/library-tests/TaintTracking/tst.js +++ b/javascript/ql/test/library-tests/TaintTracking/tst.js @@ -69,6 +69,6 @@ function test() { const xReversed = x.toReversed(); sink(xReversed) // NOT OK - sink(Map.groupBy(x, z => z)); // NOT OK -- This should be marked via taint step, but it is not. + sink(Map.groupBy(x, z => z)); // NOT OK sink(Custom.groupBy(x, z => z)); // OK } From 8ae05d8be474848cf325180e8507aac10ed63ee6 Mon Sep 17 00:00:00 2001 From: Napalys Date: Mon, 18 Nov 2024 12:52:49 +0100 Subject: [PATCH 03/47] JS: Add: test case for Object.groupBy --- javascript/ql/test/library-tests/TaintTracking/tst.js | 1 + 1 file changed, 1 insertion(+) diff --git a/javascript/ql/test/library-tests/TaintTracking/tst.js b/javascript/ql/test/library-tests/TaintTracking/tst.js index c69895625ca..d268c02e687 100644 --- a/javascript/ql/test/library-tests/TaintTracking/tst.js +++ b/javascript/ql/test/library-tests/TaintTracking/tst.js @@ -71,4 +71,5 @@ function test() { sink(Map.groupBy(x, z => z)); // NOT OK sink(Custom.groupBy(x, z => z)); // OK + sink(Object.groupBy(x, z => z)); // NOT OK -- This should be marked via taint step, but it is not. } From 213ce225e0d3a3a426c20d91f48abfed94328f4b Mon Sep 17 00:00:00 2001 From: Napalys Date: Mon, 18 Nov 2024 12:58:07 +0100 Subject: [PATCH 04/47] JS: Add: taint step for Object.groupBy function, fixed test cases from 8ae05d8be474848cf325180e8507aac10ed63ee6 --- javascript/ql/lib/semmle/javascript/Collections.qll | 2 +- .../library-tests/TaintTracking/BasicTaintTracking.expected | 1 + javascript/ql/test/library-tests/TaintTracking/tst.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/javascript/ql/lib/semmle/javascript/Collections.qll b/javascript/ql/lib/semmle/javascript/Collections.qll index ff64a5568d1..c7348e603f4 100644 --- a/javascript/ql/lib/semmle/javascript/Collections.qll +++ b/javascript/ql/lib/semmle/javascript/Collections.qll @@ -158,7 +158,7 @@ private module CollectionDataFlow { private class GroupByTaintStep extends TaintTracking::SharedTaintStep { override predicate heapStep(DataFlow::Node pred, DataFlow::Node succ) { exists(DataFlow::MethodCallNode call | - call = DataFlow::globalVarRef("Map").getAMemberCall("groupBy") and + call = DataFlow::globalVarRef(["Map", "Object"]).getAMemberCall("groupBy") and pred = call.getArgument(0) and succ = call ) diff --git a/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected b/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected index 248a35b907f..79be56cbb7e 100644 --- a/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected +++ b/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected @@ -245,6 +245,7 @@ typeInferenceMismatch | tst.js:2:13:2:20 | source() | tst.js:68:10:68:23 | x.toReversed() | | tst.js:2:13:2:20 | source() | tst.js:70:10:70:18 | xReversed | | tst.js:2:13:2:20 | source() | tst.js:72:10:72:31 | Map.gro ... z => z) | +| tst.js:2:13:2:20 | source() | tst.js:74:10:74:34 | Object. ... z => z) | | xml.js:5:18:5:25 | source() | xml.js:8:14:8:17 | text | | xml.js:12:17:12:24 | source() | xml.js:13:14:13:19 | result | | xml.js:23:18:23:25 | source() | xml.js:20:14:20:17 | attr | diff --git a/javascript/ql/test/library-tests/TaintTracking/tst.js b/javascript/ql/test/library-tests/TaintTracking/tst.js index d268c02e687..0fab561954d 100644 --- a/javascript/ql/test/library-tests/TaintTracking/tst.js +++ b/javascript/ql/test/library-tests/TaintTracking/tst.js @@ -71,5 +71,5 @@ function test() { sink(Map.groupBy(x, z => z)); // NOT OK sink(Custom.groupBy(x, z => z)); // OK - sink(Object.groupBy(x, z => z)); // NOT OK -- This should be marked via taint step, but it is not. + sink(Object.groupBy(x, z => z)); // NOT OK } From aea7c3fc81fab7af5c485b95e7485cd9541375a1 Mon Sep 17 00:00:00 2001 From: Stephan Brandauer Date: Tue, 19 Nov 2024 10:37:35 +0100 Subject: [PATCH 05/47] Java: drop automodel change note --- .../automodel/src/change-notes/2024-11-19-drop-automodel.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 java/ql/automodel/src/change-notes/2024-11-19-drop-automodel.md diff --git a/java/ql/automodel/src/change-notes/2024-11-19-drop-automodel.md b/java/ql/automodel/src/change-notes/2024-11-19-drop-automodel.md new file mode 100644 index 00000000000..2b554d6de20 --- /dev/null +++ b/java/ql/automodel/src/change-notes/2024-11-19-drop-automodel.md @@ -0,0 +1,4 @@ +--- +category: breaking +--- +* Dropped the Java Automodel queries. From 4208f031e3fdebdaab6c7029fee37df725b17a98 Mon Sep 17 00:00:00 2001 From: Stephan Brandauer Date: Tue, 19 Nov 2024 10:40:04 +0100 Subject: [PATCH 06/47] Java: drop automodel queries --- java/ql/automodel/publish.sh | 197 ----- .../automodel/src/AutomodelAlertSinkUtil.qll | 183 ----- java/ql/automodel/src/AutomodelAlertSinks.ql | 16 - .../src/AutomodelAlertSinksPerQuery.ql | 19 - ...utomodelApplicationModeCharacteristics.qll | 677 ------------------ ...tomodelApplicationModeExtractCandidates.ql | 81 --- ...lApplicationModeExtractNegativeExamples.ql | 66 -- ...lApplicationModeExtractPositiveExamples.ql | 37 - .../src/AutomodelCandidateFilter.yml | 5 - .../src/AutomodelCountGeneratedSinks.ql | 19 - .../automodel/src/AutomodelEndpointTypes.qll | 82 --- .../AutomodelFrameworkModeCharacteristics.qll | 507 ------------- ...AutomodelFrameworkModeExtractCandidates.ql | 38 - ...delFrameworkModeExtractNegativeExamples.ql | 36 - ...delFrameworkModeExtractPositiveExamples.ql | 34 - java/ql/automodel/src/AutomodelJavaUtil.qll | 111 --- .../src/AutomodelSharedCharacteristics.qll | 412 ----------- .../src/AutomodelSinkModelMrvaQueries.ql | 62 -- java/ql/automodel/src/codeql-pack.release.yml | 2 - java/ql/automodel/src/qlpack.yml | 10 - ...delApplicationModeExtractionTests.expected | 2 - ...AutomodelApplicationModeExtractionTests.ql | 35 - .../PluginImpl.java | 8 - .../Test.java | 112 --- .../hudson/Plugin.java | 7 - .../test/AutomodelExtractionTests.qll | 77 -- ...modelFrameworkModeExtractionTests.expected | 2 - .../AutomodelFrameworkModeExtractionTests.ql | 35 - .../com/github/codeql/test/MyWriter.java | 15 - .../github/codeql/test/NonPublicClass.java | 10 - .../com/github/codeql/test/PublicClass.java | 27 - .../github/codeql/test/PublicInterface.java | 9 - .../java/io/File.java | 13 - .../java/nio/file/Files.java | 31 - .../test/change-notes/2024-05-23-Version1.md | 4 - java/ql/automodel/test/qlpack.yml | 13 - 36 files changed, 2994 deletions(-) delete mode 100755 java/ql/automodel/publish.sh delete mode 100644 java/ql/automodel/src/AutomodelAlertSinkUtil.qll delete mode 100644 java/ql/automodel/src/AutomodelAlertSinks.ql delete mode 100644 java/ql/automodel/src/AutomodelAlertSinksPerQuery.ql delete mode 100644 java/ql/automodel/src/AutomodelApplicationModeCharacteristics.qll delete mode 100644 java/ql/automodel/src/AutomodelApplicationModeExtractCandidates.ql delete mode 100644 java/ql/automodel/src/AutomodelApplicationModeExtractNegativeExamples.ql delete mode 100644 java/ql/automodel/src/AutomodelApplicationModeExtractPositiveExamples.ql delete mode 100644 java/ql/automodel/src/AutomodelCandidateFilter.yml delete mode 100644 java/ql/automodel/src/AutomodelCountGeneratedSinks.ql delete mode 100644 java/ql/automodel/src/AutomodelEndpointTypes.qll delete mode 100644 java/ql/automodel/src/AutomodelFrameworkModeCharacteristics.qll delete mode 100644 java/ql/automodel/src/AutomodelFrameworkModeExtractCandidates.ql delete mode 100644 java/ql/automodel/src/AutomodelFrameworkModeExtractNegativeExamples.ql delete mode 100644 java/ql/automodel/src/AutomodelFrameworkModeExtractPositiveExamples.ql delete mode 100644 java/ql/automodel/src/AutomodelJavaUtil.qll delete mode 100644 java/ql/automodel/src/AutomodelSharedCharacteristics.qll delete mode 100644 java/ql/automodel/src/AutomodelSinkModelMrvaQueries.ql delete mode 100644 java/ql/automodel/src/codeql-pack.release.yml delete mode 100644 java/ql/automodel/src/qlpack.yml delete mode 100644 java/ql/automodel/test/AutomodelApplicationModeExtraction/AutomodelApplicationModeExtractionTests.expected delete mode 100644 java/ql/automodel/test/AutomodelApplicationModeExtraction/AutomodelApplicationModeExtractionTests.ql delete mode 100644 java/ql/automodel/test/AutomodelApplicationModeExtraction/PluginImpl.java delete mode 100644 java/ql/automodel/test/AutomodelApplicationModeExtraction/Test.java delete mode 100644 java/ql/automodel/test/AutomodelApplicationModeExtraction/hudson/Plugin.java delete mode 100644 java/ql/automodel/test/AutomodelExtractionTests.qll delete mode 100644 java/ql/automodel/test/AutomodelFrameworkModeExtraction/AutomodelFrameworkModeExtractionTests.expected delete mode 100644 java/ql/automodel/test/AutomodelFrameworkModeExtraction/AutomodelFrameworkModeExtractionTests.ql delete mode 100644 java/ql/automodel/test/AutomodelFrameworkModeExtraction/com/github/codeql/test/MyWriter.java delete mode 100644 java/ql/automodel/test/AutomodelFrameworkModeExtraction/com/github/codeql/test/NonPublicClass.java delete mode 100644 java/ql/automodel/test/AutomodelFrameworkModeExtraction/com/github/codeql/test/PublicClass.java delete mode 100644 java/ql/automodel/test/AutomodelFrameworkModeExtraction/com/github/codeql/test/PublicInterface.java delete mode 100644 java/ql/automodel/test/AutomodelFrameworkModeExtraction/java/io/File.java delete mode 100644 java/ql/automodel/test/AutomodelFrameworkModeExtraction/java/nio/file/Files.java delete mode 100644 java/ql/automodel/test/change-notes/2024-05-23-Version1.md delete mode 100644 java/ql/automodel/test/qlpack.yml diff --git a/java/ql/automodel/publish.sh b/java/ql/automodel/publish.sh deleted file mode 100755 index 7304f0da180..00000000000 --- a/java/ql/automodel/publish.sh +++ /dev/null @@ -1,197 +0,0 @@ -#!/bin/bash -set -e - -help="Usage: ./publish [--override-release] [--dry-run] -Publish the automodel query pack. - -If no arguments are provided, publish the version of the codeql repo specified by the latest official release of the codeml-automodel repo. -If the --override-release argument is provided, your current local HEAD is used (for unofficial releases or patching). -If the --dry-run argument is provided, the release is not published (for testing purposes)." - -# Echo the help message -if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then - echo "$help" - exit 0 -fi - -# Check the number of arguments are valid -if [ $# -gt 2 ]; then - echo "Error: Invalid arguments provided" - echo "$help" - exit 1 -fi - -OVERRIDE_RELEASE=0 -DRY_RUN=0 -for arg in "$@" -do - case $arg in - --override-release) - OVERRIDE_RELEASE=1 - shift # Remove --override-release from processing - ;; - --dry-run) - DRY_RUN=1 - shift # Remove --dry-run from processing - ;; - *) - echo "Error: Invalid argument provided: $arg" - echo "$help" - exit 1 - ;; - esac -done - -# Describe what we're about to do based on the command-line arguments -if [ $OVERRIDE_RELEASE = 1 ]; then - echo "Publishing the current HEAD of the automodel repo" -else - echo "Publishing the version of the automodel repo specified by the latest official release of the codeml-automodel repo" -fi -if [ $DRY_RUN = 1 ]; then - echo "Dry run: we will step through the process but we won't publish the query pack" -else - echo "Not a dry run! Publishing the query pack" -fi - -# If we're publishing the codeml-automodel release then we will checkout the sha specified in the release. -# So we need to check that there are no uncommitted changes in the local branch. -# And, if we're publishing the current HEAD, it's cleaner to ensure that there are no uncommitted changes. -if ! git diff --quiet; then - echo "Error: Uncommitted changes exist. Please commit or stash your changes before publishing." - exit 1 -fi - -# Check the above environment variables are set -if [ -z "${GITHUB_TOKEN}" ]; then - echo "Error: GITHUB_TOKEN environment variable not set. Please set this to a token with package:write permissions to codeql." - exit 1 -fi -if [ -z "${GH_TOKEN}" ]; then - echo "Error: GH_TOKEN environment variable not set. Please set this to a token with repo permissions to github/codeml-automodel." - exit 1 -fi - -# Get the sha of the previous release, i.e. the last commit to the main branch that updated the query pack version -PREVIOUS_RELEASE_SHA=$(git rev-list -n 1 main -- ./src/qlpack.yml) -if [ -z "$PREVIOUS_RELEASE_SHA" ]; then - echo "Error: Could not get the sha of the previous release of codeml-automodel query pack" - exit 1 -else - echo "Previous query-pack release sha: $PREVIOUS_RELEASE_SHA" -fi - -CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) -CURRENT_SHA=$(git rev-parse HEAD) - -if [ $OVERRIDE_RELEASE = 1 ]; then - # Check that the current HEAD is downstream from PREVIOUS_RELEASE_SHA - if ! git merge-base --is-ancestor "$PREVIOUS_RELEASE_SHA" "$CURRENT_SHA"; then - echo "Error: The current HEAD is not downstream from the previous release" - exit 1 - fi -else - # Get the latest release of codeml-automodel - TAG_NAME=$(gh api -H 'Accept: application/vnd.github+json' -H 'X-GitHub-Api-Version: 2022-11-28' /repos/github/codeml-automodel/releases/latest | jq -r .tag_name) - # Check TAG_NAME is not empty - if [ -z "$TAG_NAME" ]; then - echo "Error: Could not get latest release of codeml-automodel" - exit 1 - fi - echo "Updating to latest automodel release: $TAG_NAME" - # Before downloading, delete any existing release.zip, and ignore failure if not present - rm release.zip || true - gh release download $TAG_NAME -A zip -O release.zip --repo 'https://github.com/github/codeml-automodel' - # Before unzipping, delete any existing release directory, and ignore failure if not present - rm -rf release || true - unzip -o release.zip -d release - REVISION=$(jq -r '.["codeql-sha"]' release/codeml-automodel*/codeml-automodel-release.json) - echo "The latest codeml-automodel release specifies the codeql sha $REVISION" - # Check that REVISION is downstream from PREVIOUS_RELEASE_SHA - if ! git merge-base --is-ancestor "$PREVIOUS_RELEASE_SHA" "$REVISION"; then - echo "Error: The codeql version $REVISION is not downstream of the query-pack version $PREVIOUS_RELEASE_SHA" - exit 1 - fi - # Get the version of the codeql code specified by the codeml-automodel release - git checkout "$REVISION" -fi - -# Get the absolute path of the automodel repo -AUTOMODEL_ROOT="$(readlink -f "$(dirname $0)")" -# Get the absolute path of the workspace root -WORKSPACE_ROOT="$AUTOMODEL_ROOT/../../.." -# Specify the groups of queries to test and publish -GRPS="automodel,-test" - -# Install the codeql gh extension -gh extensions install github/gh-codeql - -pushd "$AUTOMODEL_ROOT" -echo Testing automodel queries -gh codeql test run test -popd - -pushd "$WORKSPACE_ROOT" -echo "Preparing the release" -gh codeql pack release --groups $GRPS -v - -if [ $DRY_RUN = 1 ]; then - echo "Dry run: not publishing the query pack" - gh codeql pack publish --groups $GRPS --dry-run -v -else - echo "Not a dry run! Publishing the query pack" - gh codeql pack publish --groups $GRPS -v -fi - -echo "Bumping versions" -gh codeql pack post-release --groups $GRPS -v -popd - -# The above commands update -# ./src/CHANGELOG.md -# ./src/codeql-pack.release.yml -# ./src/qlpack.yml -# and add a new file -# ./src/change-notes/released/.md - -# Get the filename of the most recently created file in ./src/change-notes/released/*.md -# This will be the file for the new release -NEW_CHANGE_NOTES_FILE=$(ls -t ./src/change-notes/released/*.md | head -n 1) - -# Make a copy of the modified files -mv ./src/CHANGELOG.md ./src/CHANGELOG.md.dry-run -mv ./src/codeql-pack.release.yml ./src/codeql-pack.release.yml.dry-run -mv ./src/qlpack.yml ./src/qlpack.yml.dry-run -mv "$NEW_CHANGE_NOTES_FILE" ./src/change-notes/released.md.dry-run - -if [ $OVERRIDE_RELEASE = 1 ]; then - # Restore the original files - git checkout ./src/CHANGELOG.md - git checkout ./src/codeql-pack.release.yml - git checkout ./src/qlpack.yml -else - # Restore the original files - git checkout "$CURRENT_BRANCH" --force -fi - -if [ $DRY_RUN = 1 ]; then - echo "Inspect the updated dry-run version files:" - ls -l ./src/*.dry-run - ls -l ./src/change-notes/*.dry-run -else - # Add the updated files to the current branch - echo "Adding the version changes" - mv -f ./src/CHANGELOG.md.dry-run ./src/CHANGELOG.md - mv -f ./src/codeql-pack.release.yml.dry-run ./src/codeql-pack.release.yml - mv -f ./src/qlpack.yml.dry-run ./src/qlpack.yml - mv -f ./src/change-notes/released.md.dry-run "$NEW_CHANGE_NOTES_FILE" - git add ./src/CHANGELOG.md - git add ./src/codeql-pack.release.yml - git add ./src/qlpack.yml - git add "$NEW_CHANGE_NOTES_FILE" - echo "Added the following updated version files to the current branch:" - git status -s - echo "To complete the release, please commit these files and merge to the main branch" -fi - -echo "Done" \ No newline at end of file diff --git a/java/ql/automodel/src/AutomodelAlertSinkUtil.qll b/java/ql/automodel/src/AutomodelAlertSinkUtil.qll deleted file mode 100644 index f20c8e57b6c..00000000000 --- a/java/ql/automodel/src/AutomodelAlertSinkUtil.qll +++ /dev/null @@ -1,183 +0,0 @@ -private import java -private import semmle.code.java.dataflow.ExternalFlow as ExternalFlow -private import semmle.code.java.dataflow.TaintTracking -private import semmle.code.java.security.RequestForgeryConfig -private import semmle.code.java.security.CommandLineQuery -private import semmle.code.java.security.SqlConcatenatedQuery -private import semmle.code.java.security.SqlInjectionQuery -private import semmle.code.java.security.UrlRedirectQuery -private import semmle.code.java.security.TaintedPathQuery -private import semmle.code.java.security.SqlInjectionQuery -private import AutomodelJavaUtil - -private newtype TSinkModel = - MkSinkModel( - string package, string type, boolean subtypes, string name, string signature, string ext, - string input, string kind, string provenance - ) { - ExternalFlow::sinkModel(package, type, subtypes, name, signature, ext, input, kind, provenance, - _) - } - -class SinkModel extends TSinkModel { - string package; - string type; - boolean subtypes; - string name; - string signature; - string ext; - string input; - string kind; - string provenance; - - SinkModel() { - this = MkSinkModel(package, type, subtypes, name, signature, ext, input, kind, provenance) - } - - /** Gets the package for this sink model. */ - string getPackage() { result = package } - - /** Gets the type for this sink model. */ - string getType() { result = type } - - /** Gets whether this sink model considers subtypes. */ - boolean getSubtypes() { result = subtypes } - - /** Gets the name for this sink model. */ - string getName() { result = name } - - /** Gets the signature for this sink model. */ - string getSignature() { result = signature } - - /** Gets the input for this sink model. */ - string getInput() { result = input } - - /** Gets the extension for this sink model. */ - string getExt() { result = ext } - - /** Gets the kind for this sink model. */ - string getKind() { result = kind } - - /** Gets the provenance for this sink model. */ - string getProvenance() { result = provenance } - - /** Gets the number of instances of this sink model. */ - int getInstanceCount() { result = count(PotentialSinkModelExpr p | p.getSinkModel() = this) } - - /** Gets a string representation of this sink model. */ - string toString() { - result = - "SinkModel(" + package + ", " + type + ", " + subtypes + ", " + name + ", " + signature + ", " - + ext + ", " + input + ", " + kind + ", " + provenance + ")" - } - - /** Gets a string representation of this sink model as it would appear in a Models-as-Data file. */ - string getRepr() { - result = - "\"" + package + "\", \"" + type + "\", " + pyBool(subtypes) + ", \"" + name + "\", \"" + - signature + "\", \"" + ext + "\", \"" + input + "\", \"" + kind + "\", \"" + provenance + - "\"" - } -} - -/** An expression that may correspond to a sink model. */ -class PotentialSinkModelExpr extends Expr { - /** - * Holds if this expression has the given signature. The signature should contain enough - * information to determine a corresponding sink model, if one exists. - */ - pragma[nomagic] - predicate hasSignature( - string package, string type, boolean subtypes, string name, string signature, string input - ) { - exists(Call call, Callable callable, int argIdx | - call.getCallee().getSourceDeclaration() = callable and - ( - this = call.getArgument(argIdx) - or - this = call.getQualifier() and argIdx = -1 - ) and - (if argIdx = -1 then input = "Argument[this]" else input = "Argument[" + argIdx + "]") and - package = callable.getDeclaringType().getPackage().getName() and - type = callable.getDeclaringType().getErasure().(RefType).getNestedName() and - subtypes = considerSubtypes(callable) and - name = callable.getName() and - signature = ExternalFlow::paramsString(callable) - ) - } - - /** Gets a sink model that corresponds to this expression. */ - SinkModel getSinkModel() { - this.hasSignature(result.getPackage(), result.getType(), result.getSubtypes(), result.getName(), - result.getSignature(), result.getInput()) - } -} - -private string pyBool(boolean b) { - b = true and result = "True" - or - b = false and result = "False" -} - -/** - * Gets a string representation of the existing sink model at the expression `e`, in the format in - * which it would appear in a Models-as-Data file. Also restricts the provenance of the sink model - * to be `ai-generated`. - */ -string getSinkModelRepr(PotentialSinkModelExpr e) { - result = e.getSinkModel().getRepr() and - e.getSinkModel().getProvenance() = "ai-generated" -} - -/** - * Gets the string representation of a sink model in a format suitable for appending to an alert - * message. - */ -string getSinkModelQueryRepr(PotentialSinkModelExpr e) { - result = "\nsinkModel: " + getSinkModelRepr(e) -} - -/** - * A parameterised module that takes a dataflow config, and exposes a predicate for counting the - * number of AI-generated sink models that appear in alerts for that query. - */ -private module SinkTallier { - module ConfigFlow = TaintTracking::Global; - - predicate getSinkModelCount(int c, SinkModel s) { - s = any(ConfigFlow::PathNode sink).getNode().asExpr().(PotentialSinkModelExpr).getSinkModel() and - c = - strictcount(ConfigFlow::PathNode sink | - ConfigFlow::flowPath(_, sink) and - s = sink.getNode().asExpr().(PotentialSinkModelExpr).getSinkModel() - ) - } -} - -predicate sinkModelTallyPerQuery(string queryName, int alertCount, SinkModel sinkModel) { - queryName = "java/request-forgery" and - SinkTallier::getSinkModelCount(alertCount, sinkModel) - or - queryName = "java/command-line-injection" and - SinkTallier::getSinkModelCount(alertCount, sinkModel) - or - queryName = "java/concatenated-sql-query" and - SinkTallier::getSinkModelCount(alertCount, sinkModel) - or - queryName = "java/ssrf" and - SinkTallier::getSinkModelCount(alertCount, sinkModel) - or - queryName = "java/path-injection" and - SinkTallier::getSinkModelCount(alertCount, sinkModel) - or - queryName = "java/unvalidated-url-redirection" and - SinkTallier::getSinkModelCount(alertCount, sinkModel) - or - queryName = "java/sql-injection" and - SinkTallier::getSinkModelCount(alertCount, sinkModel) -} - -predicate sinkModelTally(int alertCount, SinkModel sinkModel) { - sinkModelTallyPerQuery(_, _, sinkModel) and - alertCount = sum(int c | sinkModelTallyPerQuery(_, c, sinkModel)) -} diff --git a/java/ql/automodel/src/AutomodelAlertSinks.ql b/java/ql/automodel/src/AutomodelAlertSinks.ql deleted file mode 100644 index e9af51b4d63..00000000000 --- a/java/ql/automodel/src/AutomodelAlertSinks.ql +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @name Number of alerts per sink model - * @description Counts the number of alerts using `ai-generated` sink models. - * @kind table - * @id java/ml/metrics-count-alerts-per-sink-model - * @tags internal automodel metrics - */ - -private import java -private import AutomodelAlertSinkUtil - -from int alertCount, SinkModel s -where sinkModelTally(alertCount, s) and s.getProvenance() = "ai-generated" -select alertCount, s.getPackage() as package, s.getType() as type, s.getSubtypes() as subtypes, - s.getName() as name, s.getSignature() as signature, s.getInput() as input, s.getExt() as ext, - s.getKind() as kind, s.getProvenance() as provenance order by alertCount desc diff --git a/java/ql/automodel/src/AutomodelAlertSinksPerQuery.ql b/java/ql/automodel/src/AutomodelAlertSinksPerQuery.ql deleted file mode 100644 index 64a5038d116..00000000000 --- a/java/ql/automodel/src/AutomodelAlertSinksPerQuery.ql +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @name Number of alerts per sink model and query - * @description Counts the number of alerts per query using `ai-generated` sink models. - * @kind table - * @id java/ml/metrics-count-alerts-per-sink-model-and-query - * @tags internal automodel metrics - */ - -private import java -private import AutomodelAlertSinkUtil - -from string queryId, int alertCount, SinkModel s -where - sinkModelTallyPerQuery(queryId, alertCount, s) and - s.getProvenance() = "ai-generated" -select queryId, alertCount, s.getPackage() as package, s.getType() as type, - s.getSubtypes() as subtypes, s.getName() as name, s.getSignature() as signature, - s.getInput() as input, s.getExt() as ext, s.getKind() as kind, s.getProvenance() as provenance - order by queryId, alertCount desc diff --git a/java/ql/automodel/src/AutomodelApplicationModeCharacteristics.qll b/java/ql/automodel/src/AutomodelApplicationModeCharacteristics.qll deleted file mode 100644 index 750d776891f..00000000000 --- a/java/ql/automodel/src/AutomodelApplicationModeCharacteristics.qll +++ /dev/null @@ -1,677 +0,0 @@ -/** - * For internal use only. - */ - -private import java -private import semmle.code.Location as Location -private import semmle.code.java.dataflow.DataFlow -private import semmle.code.java.dataflow.TaintTracking -private import semmle.code.java.dataflow.ExternalFlow as ExternalFlow -private import semmle.code.java.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl -private import semmle.code.java.security.ExternalAPIs as ExternalAPIs -private import semmle.code.java.Expr as Expr -private import semmle.code.java.security.QueryInjection -private import semmle.code.java.dataflow.internal.ModelExclusions as ModelExclusions -private import AutomodelJavaUtil as AutomodelJavaUtil -private import semmle.code.java.security.PathSanitizer as PathSanitizer -import AutomodelSharedCharacteristics as SharedCharacteristics -import AutomodelEndpointTypes as AutomodelEndpointTypes - -newtype JavaRelatedLocationType = - CallContext() or - MethodDoc() or - ClassDoc() - -newtype TApplicationModeEndpoint = - TExplicitArgument(Call call, DataFlow::Node arg) { - AutomodelJavaUtil::isFromSource(call) and - exists(Argument argExpr | - arg.asExpr() = argExpr and call = argExpr.getCall() and not argExpr.isVararg() - ) and - not AutomodelJavaUtil::isUnexploitableType(arg.getType()) - } or - TInstanceArgument(Call call, DataFlow::Node arg) { - AutomodelJavaUtil::isFromSource(call) and - arg = DataFlow::getInstanceArgument(call) and - not call instanceof ConstructorCall and - not AutomodelJavaUtil::isUnexploitableType(arg.getType()) - } or - TImplicitVarargsArray(Call call, DataFlow::ImplicitVarargsArray arg, int idx) { - AutomodelJavaUtil::isFromSource(call) and - call = arg.getCall() and - idx = call.getCallee().getVaragsParameterIndex() and - not AutomodelJavaUtil::isUnexploitableType(arg.getType()) - } or - TMethodReturnValue(MethodCall call) { - AutomodelJavaUtil::isFromSource(call) and - not AutomodelJavaUtil::isUnexploitableType(call.getType()) - } or - TOverriddenParameter(Parameter p, Method overriddenMethod) { - AutomodelJavaUtil::isFromSource(p) and - p.getCallable().(Method).overrides(overriddenMethod) - } - -/** - * An endpoint is a node that is a candidate for modeling. - */ -abstract private class ApplicationModeEndpoint extends TApplicationModeEndpoint { - /** - * Gets the callable to be modeled that this endpoint represents. - */ - abstract Callable getCallable(); - - /** - * Gets the input (if any) for this endpoint, eg.: `Argument[0]`. - * - * For endpoints that are source candidates, this will be `none()`. - */ - abstract string getMaDInput(); - - /** - * Gets the output (if any) for this endpoint, eg.: `ReturnValue`. - * - * For endpoints that are sink candidates, this will be `none()`. - */ - abstract string getMaDOutput(); - - abstract Top asTop(); - - /** - * Converts the endpoint to a node that can be used in a data flow graph. - */ - abstract DataFlow::Node asNode(); - - string getExtensibleType() { - if not exists(this.getMaDInput()) and exists(this.getMaDOutput()) - then result = "sourceModel" - else - if exists(this.getMaDInput()) and not exists(this.getMaDOutput()) - then result = "sinkModel" - else none() // if both exist, it would be a summaryModel (not yet supported) - } - - abstract string toString(); -} - -class TCallArgument = TExplicitArgument or TInstanceArgument or TImplicitVarargsArray; - -/** - * An endpoint that represents an "argument" to a call in a broad sense, including - * both explicit arguments and the instance argument. - */ -abstract class CallArgument extends ApplicationModeEndpoint, TCallArgument { - Call call; - DataFlow::Node arg; - - override Callable getCallable() { result = call.getCallee().getSourceDeclaration() } - - override string getMaDOutput() { none() } - - override DataFlow::Node asNode() { result = arg } - - Call getCall() { result = call } - - override string toString() { result = arg.toString() } -} - -/** - * An endpoint that represents an explicit argument to a call. - */ -class ExplicitArgument extends CallArgument, TExplicitArgument { - ExplicitArgument() { this = TExplicitArgument(call, arg) } - - private int getArgIndex() { this.asTop() = call.getArgument(result) } - - override string getMaDInput() { result = "Argument[" + this.getArgIndex() + "]" } - - override Top asTop() { result = arg.asExpr() } -} - -/** - * An endpoint that represents the instance argument to a call. - */ -class InstanceArgument extends CallArgument, TInstanceArgument { - InstanceArgument() { this = TInstanceArgument(call, arg) } - - override string getMaDInput() { result = "Argument[this]" } - - override Top asTop() { if exists(arg.asExpr()) then result = arg.asExpr() else result = call } - - override string toString() { result = arg.toString() } -} - -/** - * An endpoint that represents an implicit varargs array. - * We choose to represent the varargs array as a single endpoint, rather than as multiple endpoints. - * - * This avoids the problem of having to deal with redundant endpoints downstream. - * - * In order to be able to distinguish between varargs endpoints and regular endpoints, we export the `isVarargsArray` - * meta data field in the extraction queries. - */ -class ImplicitVarargsArray extends CallArgument, TImplicitVarargsArray { - int idx; - - ImplicitVarargsArray() { this = TImplicitVarargsArray(call, arg, idx) } - - override string getMaDInput() { result = "Argument[" + idx + "]" } - - override Top asTop() { result = call } -} - -/** - * An endpoint that represents a method call. The `ReturnValue` of a method call - * may be a source. - */ -class MethodReturnValue extends ApplicationModeEndpoint, TMethodReturnValue { - MethodCall call; - - MethodReturnValue() { this = TMethodReturnValue(call) } - - override Callable getCallable() { result = call.getCallee().getSourceDeclaration() } - - override string getMaDInput() { none() } - - override string getMaDOutput() { result = "ReturnValue" } - - override Top asTop() { result = call } - - override DataFlow::Node asNode() { result.asExpr() = call } - - override string toString() { result = call.toString() } -} - -/** - * An endpoint that represents a parameter of an overridden method that may be - * a source. - */ -class OverriddenParameter extends ApplicationModeEndpoint, TOverriddenParameter { - Parameter p; - Method overriddenMethod; - - OverriddenParameter() { this = TOverriddenParameter(p, overriddenMethod) } - - override Callable getCallable() { - // NB: we're returning the overridden callable here. This means that the - // candidate model will be about the overridden method, not the overriding - // method. This is a more general model, that also applies to other - // subclasses of the overridden class. - result = overriddenMethod.getSourceDeclaration() - } - - private int getArgIndex() { p.getCallable().getParameter(result) = p } - - override string getMaDInput() { none() } - - override string getMaDOutput() { result = "Parameter[" + this.getArgIndex() + "]" } - - override Top asTop() { result = p } - - override DataFlow::Node asNode() { result.(DataFlow::ParameterNode).asParameter() = p } - - override string toString() { result = p.toString() } -} - -/** - * A candidates implementation. - * - * Some important notes: - * - This mode is using arguments as endpoints. - * - We use the `CallContext` (the surrounding call expression) as related location. - */ -module ApplicationCandidatesImpl implements SharedCharacteristics::CandidateSig { - // for documentation of the implementations here, see the QLDoc in the CandidateSig signature module. - class Endpoint = ApplicationModeEndpoint; - - class EndpointType = AutomodelEndpointTypes::EndpointType; - - class SinkType = AutomodelEndpointTypes::SinkType; - - class SourceType = AutomodelEndpointTypes::SourceType; - - class RelatedLocation = Location::Top; - - class RelatedLocationType = JavaRelatedLocationType; - - // Sanitizers are currently not modeled in MaD. TODO: check if this has large negative impact. - predicate isSanitizer(Endpoint e, EndpointType t) { - exists(t) and - AutomodelJavaUtil::isUnexploitableType([ - // for most endpoints, we can get the type from the node - e.asNode().getType(), - // but not for calls to void methods, where we need to go via the AST - e.asTop().(Expr).getType() - ]) - or - t instanceof AutomodelEndpointTypes::PathInjectionSinkType and - e.asNode() instanceof PathSanitizer::PathInjectionSanitizer - } - - RelatedLocation asLocation(Endpoint e) { result = e.asTop() } - - predicate isKnownKind = AutomodelJavaUtil::isKnownKind/2; - - predicate isSink(Endpoint e, string kind, string provenance) { - exists( - string package, string type, boolean subtypes, string name, string signature, string ext, - string input - | - sinkSpec(e, package, type, subtypes, name, signature, ext, input) and - ExternalFlow::sinkModel(package, type, subtypes, name, [signature, ""], ext, input, kind, - provenance, _) - ) - or - isCustomSink(e, kind) and provenance = "custom-sink" - } - - predicate isSource(Endpoint e, string kind, string provenance) { - exists( - string package, string type, boolean subtypes, string name, string signature, string ext, - string output - | - sourceSpec(e, package, type, subtypes, name, signature, ext, output) and - ExternalFlow::sourceModel(package, type, subtypes, name, [signature, ""], ext, output, kind, - provenance, _) - ) - } - - predicate isNeutral(Endpoint e) { - exists(string package, string type, string name, string signature, string endpointType | - sinkSpec(e, package, type, _, name, signature, _, _) and - endpointType = "sink" - or - sourceSpec(e, package, type, _, name, signature, _, _) and - endpointType = "source" - | - ExternalFlow::neutralModel(package, type, name, [signature, ""], endpointType, _) - ) - } - - /** - * Holds if the endpoint concerns a callable with the given package, type, name and signature. - * - * If `subtypes` is `false`, only the exact callable is considered. If `true`, the callable and - * all its overrides are considered. - */ - additional predicate endpointCallable( - Endpoint e, string package, string type, boolean subtypes, string name, string signature - ) { - exists(Callable c | - c = e.getCallable() and subtypes in [true, false] - or - e.getCallable().(Method).getSourceDeclaration().overrides+(c) and subtypes = true - | - c.hasQualifiedName(package, type, name) and - signature = ExternalFlow::paramsString(c) - ) - } - - additional predicate sinkSpec( - Endpoint e, string package, string type, boolean subtypes, string name, string signature, - string ext, string input - ) { - endpointCallable(e, package, type, subtypes, name, signature) and - ext = "" and - input = e.getMaDInput() - } - - additional predicate sourceSpec( - Endpoint e, string package, string type, boolean subtypes, string name, string signature, - string ext, string output - ) { - endpointCallable(e, package, type, subtypes, name, signature) and - ext = "" and - output = e.getMaDOutput() - } - - /** - * Gets the related location for the given endpoint. - * - * The only related location we model is the the call expression surrounding to - * which the endpoint is either argument or qualifier (known as the call context). - */ - RelatedLocation getRelatedLocation(Endpoint e, RelatedLocationType type) { - type = CallContext() and - result = e.(CallArgument).getCall() - or - type = MethodDoc() and - result = e.getCallable().(Documentable).getJavadoc() - or - type = ClassDoc() and - result = e.getCallable().getDeclaringType().(Documentable).getJavadoc() - } -} - -/** - * Contains endpoints that are defined in QL code rather than as a MaD model. Ideally this predicate - * should be empty. - */ -private predicate isCustomSink(Endpoint e, string kind) { - e.asNode() instanceof QueryInjectionSink and kind = "sql" -} - -module CharacteristicsImpl = - SharedCharacteristics::SharedCharacteristics; - -class EndpointCharacteristic = CharacteristicsImpl::EndpointCharacteristic; - -class Endpoint = ApplicationCandidatesImpl::Endpoint; - -/* - * Predicates that are used to surface prompt examples and candidates for classification with an ML model. - */ - -/** - * A MetadataExtractor that extracts metadata for application mode. - */ -class ApplicationModeMetadataExtractor extends string { - ApplicationModeMetadataExtractor() { this = "ApplicationModeMetadataExtractor" } - - predicate hasMetadata( - Endpoint e, string package, string type, string subtypes, string name, string signature, - string input, string output, string isVarargsArray, string alreadyAiModeled, - string extensibleType - ) { - exists(Callable callable | e.getCallable() = callable | - (if exists(e.getMaDInput()) then input = e.getMaDInput() else input = "") and - (if exists(e.getMaDOutput()) then output = e.getMaDOutput() else output = "") and - package = callable.getDeclaringType().getPackage().getName() and - // we're using the erased types because the MaD convention is to not specify type parameters. - // Whether something is or isn't a sink doesn't usually depend on the type parameters. - type = callable.getDeclaringType().getErasure().(RefType).getNestedName() and - subtypes = AutomodelJavaUtil::considerSubtypes(callable).toString() and - name = callable.getName() and - signature = ExternalFlow::paramsString(callable) and - ( - if e instanceof ImplicitVarargsArray - then isVarargsArray = "true" - else isVarargsArray = "false" - ) and - extensibleType = e.getExtensibleType() - ) and - ( - not CharacteristicsImpl::isModeled(e, _, extensibleType, _) and alreadyAiModeled = "" - or - CharacteristicsImpl::isModeled(e, _, extensibleType, alreadyAiModeled) - ) - } -} - -/** - * Holds if the given `endpoint` should be considered a candidate for the `extensibleType`. - * - * The other parameters record various other properties of interest. - */ -predicate isCandidate( - Endpoint endpoint, string package, string type, string subtypes, string name, string signature, - string input, string output, string isVarargs, string extensibleType, string alreadyAiModeled -) { - CharacteristicsImpl::isCandidate(endpoint, _) and - not exists(CharacteristicsImpl::UninterestingToModelCharacteristic u | - u.appliesToEndpoint(endpoint) - ) and - any(ApplicationModeMetadataExtractor meta) - .hasMetadata(endpoint, package, type, subtypes, name, signature, input, output, isVarargs, - alreadyAiModeled, extensibleType) and - // If a node is already modeled in MaD, we don't include it as a candidate. Otherwise, we might include it as a - // candidate for query A, but the model will label it as a sink for one of the sink types of query B, for which it's - // already a known sink. This would result in overlap between our detected sinks and the pre-existing modeling. We - // assume that, if a sink has already been modeled in a MaD model, then it doesn't belong to any additional sink - // types, and we don't need to reexamine it. - alreadyAiModeled.matches(["", "%ai-%"]) and - AutomodelJavaUtil::includeAutomodelCandidate(package, type, name, signature) -} - -/** - * Holds if the given `endpoint` is a negative example for the `extensibleType` - * because of the `characteristic`. - * - * The other parameters record various other properties of interest. - */ -predicate isNegativeExample( - Endpoint endpoint, EndpointCharacteristic characteristic, float confidence, string package, - string type, string subtypes, string name, string signature, string input, string output, - string isVarargsArray, string extensibleType -) { - characteristic.appliesToEndpoint(endpoint) and - // the node is known not to be an endpoint of any appropriate type - forall(AutomodelEndpointTypes::EndpointType tp | - tp = CharacteristicsImpl::getAPotentialType(endpoint) - | - characteristic.hasImplications(tp, false, _) - ) and - // the lowest confidence across all endpoint types should be at least highConfidence - confidence = - min(float c | - characteristic.hasImplications(CharacteristicsImpl::getAPotentialType(endpoint), false, c) - ) and - confidence >= SharedCharacteristics::highConfidence() and - any(ApplicationModeMetadataExtractor meta) - .hasMetadata(endpoint, package, type, subtypes, name, signature, input, output, - isVarargsArray, _, extensibleType) and - // It's valid for a node to be both a potential source/sanitizer and a sink. We don't want to include such nodes - // as negative examples in the prompt, because they're ambiguous and might confuse the model, so we explicitly exclude them here. - not exists(EndpointCharacteristic characteristic2, float confidence2 | - characteristic2 != characteristic - | - characteristic2.appliesToEndpoint(endpoint) and - confidence2 >= SharedCharacteristics::maximalConfidence() and - characteristic2 - .hasImplications(CharacteristicsImpl::getAPotentialType(endpoint), true, confidence2) - ) -} - -/** - * Holds if the given `endpoint` is a positive example for the `endpointType`. - * - * The other parameters record various other properties of interest. - */ -predicate isPositiveExample( - Endpoint endpoint, string endpointType, string package, string type, string subtypes, string name, - string signature, string input, string output, string isVarargsArray, string extensibleType -) { - any(ApplicationModeMetadataExtractor meta) - .hasMetadata(endpoint, package, type, subtypes, name, signature, input, output, - isVarargsArray, _, extensibleType) and - CharacteristicsImpl::isKnownAs(endpoint, endpointType, _) and - exists(CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, CallContext())) -} - -/* - * EndpointCharacteristic classes that are specific to Automodel for Java. - */ - -/** - * A negative characteristic that indicates that parameters of an is-style boolean method should not be considered sinks. - * - * A sink is highly unlikely to be exploitable if its callable's name starts with `is` and the callable has a boolean return - * type (e.g. `isDirectory`). These kinds of calls normally do only checks, and appear before the proper call that does - * the dangerous/interesting thing, so we want the latter to be modeled as the sink. - * - * TODO: this might filter too much, it's possible that methods with more than one parameter contain interesting sinks - */ -private class UnexploitableIsCharacteristic extends CharacteristicsImpl::NotASinkCharacteristic { - UnexploitableIsCharacteristic() { this = "argument of is-style boolean method" } - - override predicate appliesToEndpoint(Endpoint e) { - e.getCallable().getName().matches("is%") and - e.getCallable().getReturnType() instanceof BooleanType and - not ApplicationCandidatesImpl::isSink(e, _, _) - } -} - -/** - * A negative characteristic that indicates that parameters of an existence-checking boolean method should not be - * considered sinks. - * - * A sink is highly unlikely to be exploitable if its callable's name is `exists` or `notExists` and the callable has a - * boolean return type. These kinds of calls normally do only checks, and appear before the proper call that does the - * dangerous/interesting thing, so we want the latter to be modeled as the sink. - */ -private class UnexploitableExistsCharacteristic extends CharacteristicsImpl::NotASinkCharacteristic { - UnexploitableExistsCharacteristic() { this = "argument of existence-checking boolean method" } - - override predicate appliesToEndpoint(Endpoint e) { - exists(Callable callable | callable = e.getCallable() | - callable.getName().toLowerCase() = ["exists", "notexists"] and - callable.getReturnType() instanceof BooleanType - ) - } -} - -/** - * A negative characteristic that indicates that parameters of an exception method or constructor should not be considered sinks, - * and its return value should not be considered a source. - */ -private class ExceptionCharacteristic extends CharacteristicsImpl::NeitherSourceNorSinkCharacteristic -{ - ExceptionCharacteristic() { this = "argument/result of exception-related method" } - - override predicate appliesToEndpoint(Endpoint e) { - e.getCallable().getDeclaringType().getASupertype*() instanceof TypeThrowable and - ( - e.getExtensibleType() = "sinkModel" and - not ApplicationCandidatesImpl::isSink(e, _, _) - or - e.getExtensibleType() = "sourceModel" and - not ApplicationCandidatesImpl::isSource(e, _, _) and - e.getMaDOutput() = "ReturnValue" - ) - } -} - -/** - * A negative characteristic that indicates that an endpoint is a MaD taint step. MaD modeled taint steps are global, - * so they are not sinks for any query. Non-MaD taint steps might be specific to a particular query, so we don't - * filter those out. - */ -private class IsMaDTaintStepCharacteristic extends CharacteristicsImpl::NotASinkCharacteristic { - IsMaDTaintStepCharacteristic() { this = "taint step" } - - override predicate appliesToEndpoint(Endpoint e) { - FlowSummaryImpl::Private::Steps::summaryThroughStepValue(e.asNode(), _, _) - or - FlowSummaryImpl::Private::Steps::summaryThroughStepTaint(e.asNode(), _, _) - or - FlowSummaryImpl::Private::Steps::summaryGetterStep(e.asNode(), _, _, _) - or - FlowSummaryImpl::Private::Steps::summarySetterStep(e.asNode(), _, _, _) - } -} - -/** - * A call to a method that's known locally will not be considered as a candidate to model. - * - * The reason is that we would expect data/taint flow into the method implementation to uncover - * any sinks that are present there. - */ -private class LocalCall extends CharacteristicsImpl::UninterestingToModelCharacteristic { - LocalCall() { this = "local call" } - - override predicate appliesToEndpoint(Endpoint e) { - e.(CallArgument).getCallable().fromSource() - or - e.(MethodReturnValue).getCallable().fromSource() - } -} - -/** - * A characteristic that marks endpoints as uninteresting to model, according to the Java ModelExclusions module. - */ -private class ExcludedFromModeling extends CharacteristicsImpl::UninterestingToModelCharacteristic { - ExcludedFromModeling() { this = "excluded from modeling" } - - override predicate appliesToEndpoint(Endpoint e) { - ModelExclusions::isUninterestingForModels(e.getCallable()) - } -} - -/** - * A negative characteristic that filters out non-public methods. Non-public methods are not interesting to include in - * the standard Java modeling, because they cannot be called from outside the package. - */ -private class NonPublicMethodCharacteristic extends CharacteristicsImpl::UninterestingToModelCharacteristic -{ - NonPublicMethodCharacteristic() { this = "non-public method" } - - override predicate appliesToEndpoint(Endpoint e) { - exists(Callable c | c = e.getCallable() | not c.isPublic()) - } -} - -/** - * A negative characteristic that indicates that an endpoint is a non-sink argument to a method whose sinks have already - * been modeled _manually_. This is restricted to manual sinks only, because only during the manual process do we have - * the expectation that all sinks present in a method have been considered. - * - * WARNING: These endpoints should not be used as negative samples for training, because some sinks may have been missed - * when the method was modeled. Specifically, as we start using ATM to merge in new declarations, we can be less sure - * that a method with one argument modeled as a MaD sink has also had its remaining arguments manually reviewed. The - * ML model might have predicted argument 0 of some method to be a sink but not argument 1, when in fact argument 1 is - * also a sink. - */ -private class OtherArgumentToModeledMethodCharacteristic extends CharacteristicsImpl::LikelyNotASinkCharacteristic -{ - OtherArgumentToModeledMethodCharacteristic() { - this = "other argument to a method that has already been modeled manually" - } - - override predicate appliesToEndpoint(Endpoint e) { - not ApplicationCandidatesImpl::isSink(e, _, _) and - exists(CallArgument otherSink | - ApplicationCandidatesImpl::isSink(otherSink, _, "manual") and - e.(CallArgument).getCall() = otherSink.getCall() and - e != otherSink - ) - } -} - -/** - * Holds if the type of the given expression is annotated with `@FunctionalInterface`. - */ -predicate hasFunctionalInterfaceType(Expr e) { - exists(RefType tp | tp = e.getType().getErasure() | - tp.getAnAssociatedAnnotation().getType().hasQualifiedName("java.lang", "FunctionalInterface") - ) -} - -/** - * A characteristic that marks functional expression as likely not sinks. - * - * These expressions may well _contain_ sinks, but rarely are sinks themselves. - */ -private class FunctionValueCharacteristic extends CharacteristicsImpl::LikelyNotASinkCharacteristic { - FunctionValueCharacteristic() { this = "function value" } - - override predicate appliesToEndpoint(Endpoint e) { - exists(Expr expr | expr = e.asNode().asExpr() | - expr instanceof FunctionalExpr or hasFunctionalInterfaceType(expr) - ) - } -} - -/** - * A negative characteristic that indicates that an endpoint is not a `to` node for any known taint step. Such a node - * cannot be tainted, because taint can't flow into it. - * - * WARNING: These endpoints should not be used as negative samples for training, because they may include sinks for - * which our taint tracking modeling is incomplete. - */ -private class CannotBeTaintedCharacteristic extends CharacteristicsImpl::LikelyNotASinkCharacteristic -{ - CannotBeTaintedCharacteristic() { this = "cannot be tainted" } - - override predicate appliesToEndpoint(Endpoint e) { not this.isKnownOutNodeForStep(e) } - - /** - * Holds if the node `n` is known as the predecessor in a modeled flow step. - */ - private predicate isKnownOutNodeForStep(Endpoint e) { - e.asNode().asExpr() instanceof Call or // we just assume flow in that case - TaintTracking::localTaintStep(_, e.asNode()) or - FlowSummaryImpl::Private::Steps::summaryThroughStepValue(_, e.asNode(), _) or - FlowSummaryImpl::Private::Steps::summaryThroughStepTaint(_, e.asNode(), _) or - FlowSummaryImpl::Private::Steps::summaryGetterStep(_, _, e.asNode(), _) or - FlowSummaryImpl::Private::Steps::summarySetterStep(_, _, e.asNode(), _) - } -} diff --git a/java/ql/automodel/src/AutomodelApplicationModeExtractCandidates.ql b/java/ql/automodel/src/AutomodelApplicationModeExtractCandidates.ql deleted file mode 100644 index a3fa8b9b46f..00000000000 --- a/java/ql/automodel/src/AutomodelApplicationModeExtractCandidates.ql +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Surfaces the endpoints that are not already known to be sinks, and are therefore used as candidates for - * classification with an ML model. - * - * Note: This query does not actually classify the endpoints using the model. - * - * @name Automodel candidates (application mode) - * @description A query to extract automodel candidates in application mode. - * @kind problem - * @problem.severity recommendation - * @id java/ml/extract-automodel-application-candidates - * @tags internal extract automodel application-mode candidates - */ - -import java -private import AutomodelApplicationModeCharacteristics -private import AutomodelJavaUtil - -/** - * Gets a sample of endpoints (of at most `limit` samples) with the given method signature. - * - * The main purpose of this helper predicate is to avoid selecting too many candidates, as this may - * cause the SARIF file to exceed the maximum size limit. - */ -bindingset[limit] -private Endpoint getSampleForSignature( - int limit, string package, string type, string subtypes, string name, string signature, - string input, string output, string isVarargs, string extensibleType, string alreadyAiModeled -) { - exists(int n, int num_endpoints, ApplicationModeMetadataExtractor meta | - num_endpoints = - count(Endpoint e | - meta.hasMetadata(e, package, type, subtypes, name, signature, input, output, isVarargs, - alreadyAiModeled, extensibleType) - ) - | - result = - rank[n](Endpoint e, Location loc | - loc = e.asTop().getLocation() and - meta.hasMetadata(e, package, type, subtypes, name, signature, input, output, isVarargs, - alreadyAiModeled, extensibleType) - | - e - order by - loc.getFile().getAbsolutePath(), loc.getStartLine(), loc.getStartColumn(), - loc.getEndLine(), loc.getEndColumn() - ) and - // To avoid selecting samples that are too close together (as the ranking above goes by file - // path first), we select `limit` evenly spaced samples from the ranked list of endpoints. By - // default this would always include the first sample, so we add a random-chosen prime offset - // to the first sample index, and reduce modulo the number of endpoints. - // Finally, we add 1 to the result, as ranking results in a 1-indexed relation. - n = 1 + (([0 .. limit - 1] * (num_endpoints / limit).floor() + 46337) % num_endpoints) - ) -} - -from - Endpoint endpoint, DollarAtString package, DollarAtString type, DollarAtString subtypes, - DollarAtString name, DollarAtString signature, DollarAtString input, DollarAtString output, - DollarAtString isVarargsArray, DollarAtString alreadyAiModeled, DollarAtString extensibleType -where - isCandidate(endpoint, package, type, subtypes, name, signature, input, output, isVarargsArray, - extensibleType, alreadyAiModeled) and - endpoint = - getSampleForSignature(9, package, type, subtypes, name, signature, input, output, - isVarargsArray, extensibleType, alreadyAiModeled) -select endpoint.asNode(), - "Related locations: $@, $@, $@." + "\nmetadata: $@, $@, $@, $@, $@, $@, $@, $@, $@, $@.", // - CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, CallContext()), "CallContext", // - CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, MethodDoc()), "MethodDoc", // - CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, ClassDoc()), "ClassDoc", // - package, "package", // - type, "type", // - subtypes, "subtypes", // - name, "name", // method name - signature, "signature", // - input, "input", // - output, "output", // - isVarargsArray, "isVarargsArray", // - alreadyAiModeled, "alreadyAiModeled", // - extensibleType, "extensibleType" diff --git a/java/ql/automodel/src/AutomodelApplicationModeExtractNegativeExamples.ql b/java/ql/automodel/src/AutomodelApplicationModeExtractNegativeExamples.ql deleted file mode 100644 index a399c413fa4..00000000000 --- a/java/ql/automodel/src/AutomodelApplicationModeExtractNegativeExamples.ql +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Surfaces endpoints that are non-sinks with high confidence, for use as negative examples in the prompt. - * - * @name Negative examples (application mode) - * @kind problem - * @problem.severity recommendation - * @id java/ml/extract-automodel-application-negative-examples - * @tags internal extract automodel application-mode negative examples - */ - -private import java -private import AutomodelApplicationModeCharacteristics -private import AutomodelEndpointTypes -private import AutomodelJavaUtil - -/** - * Gets a sample of endpoints (of at most `limit` samples) for which the given characteristic applies. - * - * The main purpose of this helper predicate is to avoid selecting too many samples, as this may - * cause the SARIF file to exceed the maximum size limit. - */ -bindingset[limit] -Endpoint getSampleForCharacteristic(EndpointCharacteristic c, int limit) { - exists(int n, int num_endpoints | num_endpoints = count(Endpoint e | c.appliesToEndpoint(e)) | - result = - rank[n](Endpoint e, Location loc | - loc = e.asTop().getLocation() and c.appliesToEndpoint(e) - | - e - order by - loc.getFile().getAbsolutePath(), loc.getStartLine(), loc.getStartColumn(), - loc.getEndLine(), loc.getEndColumn() - ) and - // To avoid selecting samples that are too close together (as the ranking above goes by file - // path first), we select `limit` evenly spaced samples from the ranked list of endpoints. By - // default this would always include the first sample, so we add a random-chosen prime offset - // to the first sample index, and reduce modulo the number of endpoints. - // Finally, we add 1 to the result, as ranking results in a 1-indexed relation. - n = 1 + (([0 .. limit - 1] * (num_endpoints / limit).floor() + 46337) % num_endpoints) - ) -} - -from - Endpoint endpoint, EndpointCharacteristic characteristic, float confidence, string message, - DollarAtString package, DollarAtString type, DollarAtString subtypes, DollarAtString name, - DollarAtString signature, DollarAtString input, DollarAtString output, - DollarAtString isVarargsArray, DollarAtString extensibleType -where - endpoint = getSampleForCharacteristic(characteristic, 100) and - isNegativeExample(endpoint, characteristic, confidence, package, type, subtypes, name, signature, - input, output, isVarargsArray, extensibleType) and - message = characteristic -select endpoint.asNode(), - message + "\nrelated locations: $@, $@, $@." + "\nmetadata: $@, $@, $@, $@, $@, $@, $@, $@, $@.", // - CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, CallContext()), "CallContext", // - CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, MethodDoc()), "MethodDoc", // - CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, ClassDoc()), "ClassDoc", // - package, "package", // - type, "type", // - subtypes, "subtypes", // - name, "name", // - signature, "signature", // - input, "input", // - output, "output", // - isVarargsArray, "isVarargsArray", // - extensibleType, "extensibleType" diff --git a/java/ql/automodel/src/AutomodelApplicationModeExtractPositiveExamples.ql b/java/ql/automodel/src/AutomodelApplicationModeExtractPositiveExamples.ql deleted file mode 100644 index faf49b73fc1..00000000000 --- a/java/ql/automodel/src/AutomodelApplicationModeExtractPositiveExamples.ql +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Surfaces endpoints that are sinks with high confidence, for use as positive examples in the prompt. - * - * @name Positive examples (application mode) - * @kind problem - * @problem.severity recommendation - * @id java/ml/extract-automodel-application-positive-examples - * @tags internal extract automodel application-mode positive examples - */ - -private import AutomodelApplicationModeCharacteristics -private import AutomodelEndpointTypes -private import AutomodelJavaUtil - -from - Endpoint endpoint, EndpointType endpointType, ApplicationModeMetadataExtractor meta, - DollarAtString package, DollarAtString type, DollarAtString subtypes, DollarAtString name, - DollarAtString signature, DollarAtString input, DollarAtString output, - DollarAtString isVarargsArray, DollarAtString extensibleType -where - isPositiveExample(endpoint, endpointType, package, type, subtypes, name, signature, input, output, - isVarargsArray, extensibleType) -select endpoint.asNode(), - endpointType + "\nrelated locations: $@, $@, $@." + - "\nmetadata: $@, $@, $@, $@, $@, $@, $@, $@, $@.", // - CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, CallContext()), "CallContext", // - CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, MethodDoc()), "MethodDoc", // - CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, ClassDoc()), "ClassDoc", // - package, "package", // - type, "type", // - subtypes, "subtypes", // - name, "name", // - signature, "signature", // - input, "input", // - output, "output", // - isVarargsArray, "isVarargsArray", // - extensibleType, "extensibleType" diff --git a/java/ql/automodel/src/AutomodelCandidateFilter.yml b/java/ql/automodel/src/AutomodelCandidateFilter.yml deleted file mode 100644 index c945ae3206f..00000000000 --- a/java/ql/automodel/src/AutomodelCandidateFilter.yml +++ /dev/null @@ -1,5 +0,0 @@ -extensions: - - addsTo: - pack: codeql/java-automodel-queries - extensible: automodelCandidateFilter - data: [] diff --git a/java/ql/automodel/src/AutomodelCountGeneratedSinks.ql b/java/ql/automodel/src/AutomodelCountGeneratedSinks.ql deleted file mode 100644 index 475e3753810..00000000000 --- a/java/ql/automodel/src/AutomodelCountGeneratedSinks.ql +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @name Number of instances of each sink model - * @description Counts the number of instances of `ai-generated` sink models. - * @kind table - * @id java/ml/metrics-count-instances-per-sink-model - * @tags internal automodel metrics - */ - -private import java -private import AutomodelAlertSinkUtil - -from int instanceCount, SinkModel s -where - instanceCount = s.getInstanceCount() and - instanceCount > 0 and - s.getProvenance() = "ai-generated" -select instanceCount, s.getPackage() as package, s.getType() as type, s.getSubtypes() as subtypes, - s.getName() as name, s.getSignature() as signature, s.getInput() as input, s.getExt() as ext, - s.getKind() as kind, s.getProvenance() as provenance order by instanceCount desc diff --git a/java/ql/automodel/src/AutomodelEndpointTypes.qll b/java/ql/automodel/src/AutomodelEndpointTypes.qll deleted file mode 100644 index f4f7bc8eb7b..00000000000 --- a/java/ql/automodel/src/AutomodelEndpointTypes.qll +++ /dev/null @@ -1,82 +0,0 @@ -/** - * For internal use only. - * - * Defines the set of classes that endpoint scoring models can predict. Endpoint scoring models must - * only predict classes defined within this file. This file is the source of truth for the integer - * representation of each of these classes. - */ - -/** A class that can be predicted by a classifier. */ -abstract class EndpointType extends string { - /** - * Holds when the string matches the name of the sink / source type. - */ - bindingset[this] - EndpointType() { any() } - - /** - * Gets the name of the sink/source kind for this endpoint type as used in models-as-data. - * - * See https://github.com/github/codeql/blob/44213f0144fdd54bb679ca48d68b28dcf820f7a8/java/ql/lib/semmle/code/java/dataflow/ExternalFlow.qll#LL353C11-L357C31 - * for sink types, and https://github.com/github/codeql/blob/44213f0144fdd54bb679ca48d68b28dcf820f7a8/java/ql/lib/semmle/code/java/dataflow/ExternalFlow.qll#L365 - * for source types. - */ - final string getKind() { result = this } -} - -/** A class for sink types that can be predicted by a classifier. */ -abstract class SinkType extends EndpointType { - bindingset[this] - SinkType() { any() } -} - -/** A sink relevant to the SQL injection query */ -class SqlInjectionSinkType extends SinkType { - SqlInjectionSinkType() { this = "sql-injection" } -} - -/** A sink relevant to the tainted path injection query. */ -class PathInjectionSinkType extends SinkType { - PathInjectionSinkType() { this = "path-injection" } -} - -/** A sink relevant to the SSRF query. */ -class RequestForgerySinkType extends SinkType { - RequestForgerySinkType() { this = "request-forgery" } -} - -/** A sink relevant to the command injection query. */ -class CommandInjectionSinkType extends SinkType { - CommandInjectionSinkType() { this = "command-injection" } -} - -/** A sink relevant to file storage. */ -class FileContentStoreSinkType extends SinkType { - FileContentStoreSinkType() { this = "file-content-store" } -} - -/** A sink relevant to HTML injection. */ -class HtmlInjectionSinkType extends SinkType { - HtmlInjectionSinkType() { this = "html-injection" } -} - -/** A sink relevant to LDAP injection. */ -class LdapInjectionSinkType extends SinkType { - LdapInjectionSinkType() { this = "ldap-injection" } -} - -/** A sink relevant to URL redirection. */ -class UrlRedirectionSinkType extends SinkType { - UrlRedirectionSinkType() { this = "url-redirection" } -} - -/** A class for source types that can be predicted by a classifier. */ -abstract class SourceType extends EndpointType { - bindingset[this] - SourceType() { any() } -} - -/** A source of remote data. */ -class RemoteSourceType extends SourceType { - RemoteSourceType() { this = "remote" } -} diff --git a/java/ql/automodel/src/AutomodelFrameworkModeCharacteristics.qll b/java/ql/automodel/src/AutomodelFrameworkModeCharacteristics.qll deleted file mode 100644 index 7f385a41d1e..00000000000 --- a/java/ql/automodel/src/AutomodelFrameworkModeCharacteristics.qll +++ /dev/null @@ -1,507 +0,0 @@ -/** - * For internal use only. - */ - -private import java -private import semmle.code.Location as Location -private import semmle.code.java.dataflow.DataFlow -private import semmle.code.java.dataflow.TaintTracking -private import semmle.code.java.dataflow.ExternalFlow as ExternalFlow -private import semmle.code.java.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl -private import semmle.code.java.security.ExternalAPIs as ExternalAPIs -private import semmle.code.java.Expr as Expr -private import semmle.code.java.security.QueryInjection -private import semmle.code.java.security.RequestForgery -private import semmle.code.java.dataflow.internal.ModelExclusions as ModelExclusions -private import AutomodelJavaUtil as AutomodelJavaUtil -import AutomodelSharedCharacteristics as SharedCharacteristics -import AutomodelEndpointTypes as AutomodelEndpointTypes - -newtype JavaRelatedLocationType = - MethodDoc() or - ClassDoc() - -newtype TFrameworkModeEndpoint = - TExplicitParameter(Parameter p) { - AutomodelJavaUtil::isFromSource(p) and - not AutomodelJavaUtil::isUnexploitableType(p.getType()) - } or - TQualifier(Callable c) { AutomodelJavaUtil::isFromSource(c) and not c instanceof Constructor } or - TReturnValue(Callable c) { - AutomodelJavaUtil::isFromSource(c) and - c instanceof Constructor - or - AutomodelJavaUtil::isFromSource(c) and - c instanceof Method and - not AutomodelJavaUtil::isUnexploitableType(c.getReturnType()) - } or - TOverridableParameter(Method m, Parameter p) { - AutomodelJavaUtil::isFromSource(p) and - not AutomodelJavaUtil::isUnexploitableType(p.getType()) and - p.getCallable() = m and - m instanceof ModelExclusions::ModelApi and - AutomodelJavaUtil::isOverridable(m) - } or - TOverridableQualifier(Method m) { - AutomodelJavaUtil::isFromSource(m) and - m instanceof ModelExclusions::ModelApi and - AutomodelJavaUtil::isOverridable(m) - } - -/** - * A framework mode endpoint. - */ -abstract class FrameworkModeEndpoint extends TFrameworkModeEndpoint { - /** - * Gets the input (if any) for this endpoint, eg.: `Argument[0]`. - * - * For endpoints that are source candidates, this will be `none()`. - */ - abstract string getMaDInput(); - - /** - * Gets the output (if any) for this endpoint, eg.: `ReturnValue`. - * - * For endpoints that are sink candidates, this will be `none()`. - */ - abstract string getMaDOutput(); - - /** - * Returns the name of the parameter of the endpoint. - */ - abstract string getParamName(); - - /** - * Returns the callable that contains the endpoint. - */ - abstract Callable getCallable(); - - abstract Top asTop(); - - abstract string getExtensibleType(); - - string toString() { result = this.asTop().toString() } - - Location getLocation() { result = this.asTop().getLocation() } -} - -class ExplicitParameterEndpoint extends FrameworkModeEndpoint, TExplicitParameter { - Parameter param; - - ExplicitParameterEndpoint() { this = TExplicitParameter(param) and param.fromSource() } - - override string getMaDInput() { result = "Argument[" + param.getPosition() + "]" } - - override string getMaDOutput() { none() } - - override string getParamName() { result = param.getName() } - - override Callable getCallable() { result = param.getCallable() } - - override Top asTop() { result = param } - - override string getExtensibleType() { result = "sinkModel" } -} - -class QualifierEndpoint extends FrameworkModeEndpoint, TQualifier { - Callable callable; - - QualifierEndpoint() { - this = TQualifier(callable) and not callable.isStatic() and callable.fromSource() - } - - override string getMaDInput() { result = "Argument[this]" } - - override string getMaDOutput() { none() } - - override string getParamName() { result = "this" } - - override Callable getCallable() { result = callable } - - override Top asTop() { result = callable } - - override string getExtensibleType() { result = "sinkModel" } -} - -class ReturnValue extends FrameworkModeEndpoint, TReturnValue { - Callable callable; - - ReturnValue() { this = TReturnValue(callable) and callable.fromSource() } - - override string getMaDInput() { none() } - - override string getMaDOutput() { result = "ReturnValue" } - - override string getParamName() { none() } - - override Callable getCallable() { result = callable } - - override Top asTop() { result = callable } - - override string getExtensibleType() { result = "sourceModel" } -} - -class OverridableParameter extends FrameworkModeEndpoint, TOverridableParameter { - Method method; - Parameter param; - - OverridableParameter() { this = TOverridableParameter(method, param) } - - override string getMaDInput() { none() } - - override string getMaDOutput() { result = "Parameter[" + param.getPosition() + "]" } - - override string getParamName() { result = param.getName() } - - override Callable getCallable() { result = method } - - override Top asTop() { result = param } - - override string getExtensibleType() { result = "sourceModel" } -} - -class OverridableQualifier extends FrameworkModeEndpoint, TOverridableQualifier { - Method m; - - OverridableQualifier() { this = TOverridableQualifier(m) } - - override string getMaDInput() { none() } - - override string getMaDOutput() { result = "Parameter[this]" } - - override string getParamName() { result = "this" } - - override Callable getCallable() { result = m } - - override Top asTop() { result = m } - - override string getExtensibleType() { result = "sourceModel" } -} - -/** - * A candidates implementation for framework mode. - * - * Some important notes: - * - This mode is using parameters as endpoints. - * - Sink- and neutral-information is being used from MaD models. - * - When available, we use method- and class-java-docs as related locations. - */ -module FrameworkCandidatesImpl implements SharedCharacteristics::CandidateSig { - // for documentation of the implementations here, see the QLDoc in the CandidateSig signature module. - class Endpoint = FrameworkModeEndpoint; - - class EndpointType = AutomodelEndpointTypes::EndpointType; - - class SinkType = AutomodelEndpointTypes::SinkType; - - class SourceType = AutomodelEndpointTypes::SourceType; - - class RelatedLocation = Location::Top; - - class RelatedLocationType = JavaRelatedLocationType; - - // Sanitizers are currently not modeled in MaD. TODO: check if this has large negative impact. - predicate isSanitizer(Endpoint e, EndpointType t) { none() } - - RelatedLocation asLocation(Endpoint e) { result = e.asTop() } - - predicate isKnownKind = AutomodelJavaUtil::isKnownKind/2; - - predicate isSink(Endpoint e, string kind, string provenance) { - exists( - string package, string type, boolean subtypes, string name, string signature, string ext, - string input - | - sinkSpec(e, package, type, subtypes, name, signature, ext, input) and - ExternalFlow::sinkModel(package, type, subtypes, name, [signature, ""], ext, input, kind, - provenance, _) - ) - } - - predicate isSource(Endpoint e, string kind, string provenance) { - exists( - string package, string type, boolean subtypes, string name, string signature, string ext, - string output - | - sourceSpec(e, package, type, subtypes, name, signature, ext, output) and - ExternalFlow::sourceModel(package, type, subtypes, name, [signature, ""], ext, output, kind, - provenance, _) - ) - } - - predicate isNeutral(Endpoint e) { - exists(string package, string type, string name, string signature, string endpointType | - sinkSpec(e, package, type, _, name, signature, _, _) and - endpointType = "sink" - or - sourceSpec(e, package, type, _, name, signature, _, _) and - endpointType = "source" - | - ExternalFlow::neutralModel(package, type, name, [signature, ""], endpointType, _) - ) - } - - /** - * Holds if the endpoint concerns a callable with the given package, type, name and signature. - * - * If `subtypes` is `false`, only the exact callable is considered. If `true`, the callable and - * all its overrides are considered. - */ - additional predicate endpointCallable( - Endpoint e, string package, string type, boolean subtypes, string name, string signature - ) { - exists(Callable c | - c = e.getCallable() and subtypes in [true, false] - or - e.getCallable().(Method).getSourceDeclaration().overrides+(c) and subtypes = true - | - c.hasQualifiedName(package, type, name) and - signature = ExternalFlow::paramsString(c) - ) - } - - additional predicate sinkSpec( - Endpoint e, string package, string type, boolean subtypes, string name, string signature, - string ext, string input - ) { - endpointCallable(e, package, type, subtypes, name, signature) and - ext = "" and - input = e.getMaDInput() - } - - additional predicate sourceSpec( - Endpoint e, string package, string type, boolean subtypes, string name, string signature, - string ext, string output - ) { - endpointCallable(e, package, type, subtypes, name, signature) and - ext = "" and - output = e.getMaDOutput() - } - - /** - * Gets the related location for the given endpoint. - * - * Related locations can be JavaDoc comments of the class or the method. - */ - RelatedLocation getRelatedLocation(Endpoint e, RelatedLocationType type) { - type = MethodDoc() and - result = e.getCallable().(Documentable).getJavadoc() - or - type = ClassDoc() and - result = e.getCallable().getDeclaringType().(Documentable).getJavadoc() - } -} - -module CharacteristicsImpl = SharedCharacteristics::SharedCharacteristics; - -class EndpointCharacteristic = CharacteristicsImpl::EndpointCharacteristic; - -class Endpoint = FrameworkCandidatesImpl::Endpoint; - -/* - * Predicates that are used to surface prompt examples and candidates for classification with an ML model. - */ - -/** - * A MetadataExtractor that extracts metadata for framework mode. - */ -class FrameworkModeMetadataExtractor extends string { - FrameworkModeMetadataExtractor() { this = "FrameworkModeMetadataExtractor" } - - predicate hasMetadata( - Endpoint e, string package, string type, string subtypes, string name, string signature, - string input, string output, string parameterName, string alreadyAiModeled, - string extensibleType - ) { - exists(Callable callable | e.getCallable() = callable | - (if exists(e.getMaDInput()) then input = e.getMaDInput() else input = "") and - (if exists(e.getMaDOutput()) then output = e.getMaDOutput() else output = "") and - package = callable.getDeclaringType().getPackage().getName() and - // we're using the erased types because the MaD convention is to not specify type parameters. - // Whether something is or isn't a sink doesn't usually depend on the type parameters. - type = callable.getDeclaringType().getErasure().(RefType).getNestedName() and - subtypes = AutomodelJavaUtil::considerSubtypes(callable).toString() and - name = callable.getName() and - signature = ExternalFlow::paramsString(callable) and - (if exists(e.getParamName()) then parameterName = e.getParamName() else parameterName = "") and - e.getExtensibleType() = extensibleType - ) and - ( - not CharacteristicsImpl::isModeled(e, _, extensibleType, _) and alreadyAiModeled = "" - or - CharacteristicsImpl::isModeled(e, _, extensibleType, alreadyAiModeled) - ) - } -} - -/** - * Holds if the given `endpoint` should be considered a candidate for the `extensibleType`. - * - * The other parameters record various other properties of interest. - */ -predicate isCandidate( - Endpoint endpoint, string package, string type, string subtypes, string name, string signature, - string input, string output, string parameterName, string extensibleType, string alreadyAiModeled -) { - CharacteristicsImpl::isCandidate(endpoint, _) and - not exists(CharacteristicsImpl::UninterestingToModelCharacteristic u | - u.appliesToEndpoint(endpoint) - ) and - any(FrameworkModeMetadataExtractor meta) - .hasMetadata(endpoint, package, type, subtypes, name, signature, input, output, parameterName, - alreadyAiModeled, extensibleType) and - // If a node is already modeled in MaD, we don't include it as a candidate. Otherwise, we might include it as a - // candidate for query A, but the model will label it as a sink for one of the sink types of query B, for which it's - // already a known sink. This would result in overlap between our detected sinks and the pre-existing modeling. We - // assume that, if a sink has already been modeled in a MaD model, then it doesn't belong to any additional sink - // types, and we don't need to reexamine it. - alreadyAiModeled.matches(["", "%ai-%"]) and - AutomodelJavaUtil::includeAutomodelCandidate(package, type, name, signature) -} - -/** - * Holds if the given `endpoint` is a negative example for the `extensibleType` - * because of the `characteristic`. - * - * The other parameters record various other properties of interest. - */ -predicate isNegativeExample( - Endpoint endpoint, EndpointCharacteristic characteristic, float confidence, string package, - string type, string subtypes, string name, string signature, string input, string output, - string parameterName, string extensibleType -) { - characteristic.appliesToEndpoint(endpoint) and - // the node is known not to be an endpoint of any appropriate type - forall(AutomodelEndpointTypes::EndpointType tp | - tp = CharacteristicsImpl::getAPotentialType(endpoint) - | - characteristic.hasImplications(tp, false, _) - ) and - // the lowest confidence across all endpoint types should be at least highConfidence - confidence = - min(float c | - characteristic.hasImplications(CharacteristicsImpl::getAPotentialType(endpoint), false, c) - ) and - confidence >= SharedCharacteristics::highConfidence() and - any(FrameworkModeMetadataExtractor meta) - .hasMetadata(endpoint, package, type, subtypes, name, signature, input, output, parameterName, - _, extensibleType) and - // It's valid for a node to be both a potential source/sanitizer and a sink. We don't want to include such nodes - // as negative examples in the prompt, because they're ambiguous and might confuse the model, so we explicitly exclude them here. - not exists(EndpointCharacteristic characteristic2, float confidence2 | - characteristic2 != characteristic - | - characteristic2.appliesToEndpoint(endpoint) and - confidence2 >= SharedCharacteristics::maximalConfidence() and - characteristic2 - .hasImplications(CharacteristicsImpl::getAPotentialType(endpoint), true, confidence2) - ) -} - -/** - * Holds if the given `endpoint` is a positive example for the `endpointType`. - * - * The other parameters record various other properties of interest. - */ -predicate isPositiveExample( - Endpoint endpoint, string endpointType, string package, string type, string subtypes, string name, - string signature, string input, string output, string parameterName, string extensibleType -) { - any(FrameworkModeMetadataExtractor meta) - .hasMetadata(endpoint, package, type, subtypes, name, signature, input, output, parameterName, - _, extensibleType) and - CharacteristicsImpl::isKnownAs(endpoint, endpointType, _) -} - -/* - * EndpointCharacteristic classes that are specific to Automodel for Java. - */ - -/** - * A negative characteristic that indicates that parameters of an is-style boolean method should not be considered sinks, - * and its return value should not be considered a source. - * - * A sink is highly unlikely to be exploitable if its callable's name starts with `is` and the callable has a boolean return - * type (e.g. `isDirectory`). These kinds of calls normally do only checks, and appear before the proper call that does - * the dangerous/interesting thing, so we want the latter to be modeled as the sink. - * - * TODO: this might filter too much, it's possible that methods with more than one parameter contain interesting sinks - */ -private class UnexploitableIsCharacteristic extends CharacteristicsImpl::NeitherSourceNorSinkCharacteristic -{ - UnexploitableIsCharacteristic() { this = "argument of is-style boolean method" } - - override predicate appliesToEndpoint(Endpoint e) { - e.getCallable().getName().matches("is%") and - e.getCallable().getReturnType() instanceof BooleanType and - ( - e.getExtensibleType() = "sinkModel" and - not FrameworkCandidatesImpl::isSink(e, _, _) - or - e.getExtensibleType() = "sourceModel" and - not FrameworkCandidatesImpl::isSource(e, _, _) and - e.getMaDOutput() = "ReturnValue" - ) - } -} - -/** - * A negative characteristic that indicates that parameters of an existence-checking boolean method should not be - * considered sinks, and its return value should not be considered a source. - * - * A sink is highly unlikely to be exploitable if its callable's name is `exists` or `notExists` and the callable has a - * boolean return type. These kinds of calls normally do only checks, and appear before the proper call that does the - * dangerous/interesting thing, so we want the latter to be modeled as the sink. - */ -private class UnexploitableExistsCharacteristic extends CharacteristicsImpl::NeitherSourceNorSinkCharacteristic -{ - UnexploitableExistsCharacteristic() { this = "argument of existence-checking boolean method" } - - override predicate appliesToEndpoint(Endpoint e) { - exists(Callable callable | - callable = e.getCallable() and - callable.getName().toLowerCase() = ["exists", "notexists"] and - callable.getReturnType() instanceof BooleanType - | - e.getExtensibleType() = "sinkModel" and - not FrameworkCandidatesImpl::isSink(e, _, _) - or - e.getExtensibleType() = "sourceModel" and - not FrameworkCandidatesImpl::isSource(e, _, _) and - e.getMaDOutput() = "ReturnValue" - ) - } -} - -/** - * A negative characteristic that indicates that parameters of an exception method or constructor should not be considered sinks, - * and its return value should not be considered a source. - */ -private class ExceptionCharacteristic extends CharacteristicsImpl::NeitherSourceNorSinkCharacteristic -{ - ExceptionCharacteristic() { this = "argument/result of exception-related method" } - - override predicate appliesToEndpoint(Endpoint e) { - e.getCallable().getDeclaringType().getASupertype*() instanceof TypeThrowable and - ( - e.getExtensibleType() = "sinkModel" and - not FrameworkCandidatesImpl::isSink(e, _, _) - or - e.getExtensibleType() = "sourceModel" and - not FrameworkCandidatesImpl::isSource(e, _, _) and - e.getMaDOutput() = "ReturnValue" - ) - } -} - -/** - * A characteristic that limits candidates to parameters of methods that are recognized as `ModelApi`, iow., APIs that - * are considered worth modeling. - */ -private class NotAModelApi extends CharacteristicsImpl::UninterestingToModelCharacteristic { - NotAModelApi() { this = "not a model API" } - - override predicate appliesToEndpoint(Endpoint e) { - not e.getCallable() instanceof ModelExclusions::ModelApi - } -} diff --git a/java/ql/automodel/src/AutomodelFrameworkModeExtractCandidates.ql b/java/ql/automodel/src/AutomodelFrameworkModeExtractCandidates.ql deleted file mode 100644 index 83683b4e78f..00000000000 --- a/java/ql/automodel/src/AutomodelFrameworkModeExtractCandidates.ql +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Surfaces the endpoints that are not already known to be sinks, and are therefore used as candidates for - * classification with an ML model. - * - * Note: This query does not actually classify the endpoints using the model. - * - * @name Automodel candidates (framework mode) - * @description A query to extract automodel candidates in framework mode. - * @kind problem - * @problem.severity recommendation - * @id java/ml/extract-automodel-framework-candidates - * @tags internal extract automodel framework-mode candidates - */ - -private import AutomodelFrameworkModeCharacteristics -private import AutomodelJavaUtil - -from - Endpoint endpoint, DollarAtString package, DollarAtString type, DollarAtString subtypes, - DollarAtString name, DollarAtString signature, DollarAtString input, DollarAtString output, - DollarAtString parameterName, DollarAtString alreadyAiModeled, DollarAtString extensibleType -where - isCandidate(endpoint, package, type, subtypes, name, signature, input, output, parameterName, - extensibleType, alreadyAiModeled) -select endpoint, - "Related locations: $@, $@." + "\nmetadata: $@, $@, $@, $@, $@, $@, $@, $@, $@, $@.", // - CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, MethodDoc()), "MethodDoc", // - CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, ClassDoc()), "ClassDoc", // - package, "package", // - type, "type", // - subtypes, "subtypes", // - name, "name", // - signature, "signature", // - input, "input", // - output, "output", // - parameterName, "parameterName", // - alreadyAiModeled, "alreadyAiModeled", // - extensibleType, "extensibleType" diff --git a/java/ql/automodel/src/AutomodelFrameworkModeExtractNegativeExamples.ql b/java/ql/automodel/src/AutomodelFrameworkModeExtractNegativeExamples.ql deleted file mode 100644 index 05e5951b061..00000000000 --- a/java/ql/automodel/src/AutomodelFrameworkModeExtractNegativeExamples.ql +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Surfaces endpoints that are non-sinks with high confidence, for use as negative examples in the prompt. - * - * @name Negative examples (framework mode) - * @kind problem - * @problem.severity recommendation - * @id java/ml/extract-automodel-framework-negative-examples - * @tags internal extract automodel framework-mode negative examples - */ - -private import AutomodelFrameworkModeCharacteristics -private import AutomodelEndpointTypes -private import AutomodelJavaUtil - -from - Endpoint endpoint, EndpointCharacteristic characteristic, float confidence, - DollarAtString package, DollarAtString type, DollarAtString subtypes, DollarAtString name, - DollarAtString signature, DollarAtString input, DollarAtString output, - DollarAtString parameterName, DollarAtString extensibleType -where - isNegativeExample(endpoint, characteristic, confidence, package, type, subtypes, name, signature, - input, output, parameterName, extensibleType) -select endpoint, - characteristic + "\nrelated locations: $@, $@." + - "\nmetadata: $@, $@, $@, $@, $@, $@, $@, $@, $@.", // - CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, MethodDoc()), "MethodDoc", // - CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, ClassDoc()), "ClassDoc", // - package, "package", // - type, "type", // - subtypes, "subtypes", // - name, "name", // - signature, "signature", // - input, "input", // - output, "output", // - parameterName, "parameterName", // - extensibleType, "extensibleType" diff --git a/java/ql/automodel/src/AutomodelFrameworkModeExtractPositiveExamples.ql b/java/ql/automodel/src/AutomodelFrameworkModeExtractPositiveExamples.ql deleted file mode 100644 index 7cb023949ed..00000000000 --- a/java/ql/automodel/src/AutomodelFrameworkModeExtractPositiveExamples.ql +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Surfaces endpoints that are sinks with high confidence, for use as positive examples in the prompt. - * - * @name Positive examples (framework mode) - * @kind problem - * @problem.severity recommendation - * @id java/ml/extract-automodel-framework-positive-examples - * @tags internal extract automodel framework-mode positive examples - */ - -private import AutomodelFrameworkModeCharacteristics -private import AutomodelEndpointTypes -private import AutomodelJavaUtil - -from - Endpoint endpoint, EndpointType endpointType, DollarAtString package, DollarAtString type, - DollarAtString subtypes, DollarAtString name, DollarAtString signature, DollarAtString input, - DollarAtString output, DollarAtString parameterName, DollarAtString extensibleType -where - isPositiveExample(endpoint, endpointType, package, type, subtypes, name, signature, input, output, - parameterName, extensibleType) -select endpoint, - endpointType + "\nrelated locations: $@, $@." + "\nmetadata: $@, $@, $@, $@, $@, $@, $@, $@, $@.", // - CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, MethodDoc()), "MethodDoc", // - CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, ClassDoc()), "ClassDoc", // - package, "package", // - type, "type", // - subtypes, "subtypes", // - name, "name", // - signature, "signature", // - input, "input", // - output, "output", // - parameterName, "parameterName", // - extensibleType, "extensibleType" diff --git a/java/ql/automodel/src/AutomodelJavaUtil.qll b/java/ql/automodel/src/AutomodelJavaUtil.qll deleted file mode 100644 index 368fb172483..00000000000 --- a/java/ql/automodel/src/AutomodelJavaUtil.qll +++ /dev/null @@ -1,111 +0,0 @@ -private import java -private import AutomodelEndpointTypes as AutomodelEndpointTypes - -/** - * A helper class to represent a string value that can be returned by a query using $@ notation. - * - * It extends `string`, but adds a mock `hasLocationInfo` method that returns the string itself as the file name. - * - * Use this, when you want to return a string value from a query using $@ notation - the string value - * will be included in the sarif file. - * - * - * Background information on `hasLocationInfo`: - * https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/#providing-location-information - */ -class DollarAtString extends string { - bindingset[this] - DollarAtString() { any() } - - bindingset[this] - predicate hasLocationInfo(string path, int sl, int sc, int el, int ec) { - path = this and sl = 1 and sc = 1 and el = 1 and ec = 1 - } -} - -/** - * Holds for all combinations of MaD kinds (`kind`) and their human readable - * descriptions. - */ -predicate isKnownKind(string kind, AutomodelEndpointTypes::EndpointType type) { - kind = type.getKind() -} - -/** - * By convention, the subtypes property of the MaD declaration should only be - * true when there _can_ exist any subtypes with a different implementation. - * - * It would technically be ok to always use the value 'true', but this would - * break convention. - */ -pragma[nomagic] -boolean considerSubtypes(Callable callable) { - if - callable.isStatic() or - callable.getDeclaringType().isStatic() or - callable.isFinal() or - callable.getDeclaringType().isFinal() - then result = false - else result = true -} - -/** - * Holds if the given package, type, name and signature is a candidate for automodeling. - * - * This predicate is extensible, so that different endpoints can be selected at runtime. - */ -extensible predicate automodelCandidateFilter( - string package, string type, string name, string signature -); - -/** - * Holds if the given package, type, name and signature is a candidate for automodeling. - * - * This relies on an extensible predicate, and if that is not supplied then - * all endpoints are considered candidates. - */ -bindingset[package, type, name, signature] -predicate includeAutomodelCandidate(string package, string type, string name, string signature) { - not automodelCandidateFilter(_, _, _, _) or - automodelCandidateFilter(package, type, name, signature) -} - -/** - * Holds if the given program element corresponds to a piece of source code, - * that is, it is not compiler-generated. - * - * Note: This is a stricter check than `Element::fromSource`, which simply - * checks whether the element is in a source file as opposed to a JAR file. - * There can be compiler-generated elements in source files (especially for - * Kotlin), which we also want to exclude. - */ -predicate isFromSource(Element e) { - // from a source file (not a JAR) - e.fromSource() and - // not explicitly marked as compiler-generated - not e.isCompilerGenerated() and - // does not have a dummy location - not e.hasLocationInfo(_, 0, 0, 0, 0) -} - -/** - * Holds if taint cannot flow through the given type (because it is a numeric - * type or some other type with a fixed set of values). - */ -predicate isUnexploitableType(Type tp) { - tp instanceof PrimitiveType or - tp instanceof BoxedType or - tp instanceof NumberType or - tp instanceof VoidType -} - -/** - * Holds if the given method can be overridden, that is, it is not final, - * static, or private. - */ -predicate isOverridable(Method m) { - not m.getDeclaringType().isFinal() and - not m.isFinal() and - not m.isStatic() and - not m.isPrivate() -} diff --git a/java/ql/automodel/src/AutomodelSharedCharacteristics.qll b/java/ql/automodel/src/AutomodelSharedCharacteristics.qll deleted file mode 100644 index 273c5d30dec..00000000000 --- a/java/ql/automodel/src/AutomodelSharedCharacteristics.qll +++ /dev/null @@ -1,412 +0,0 @@ -float maximalConfidence() { result = 1.0 } - -float highConfidence() { result = 0.9 } - -float mediumConfidence() { result = 0.6 } - -/** - * A specification of how to instantiate the shared characteristics for a given candidate class. - * - * The `CandidateSig` implementation specifies a type to use for Endpoints (eg., `ParameterNode`), as well as a type - * to label endpoint classes (the `EndpointType`). One of the endpoint classes needs to be a 'negative' class, meaning - * "not any of the other known endpoint types". - */ -signature module CandidateSig { - /** - * An endpoint is a potential candidate for modeling. This will typically be bound to the language's - * DataFlow node class, or a subtype thereof. - */ - class Endpoint { - /** - * Gets the kind of this endpoint, either "sourceModel" or "sinkModel". - */ - string getExtensibleType(); - - /** - * Gets a string representation of this endpoint. - */ - string toString(); - } - - /** - * A related location for an endpoint. This will typically be bound to the supertype of all AST nodes (eg., `Top`). - */ - class RelatedLocation; - - /** - * A label for a related location. - * - * Eg., method-doc, class-doc, etc. - */ - class RelatedLocationType; - - /** - * An endpoint type considered by this specification. - */ - class EndpointType extends string; - - /** - * A sink endpoint type considered by this specification. - */ - class SinkType extends EndpointType; - - /** - * A source endpoint type considered by this specification. - */ - class SourceType extends EndpointType; - - /** - * Gets the endpoint as a location. - * - * This is a utility function to convert an endpoint to its corresponding location. - */ - RelatedLocation asLocation(Endpoint e); - - /** - * Defines what MaD kinds are known, and what endpoint type they correspond to. - */ - predicate isKnownKind(string kind, EndpointType type); - - /** - * Holds if `e` is a flow sanitizer, and has type `t`. - */ - predicate isSanitizer(Endpoint e, EndpointType t); - - /** - * Holds if `e` is a sink with the label `kind`, and provenance `provenance`. - */ - predicate isSink(Endpoint e, string kind, string provenance); - - /** - * Holds if `e` is a source with the label `kind`, and provenance `provenance`. - */ - predicate isSource(Endpoint e, string kind, string provenance); - - /** - * Holds if `e` is not a source or sink of any kind. - */ - predicate isNeutral(Endpoint e); - - /** - * Gets a related location. - * - * A related location is a source code location that may hold extra information about an endpoint that can be useful - * to the machine learning model. - * - * For example, a related location for a method call may be the documentation comment of a method. - */ - RelatedLocation getRelatedLocation(Endpoint e, RelatedLocationType name); -} - -/** - * A set of shared characteristics for a given candidate class. - * - * This module is language-agnostic, although the `CandidateSig` module will be language-specific. - * - * The language specific implementation can also further extend the behavior of this module by adding additional - * implementations of endpoint characteristics exported by this module. - */ -module SharedCharacteristics { - predicate isSink = Candidate::isSink/3; - - predicate isNeutral = Candidate::isNeutral/1; - - predicate isModeled(Candidate::Endpoint e, string kind, string extensibleKind, string provenance) { - Candidate::isSink(e, kind, provenance) and extensibleKind = "sinkModel" - or - Candidate::isSource(e, kind, provenance) and extensibleKind = "sourceModel" - } - - /** - * Holds if `endpoint` is modeled as `endpointType`. - */ - predicate isKnownAs( - Candidate::Endpoint endpoint, Candidate::EndpointType endpointType, - EndpointCharacteristic characteristic - ) { - // If the list of characteristics includes positive indicators with maximal confidence for this class, then it's a - // known sink for the class. - characteristic.appliesToEndpoint(endpoint) and - characteristic.hasImplications(endpointType, true, maximalConfidence()) - } - - /** - * Gets a potential type of this endpoint to make sure that sources are - * associated with source types and sinks with sink types. - */ - Candidate::EndpointType getAPotentialType(Candidate::Endpoint endpoint) { - endpoint.getExtensibleType() = "sourceModel" and - result instanceof Candidate::SourceType - or - endpoint.getExtensibleType() = "sinkModel" and - result instanceof Candidate::SinkType - } - - /** - * Holds if the given `endpoint` should be considered as a candidate for type `endpointType`, - * and classified by the ML model. - * - * A candidate is an endpoint that cannot be excluded from `endpointType` based on its characteristics. - */ - predicate isCandidate(Candidate::Endpoint endpoint, Candidate::EndpointType endpointType) { - endpointType = getAPotentialType(endpoint) and - not exists(getAnExcludingCharacteristic(endpoint, endpointType)) - } - - /** - * Gets the related location of `e` with name `name`, if it exists. - * Otherwise, gets the candidate itself. - */ - Candidate::RelatedLocation getRelatedLocationOrCandidate( - Candidate::Endpoint e, Candidate::RelatedLocationType type - ) { - if exists(Candidate::getRelatedLocation(e, type)) - then result = Candidate::getRelatedLocation(e, type) - else result = Candidate::asLocation(e) - } - - /** - * Gets a characteristics that disbar `endpoint` from being a candidate for `endpointType` - * with at least medium confidence. - */ - EndpointCharacteristic getAnExcludingCharacteristic( - Candidate::Endpoint endpoint, Candidate::EndpointType endpointType - ) { - result.appliesToEndpoint(endpoint) and - exists(float confidence | - confidence >= mediumConfidence() and - result.hasImplications(endpointType, false, confidence) - ) - } - - /** - * A set of characteristics that a particular endpoint might have. This set of characteristics is used to make decisions - * about whether to include the endpoint in the training set and with what kind, as well as whether to score the - * endpoint at inference time. - */ - abstract class EndpointCharacteristic extends string { - /** - * Holds for the string that is the name of the characteristic. This should describe some property of an endpoint - * that is meaningful for determining whether it's a sink, and if so, of which sink type. - */ - bindingset[this] - EndpointCharacteristic() { any() } - - /** - * Holds for endpoints that have this characteristic. - */ - abstract predicate appliesToEndpoint(Candidate::Endpoint n); - - /** - * This predicate describes what the characteristic tells us about an endpoint. - * - * Params: - * endpointType: The sink/source type. - * isPositiveIndicator: If true, this characteristic indicates that this endpoint _is_ a member of the class; if - * false, it indicates that it _isn't_ a member of the class. - * confidence: A float in [0, 1], which tells us how strong an indicator this characteristic is for the endpoint - * belonging / not belonging to the given class. A confidence near zero means this characteristic is a very weak - * indicator of whether or not the endpoint belongs to the class. A confidence of 1 means that all endpoints with - * this characteristic definitively do/don't belong to the class. - */ - abstract predicate hasImplications( - Candidate::EndpointType endpointType, boolean isPositiveIndicator, float confidence - ); - - /** Indicators with confidence at or above this threshold are considered to be high-confidence indicators. */ - final float getHighConfidenceThreshold() { result = 0.8 } - } - - /** - * A high-confidence characteristic that indicates that an endpoint is a sink of a specified type. These endpoints can - * be used as positive samples for training or for a few-shot prompt. - */ - abstract class SinkCharacteristic extends EndpointCharacteristic { - bindingset[this] - SinkCharacteristic() { any() } - - abstract Candidate::EndpointType getSinkType(); - - final override predicate hasImplications( - Candidate::EndpointType endpointType, boolean isPositiveIndicator, float confidence - ) { - endpointType = this.getSinkType() and - isPositiveIndicator = true and - confidence = maximalConfidence() - } - } - - /** - * A high-confidence characteristic that indicates that an endpoint is a source of a specified type. These endpoints can - * be used as positive samples for training or for a few-shot prompt. - */ - abstract class SourceCharacteristic extends EndpointCharacteristic { - bindingset[this] - SourceCharacteristic() { any() } - - abstract Candidate::EndpointType getSourceType(); - - final override predicate hasImplications( - Candidate::EndpointType endpointType, boolean isPositiveIndicator, float confidence - ) { - endpointType = this.getSourceType() and - isPositiveIndicator = true and - confidence = maximalConfidence() - } - } - - /** - * A high-confidence characteristic that indicates that an endpoint is not a sink of any type. These endpoints can be - * used as negative samples for training or for a few-shot prompt. - */ - abstract class NotASinkCharacteristic extends EndpointCharacteristic { - bindingset[this] - NotASinkCharacteristic() { any() } - - override predicate hasImplications( - Candidate::EndpointType endpointType, boolean isPositiveIndicator, float confidence - ) { - endpointType instanceof Candidate::SinkType and - isPositiveIndicator = false and - confidence = highConfidence() - } - } - - /** - * A high-confidence characteristic that indicates that an endpoint is not a source of any type. These endpoints can be - * used as negative samples for training or for a few-shot prompt. - */ - abstract class NotASourceCharacteristic extends EndpointCharacteristic { - bindingset[this] - NotASourceCharacteristic() { any() } - - override predicate hasImplications( - Candidate::EndpointType endpointType, boolean isPositiveIndicator, float confidence - ) { - endpointType instanceof Candidate::SourceType and - isPositiveIndicator = false and - confidence = highConfidence() - } - } - - /** - * A high-confidence characteristic that indicates that an endpoint is neither a source nor a sink of any type. - */ - abstract class NeitherSourceNorSinkCharacteristic extends NotASinkCharacteristic, - NotASourceCharacteristic - { - bindingset[this] - NeitherSourceNorSinkCharacteristic() { any() } - - final override predicate hasImplications( - Candidate::EndpointType endpointType, boolean isPositiveIndicator, float confidence - ) { - NotASinkCharacteristic.super.hasImplications(endpointType, isPositiveIndicator, confidence) or - NotASourceCharacteristic.super.hasImplications(endpointType, isPositiveIndicator, confidence) - } - } - - /** - * A medium-confidence characteristic that indicates that an endpoint is unlikely to be a sink of any type. These - * endpoints can be excluded from scoring at inference time, both to save time and to avoid false positives. They should - * not, however, be used as negative samples for training or for a few-shot prompt, because they may include a small - * number of sinks. - */ - abstract class LikelyNotASinkCharacteristic extends EndpointCharacteristic { - bindingset[this] - LikelyNotASinkCharacteristic() { any() } - - override predicate hasImplications( - Candidate::EndpointType endpointType, boolean isPositiveIndicator, float confidence - ) { - endpointType instanceof Candidate::SinkType and - isPositiveIndicator = false and - confidence = mediumConfidence() - } - } - - /** - * A characteristic that indicates not necessarily that an endpoint is not a sink, but rather that it is not a sink - * that's interesting to model in the standard Java libraries. These filters should be removed when extracting sink - * candidates within a user's codebase for customized modeling. - * - * These endpoints should not be used as negative samples for training or for a few-shot prompt, because they are not - * necessarily non-sinks. - */ - abstract class UninterestingToModelCharacteristic extends EndpointCharacteristic { - bindingset[this] - UninterestingToModelCharacteristic() { any() } - - override predicate hasImplications( - Candidate::EndpointType endpointType, boolean isPositiveIndicator, float confidence - ) { - endpointType instanceof Candidate::SinkType and - isPositiveIndicator = false and - confidence = mediumConfidence() - } - } - - /** - * Contains default implementations that are derived solely from the `CandidateSig` implementation. - */ - private module DefaultCharacteristicImplementations { - /** - * Endpoints identified as sinks by the `CandidateSig` implementation are sinks with maximal confidence. - */ - private class KnownSinkCharacteristic extends SinkCharacteristic { - string madKind; - Candidate::EndpointType endpointType; - string provenance; - - KnownSinkCharacteristic() { - Candidate::isKnownKind(madKind, endpointType) and - // bind "this" to a unique string differing from that of the SinkType classes - this = madKind + "_" + provenance + "_characteristic" and - Candidate::isSink(_, madKind, provenance) - } - - override predicate appliesToEndpoint(Candidate::Endpoint e) { - Candidate::isSink(e, madKind, provenance) - } - - override Candidate::EndpointType getSinkType() { result = endpointType } - } - - private class KnownSourceCharacteristic extends SourceCharacteristic { - string madKind; - Candidate::EndpointType endpointType; - string provenance; - - KnownSourceCharacteristic() { - Candidate::isKnownKind(madKind, endpointType) and - // bind "this" to a unique string differing from that of the SinkType classes - this = madKind + "_" + provenance + "_characteristic" and - Candidate::isSource(_, madKind, provenance) - } - - override predicate appliesToEndpoint(Candidate::Endpoint e) { - Candidate::isSource(e, madKind, provenance) - } - - override Candidate::EndpointType getSourceType() { result = endpointType } - } - - /** - * A negative characteristic that indicates that an endpoint was manually modeled as a neutral model. - */ - private class NeutralModelCharacteristic extends NeitherSourceNorSinkCharacteristic { - NeutralModelCharacteristic() { this = "known non-sink" } - - override predicate appliesToEndpoint(Candidate::Endpoint e) { Candidate::isNeutral(e) } - } - - /** - * A negative characteristic that indicates that an endpoint is a sanitizer, and thus not a source. - */ - private class IsSanitizerCharacteristic extends NotASourceCharacteristic { - IsSanitizerCharacteristic() { this = "known sanitizer" } - - override predicate appliesToEndpoint(Candidate::Endpoint e) { Candidate::isSanitizer(e, _) } - } - } -} diff --git a/java/ql/automodel/src/AutomodelSinkModelMrvaQueries.ql b/java/ql/automodel/src/AutomodelSinkModelMrvaQueries.ql deleted file mode 100644 index ed61ccfbbfd..00000000000 --- a/java/ql/automodel/src/AutomodelSinkModelMrvaQueries.ql +++ /dev/null @@ -1,62 +0,0 @@ -/** - * This file contains query predicates for use when gathering metrics at scale using Multi Repo - * Variant Analysis. - */ - -private import java -private import AutomodelAlertSinkUtil - -/** - * Holds if `alertCount` is the number of alerts for the query with ID `queryId` for which the - * sinks correspond to the given `ai-generated` sink model. - */ -query predicate sinkModelCountPerQuery( - string queryId, int alertCount, string package, string type, boolean subtypes, string name, - string signature, string input, string ext, string kind, string provenance -) { - exists(SinkModel s | - sinkModelTallyPerQuery(queryId, alertCount, s) and - s.getProvenance() = "ai-generated" and - s.getPackage() = package and - s.getType() = type and - s.getSubtypes() = subtypes and - s.getName() = name and - s.getSignature() = signature and - s.getInput() = input and - s.getExt() = ext and - s.getKind() = kind and - s.getProvenance() = provenance - ) -} - -/** - * Holds if `instanceCount` is the number of instances corresponding to the given `ai-generated` - * sink model (as identified by the `package`, `name`, `input`, etc.). - */ -query predicate instanceCount( - int instanceCount, string package, string type, boolean subtypes, string name, string signature, - string input, string ext, string kind, string provenance -) { - exists(SinkModel s | - instanceCount = s.getInstanceCount() and - instanceCount > 0 and - s.getProvenance() = "ai-generated" and - s.getPackage() = package and - s.getType() = type and - s.getSubtypes() = subtypes and - s.getName() = name and - s.getSignature() = signature and - s.getInput() = input and - s.getExt() = ext and - s.getKind() = kind and - s.getProvenance() = provenance - ) -} - -// MRVA requires a select clause, so we repurpose it to tell us which query predicates had results. -from string hadResults -where - sinkModelCountPerQuery(_, _, _, _, _, _, _, _, _, _, _) and hadResults = "sinkModelCountPerQuery" - or - instanceCount(_, _, _, _, _, _, _, _, _, _) and hadResults = "instanceCount" -select hadResults diff --git a/java/ql/automodel/src/codeql-pack.release.yml b/java/ql/automodel/src/codeql-pack.release.yml deleted file mode 100644 index 56a2fb38872..00000000000 --- a/java/ql/automodel/src/codeql-pack.release.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -lastReleaseVersion: 1.0.11 diff --git a/java/ql/automodel/src/qlpack.yml b/java/ql/automodel/src/qlpack.yml deleted file mode 100644 index 4acf2219db3..00000000000 --- a/java/ql/automodel/src/qlpack.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: codeql/java-automodel-queries -version: 1.0.12-dev -groups: - - java - - automodel -dependencies: - codeql/java-all: ${workspace} -dataExtensions: - - AutomodelCandidateFilter.yml -warnOnImplicitThis: true \ No newline at end of file diff --git a/java/ql/automodel/test/AutomodelApplicationModeExtraction/AutomodelApplicationModeExtractionTests.expected b/java/ql/automodel/test/AutomodelApplicationModeExtraction/AutomodelApplicationModeExtractionTests.expected deleted file mode 100644 index 8ec8033d086..00000000000 --- a/java/ql/automodel/test/AutomodelApplicationModeExtraction/AutomodelApplicationModeExtractionTests.expected +++ /dev/null @@ -1,2 +0,0 @@ -testFailures -failures diff --git a/java/ql/automodel/test/AutomodelApplicationModeExtraction/AutomodelApplicationModeExtractionTests.ql b/java/ql/automodel/test/AutomodelApplicationModeExtraction/AutomodelApplicationModeExtractionTests.ql deleted file mode 100644 index b7e1efc4532..00000000000 --- a/java/ql/automodel/test/AutomodelApplicationModeExtraction/AutomodelApplicationModeExtractionTests.ql +++ /dev/null @@ -1,35 +0,0 @@ -import java -import AutomodelApplicationModeCharacteristics as Characteristics -import AutomodelExtractionTests - -module TestHelper implements TestHelperSig { - Location getEndpointLocation(Characteristics::Endpoint endpoint) { - result = endpoint.asTop().getLocation() - } - - predicate isCandidate( - Characteristics::Endpoint endpoint, string name, string signature, string input, string output, - string extensibleType - ) { - Characteristics::isCandidate(endpoint, _, _, _, name, signature, input, output, _, - extensibleType, _) - } - - predicate isPositiveExample( - Characteristics::Endpoint endpoint, string endpointType, string name, string signature, - string input, string output, string extensibleType - ) { - Characteristics::isPositiveExample(endpoint, endpointType, _, _, _, name, signature, input, - output, _, extensibleType) - } - - predicate isNegativeExample( - Characteristics::Endpoint endpoint, string name, string signature, string input, string output, - string extensibleType - ) { - Characteristics::isNegativeExample(endpoint, _, _, _, _, _, name, signature, input, output, _, - extensibleType) - } -} - -import MakeTest> diff --git a/java/ql/automodel/test/AutomodelApplicationModeExtraction/PluginImpl.java b/java/ql/automodel/test/AutomodelApplicationModeExtraction/PluginImpl.java deleted file mode 100644 index b0f3482a732..00000000000 --- a/java/ql/automodel/test/AutomodelApplicationModeExtraction/PluginImpl.java +++ /dev/null @@ -1,8 +0,0 @@ -import hudson.Plugin; - -public class PluginImpl extends Plugin { - @Override - public void configure(String name, String value) { // $ sourceModelCandidate=configure(String,String):Parameter[0] sourceModelCandidate=configure(String,String):Parameter[1] - // ... - } -} diff --git a/java/ql/automodel/test/AutomodelApplicationModeExtraction/Test.java b/java/ql/automodel/test/AutomodelApplicationModeExtraction/Test.java deleted file mode 100644 index 9691cf86c15..00000000000 --- a/java/ql/automodel/test/AutomodelApplicationModeExtraction/Test.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.github.codeql.test; - -import java.io.InputStream; -import java.io.PrintWriter; -import java.nio.file.CopyOption; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Supplier; -import java.io.File; -import java.io.FileFilter; -import java.nio.file.FileVisitOption; -import java.net.URLConnection; -import java.util.concurrent.FutureTask; - -class Test { - public static void main(String[] args) throws Exception { - AtomicReference reference = new AtomicReference<>(); // uninteresting (parameterless constructor) - reference.set( // $ sinkModelCandidate=set(Object):Argument[this] - args[0] // $ negativeSinkExample=set(Object):Argument[0] // modeled as a flow step - ); // not a source candidate (return type is void) - } - - public static void callSupplier(Supplier supplier) { - supplier.get(); // not a source candidate (lambda flow) - } - - public static void copyFiles(Path source, Path target, CopyOption option) throws Exception { - Files.copy( - source, // $ positiveSinkExample=copy(Path,Path,CopyOption[]):Argument[0](path-injection) - target, // $ positiveSinkExample=copy(Path,Path,CopyOption[]):Argument[1](path-injection) - option // no candidate (not modeled, but source and target are modeled) - ); // $ sourceModelCandidate=copy(Path,Path,CopyOption[]):ReturnValue - } - - public static InputStream getInputStream(Path openPath) throws Exception { - return Files.newInputStream( - openPath // $ sinkModelCandidate=newInputStream(Path,OpenOption[]):Argument[0] positiveSinkExample=newInputStream(Path,OpenOption[]):Argument[0](path-injection) // sink candidate because "only" ai-modeled, and useful as a candidate in regression testing - ); // $ sourceModelCandidate=newInputStream(Path,OpenOption[]):ReturnValue - } - - public static InputStream getInputStream(String openPath, String otherPath) throws Exception { - return Test.getInputStream( // the call is not a source candidate (argument to local call) - Paths.get( - openPath, // $ negativeSinkExample=get(String,String[]):Argument[0] // modeled as a flow step - otherPath - ) // $ sourceModelCandidate=get(String,String[]):ReturnValue negativeSinkExample=get(String,String[]):Argument[1] - ); - } - - public static int compareFiles(File f1, File f2) { - return f1.compareTo( // $ negativeSinkExample=compareTo(File):Argument[this] - f2 // $ negativeSinkExample=compareTo(File):Argument[0] // modeled as not a sink - ); // not a source candidate (return type is int) - } - - public static void FilesWalkExample(Path p, FileVisitOption o) throws Exception { - Files.walk( - p, // $ negativeSinkExample=walk(Path,FileVisitOption[]):Argument[0] // modeled as a flow step - o, // the implicit varargs array is a candidate, annotated on the last line of the call - o // not a candidate (only the first arg corresponding to a varargs array - // is extracted) - ); // $ sourceModelCandidate=walk(Path,FileVisitOption[]):ReturnValue sinkModelCandidate=walk(Path,FileVisitOption[]):Argument[1] - } - - public static void WebSocketExample(URLConnection c) throws Exception { - c.getInputStream(); // $ sinkModelCandidate=getInputStream():Argument[this] positiveSourceExample=getInputStream():ReturnValue(remote) // not a source candidate (manual modeling) - c.connect(); // $ sinkModelCandidate=connect():Argument[this] // not a source candidate (return type is void) - } - - public static void fileFilterExample(File f, FileFilter ff) { - f.listFiles( // $ sinkModelCandidate=listFiles(FileFilter):Argument[this] - ff - ); // $ sourceModelCandidate=listFiles(FileFilter):ReturnValue - } -} - -class OverrideTest extends Exception { - public void printStackTrace(PrintWriter writer) { // $ sourceModelCandidate=printStackTrace(PrintWriter):Parameter[0] - return; - } - -} - -class TaskUtils { - public FutureTask getTask() { - FutureTask ft = new FutureTask(() -> { - // ^-- no sink candidate for the `this` qualifier of a constructor - return 42; - }); - return ft; - } -} - -class MoreTests { - public static void FilesListExample(Path p) throws Exception { - Files.list( - Files.createDirectories( - p // $ positiveSinkExample=createDirectories(Path,FileAttribute[]):Argument[0](path-injection) - ) // $ sourceModelCandidate=createDirectories(Path,FileAttribute[]):ReturnValue negativeSinkExample=list(Path):Argument[0] // modeled as a flow step - ); // $ sourceModelCandidate=list(Path):ReturnValue - - Files.delete( - p // $ sinkModelCandidate=delete(Path):Argument[0] positiveSinkExample=delete(Path):Argument[0](path-injection) - ); // not a source candidate (return type is void) - - Files.deleteIfExists( - p // $ sinkModelCandidate=deleteIfExists(Path):Argument[0] positiveSinkExample=deleteIfExists(Path):Argument[0](path-injection) - ); // not a source candidate (return type is boolean) - } -} \ No newline at end of file diff --git a/java/ql/automodel/test/AutomodelApplicationModeExtraction/hudson/Plugin.java b/java/ql/automodel/test/AutomodelApplicationModeExtraction/hudson/Plugin.java deleted file mode 100644 index 3ad79abb8df..00000000000 --- a/java/ql/automodel/test/AutomodelApplicationModeExtraction/hudson/Plugin.java +++ /dev/null @@ -1,7 +0,0 @@ -package hudson; - -/** Plugin doc */ -public class Plugin { - /** Configure method doc */ - public void configure(String name, String value) {} -} diff --git a/java/ql/automodel/test/AutomodelExtractionTests.qll b/java/ql/automodel/test/AutomodelExtractionTests.qll deleted file mode 100644 index fbc407c67f0..00000000000 --- a/java/ql/automodel/test/AutomodelExtractionTests.qll +++ /dev/null @@ -1,77 +0,0 @@ -import java -import TestUtilities.InlineExpectationsTest -import AutomodelSharedCharacteristics - -signature module TestHelperSig { - Location getEndpointLocation(Candidate::Endpoint e); - - predicate isCandidate( - Candidate::Endpoint e, string name, string signature, string input, string output, - string extensibleType - ); - - predicate isPositiveExample( - Candidate::Endpoint e, string endpointType, string name, string signature, string input, - string output, string extensibleType - ); - - predicate isNegativeExample( - Candidate::Endpoint e, string name, string signature, string input, string output, - string extensibleType - ); -} - -module Extraction TestHelper> implements TestSig { - string getARelevantTag() { - result in [ - "sourceModelCandidate", "sinkModelCandidate", // a candidate source/sink - "positiveSourceExample", "positiveSinkExample", // a known source/sink - "negativeSourceExample", "negativeSinkExample" // a known non-source/non-sink - ] - } - - /** - * If `extensibleType` is `sourceModel` then the result is `ifSource`, if it - * is `sinkModel` then the result is `ifSink`. - */ - bindingset[extensibleType, ifSource, ifSink] - private string ifSource(string extensibleType, string ifSource, string ifSink) { - extensibleType = "sourceModel" and result = ifSource - or - extensibleType = "sinkModel" and result = ifSink - } - - additional predicate selectEndpoint( - Candidate::Endpoint endpoint, string name, string signature, string input, string output, - string extensibleType, string tag, string suffix - ) { - TestHelper::isCandidate(endpoint, name, signature, input, output, extensibleType) and - tag = ifSource(extensibleType, "sourceModelCandidate", "sinkModelCandidate") and - suffix = "" - or - TestHelper::isNegativeExample(endpoint, name, signature, input, output, extensibleType) and - tag = "negative" + ifSource(extensibleType, "Source", "Sink") + "Example" and - suffix = "" - or - exists(string endpointType | - TestHelper::isPositiveExample(endpoint, endpointType, name, signature, input, output, - extensibleType) and - tag = "positive" + ifSource(extensibleType, "Source", "Sink") + "Example" and - suffix = "(" + endpointType + ")" - ) - } - - predicate hasActualResult(Location location, string element, string tag, string value) { - exists( - Candidate::Endpoint endpoint, string name, string signature, string input, string output, - string extensibleType, string suffix - | - selectEndpoint(endpoint, name, signature, input, output, extensibleType, tag, suffix) - | - TestHelper::getEndpointLocation(endpoint) = location and - endpoint.toString() = element and - // for source models only the output is relevant, and vice versa for sink models - value = name + signature + ":" + ifSource(extensibleType, output, input) + suffix - ) - } -} diff --git a/java/ql/automodel/test/AutomodelFrameworkModeExtraction/AutomodelFrameworkModeExtractionTests.expected b/java/ql/automodel/test/AutomodelFrameworkModeExtraction/AutomodelFrameworkModeExtractionTests.expected deleted file mode 100644 index 8ec8033d086..00000000000 --- a/java/ql/automodel/test/AutomodelFrameworkModeExtraction/AutomodelFrameworkModeExtractionTests.expected +++ /dev/null @@ -1,2 +0,0 @@ -testFailures -failures diff --git a/java/ql/automodel/test/AutomodelFrameworkModeExtraction/AutomodelFrameworkModeExtractionTests.ql b/java/ql/automodel/test/AutomodelFrameworkModeExtraction/AutomodelFrameworkModeExtractionTests.ql deleted file mode 100644 index 0d5e8611870..00000000000 --- a/java/ql/automodel/test/AutomodelFrameworkModeExtraction/AutomodelFrameworkModeExtractionTests.ql +++ /dev/null @@ -1,35 +0,0 @@ -import java -import AutomodelFrameworkModeCharacteristics as Characteristics -import AutomodelExtractionTests - -module TestHelper implements TestHelperSig { - Location getEndpointLocation(Characteristics::Endpoint endpoint) { - result = endpoint.asTop().getLocation() - } - - predicate isCandidate( - Characteristics::Endpoint endpoint, string name, string signature, string input, string output, - string extensibleType - ) { - Characteristics::isCandidate(endpoint, _, _, _, name, signature, input, output, _, - extensibleType, _) - } - - predicate isPositiveExample( - Characteristics::Endpoint endpoint, string endpointType, string name, string signature, - string input, string output, string extensibleType - ) { - Characteristics::isPositiveExample(endpoint, endpointType, _, _, _, name, signature, input, - output, _, extensibleType) - } - - predicate isNegativeExample( - Characteristics::Endpoint endpoint, string name, string signature, string input, string output, - string extensibleType - ) { - Characteristics::isNegativeExample(endpoint, _, _, _, _, _, name, signature, input, output, _, - extensibleType) - } -} - -import MakeTest> diff --git a/java/ql/automodel/test/AutomodelFrameworkModeExtraction/com/github/codeql/test/MyWriter.java b/java/ql/automodel/test/AutomodelFrameworkModeExtraction/com/github/codeql/test/MyWriter.java deleted file mode 100644 index 62bd773cc2e..00000000000 --- a/java/ql/automodel/test/AutomodelFrameworkModeExtraction/com/github/codeql/test/MyWriter.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.github.codeql.test; - -public class MyWriter extends java.io.Writer { - @Override - public void write(char[] cbuf, int off, int len) { // $ sinkModelCandidate=write(char[],int,int):Argument[this] positiveSinkExample=write(char[],int,int):Argument[0](file-content-store) sourceModelCandidate=write(char[],int,int):Parameter[this] sourceModelCandidate=write(char[],int,int):Parameter[0] - } - - @Override - public void close() { // $ sinkModelCandidate=close():Argument[this] sourceModelCandidate=close():Parameter[this] - } - - @Override - public void flush() { // $ sinkModelCandidate=flush():Argument[this] sourceModelCandidate=flush():Parameter[this] - } -} diff --git a/java/ql/automodel/test/AutomodelFrameworkModeExtraction/com/github/codeql/test/NonPublicClass.java b/java/ql/automodel/test/AutomodelFrameworkModeExtraction/com/github/codeql/test/NonPublicClass.java deleted file mode 100644 index b106d3da594..00000000000 --- a/java/ql/automodel/test/AutomodelFrameworkModeExtraction/com/github/codeql/test/NonPublicClass.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.github.codeql.test; - -/** - * No candidates in this class, as it's not public! - */ -class NonPublicClass { - public void noCandidates(String here) { - System.out.println(here); - } -} diff --git a/java/ql/automodel/test/AutomodelFrameworkModeExtraction/com/github/codeql/test/PublicClass.java b/java/ql/automodel/test/AutomodelFrameworkModeExtraction/com/github/codeql/test/PublicClass.java deleted file mode 100644 index 79fabff0664..00000000000 --- a/java/ql/automodel/test/AutomodelFrameworkModeExtraction/com/github/codeql/test/PublicClass.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.github.codeql.test; - -public class PublicClass { - public void stuff(String arg) { // $ sinkModelCandidate=stuff(String):Argument[this] sourceModelCandidate=stuff(String):Parameter[this] sinkModelCandidate=stuff(String):Argument[0] sourceModelCandidate=stuff(String):Parameter[0] // source candidates because it is an overrideable method - System.out.println(arg); - } - - public static void staticStuff(String arg) { // $ sinkModelCandidate=staticStuff(String):Argument[0] // `arg` is not a source candidate (not overrideabe); `this` is not a candidate (static method) - System.out.println(arg); - } - - protected void nonPublicStuff(String arg) { // $ sinkModelCandidate=nonPublicStuff(String):Argument[this] sourceModelCandidate=nonPublicStuff(String):Parameter[this] sinkModelCandidate=nonPublicStuff(String):Argument[0] sourceModelCandidate=nonPublicStuff(String):Parameter[0] - System.out.println(arg); - } - - void packagePrivateStuff(String arg) { // no candidates because the method is not public - System.out.println(arg); - } - - public PublicClass(Object input) { // $ sourceModelCandidate=PublicClass(Object):ReturnValue sinkModelCandidate=PublicClass(Object):Argument[0] // `this` is not a candidate because it is a constructor - } - - // `input` and `input` are source candidates, but not sink candidates (is-style method) - public Boolean isIgnored(Object input) { // $ negativeSinkExample=isIgnored(Object):Argument[this] sourceModelCandidate=isIgnored(Object):Parameter[this] negativeSinkExample=isIgnored(Object):Argument[0] sourceModelCandidate=isIgnored(Object):Parameter[0] - return false; - } -} diff --git a/java/ql/automodel/test/AutomodelFrameworkModeExtraction/com/github/codeql/test/PublicInterface.java b/java/ql/automodel/test/AutomodelFrameworkModeExtraction/com/github/codeql/test/PublicInterface.java deleted file mode 100644 index d4f80b3c698..00000000000 --- a/java/ql/automodel/test/AutomodelFrameworkModeExtraction/com/github/codeql/test/PublicInterface.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.github.codeql.test; - -public interface PublicInterface { - public int stuff(String arg); // $ sinkModelCandidate=stuff(String):Argument[this] sourceModelCandidate=stuff(String):Parameter[this] sinkModelCandidate=stuff(String):Argument[0] sourceModelCandidate=stuff(String):Parameter[0] // result is _not_ a source candidate source (primitive return type) - - public static void staticStuff(String arg) { // $ sinkModelCandidate=staticStuff(String):Argument[0] // not a source candidate (static method) - System.out.println(arg); - } -} diff --git a/java/ql/automodel/test/AutomodelFrameworkModeExtraction/java/io/File.java b/java/ql/automodel/test/AutomodelFrameworkModeExtraction/java/io/File.java deleted file mode 100644 index 8bfe83e2339..00000000000 --- a/java/ql/automodel/test/AutomodelFrameworkModeExtraction/java/io/File.java +++ /dev/null @@ -1,13 +0,0 @@ -package java.io; - -public class File { - public int compareTo( // $ negativeSinkExample=compareTo(File):Argument[this] sourceModelCandidate=compareTo(File):Parameter[this] // modeled as neutral for sinks - File pathname // $ negativeSinkExample=compareTo(File):Argument[0] sourceModelCandidate=compareTo(File):Parameter[0] // modeled as neutral for sinks - ) { - return 0; - } - - public boolean setLastModified(long time) { // $ sinkModelCandidate=setLastModified(long):Argument[this] sourceModelCandidate=setLastModified(long):Parameter[this] // time is not a candidate (primitive type) - return false; - } // return value is not a source candidate because it's a primitive -} diff --git a/java/ql/automodel/test/AutomodelFrameworkModeExtraction/java/nio/file/Files.java b/java/ql/automodel/test/AutomodelFrameworkModeExtraction/java/nio/file/Files.java deleted file mode 100644 index a833ba5f6e2..00000000000 --- a/java/ql/automodel/test/AutomodelFrameworkModeExtraction/java/nio/file/Files.java +++ /dev/null @@ -1,31 +0,0 @@ -package java.nio.file; - -import java.io.InputStream; -import java.io.FileInputStream; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.io.IOException; -import java.io.OutputStream; -import java.nio.file.OpenOption; - -public class Files { - public static void copy( // method result is not a candidate source (void) - Path source, // $ positiveSinkExample=copy(Path,OutputStream):Argument[0](path-injection) // manual model exists - OutputStream out // $ sinkModelCandidate=copy(Path,OutputStream):Argument[1] - /* NB: may be worthwhile to implement the - same behavior as in application mode where out would not be a - candidate because there already is a model for another parameter of - the same method and we assume that methods are always modeled - completely. - */ - ) throws IOException { - // ... - } - - public static InputStream newInputStream( // $ sourceModelCandidate=newInputStream(Path,OpenOption[]):ReturnValue - Path openPath, // $ positiveSinkExample=newInputStream(Path,OpenOption[]):Argument[0](path-injection) sinkModelCandidate=newInputStream(Path,OpenOption[]):Argument[0] // known sink, but still a candidate (ai-modeled, and useful as a candidate in regression testing) - OpenOption... options // $ sinkModelCandidate=newInputStream(Path,OpenOption[]):Argument[1] - ) throws IOException { - return new FileInputStream(openPath.toFile()); - } -} diff --git a/java/ql/automodel/test/change-notes/2024-05-23-Version1.md b/java/ql/automodel/test/change-notes/2024-05-23-Version1.md deleted file mode 100644 index 5840e51017b..00000000000 --- a/java/ql/automodel/test/change-notes/2024-05-23-Version1.md +++ /dev/null @@ -1,4 +0,0 @@ ---- -category: breaking ---- -* CodeQL package management is now generally available, and all GitHub-produced CodeQL packages have had their version numbers increased to 1.0.0. diff --git a/java/ql/automodel/test/qlpack.yml b/java/ql/automodel/test/qlpack.yml deleted file mode 100644 index 46138d9435c..00000000000 --- a/java/ql/automodel/test/qlpack.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: codeql/java-automodel-tests -version: 1.0.0-dev -groups: - - java - - automodel - - test -dependencies: - codeql/java-all: ${workspace} - codeql/java-automodel-queries: ${workspace} - codeql/java-tests: ${workspace} -extractor: java -tests: . -warnOnImplicitThis: true \ No newline at end of file From 3673c7c813cec3c382c29733174a6425890dd565 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:56:20 +0000 Subject: [PATCH 07/47] Rust: Add SQL injection test cases (complete and functioning). --- .../query-tests/security/CWE-089/.gitignore | 2 + .../query-tests/security/CWE-089/cargo.toml | 15 ++ .../migrations/20241031153051_create.sql | 12 + .../test/query-tests/security/CWE-089/sqlx.rs | 217 ++++++++++++++++++ 4 files changed, 246 insertions(+) create mode 100644 rust/ql/test/query-tests/security/CWE-089/.gitignore create mode 100644 rust/ql/test/query-tests/security/CWE-089/cargo.toml create mode 100644 rust/ql/test/query-tests/security/CWE-089/migrations/20241031153051_create.sql create mode 100644 rust/ql/test/query-tests/security/CWE-089/sqlx.rs diff --git a/rust/ql/test/query-tests/security/CWE-089/.gitignore b/rust/ql/test/query-tests/security/CWE-089/.gitignore new file mode 100644 index 00000000000..bdcfa82b5d5 --- /dev/null +++ b/rust/ql/test/query-tests/security/CWE-089/.gitignore @@ -0,0 +1,2 @@ +# sqlite database +*.db* diff --git a/rust/ql/test/query-tests/security/CWE-089/cargo.toml b/rust/ql/test/query-tests/security/CWE-089/cargo.toml new file mode 100644 index 00000000000..0f9f0b75510 --- /dev/null +++ b/rust/ql/test/query-tests/security/CWE-089/cargo.toml @@ -0,0 +1,15 @@ +[workspace] + +[package] +name = "CWE-089-Test" +version = "0.1.0" +edition = "2021" + +[dependencies] +reqwest = { version = "0.12.9", features = ["blocking"] } +sqlx = { version = "0.8", features = ["mysql", "sqlite", "postgres", "runtime-async-std", "tls-native-tls"] } +futures = { version = "0.3" } + +[[bin]] +name = "sqlx" +path = "./sqlx.rs" diff --git a/rust/ql/test/query-tests/security/CWE-089/migrations/20241031153051_create.sql b/rust/ql/test/query-tests/security/CWE-089/migrations/20241031153051_create.sql new file mode 100644 index 00000000000..c7d989a7258 --- /dev/null +++ b/rust/ql/test/query-tests/security/CWE-089/migrations/20241031153051_create.sql @@ -0,0 +1,12 @@ +CREATE TABLE IF NOT EXISTS people +( + id INTEGER PRIMARY KEY NOT NULL, + firstname TEXT NOT NULL, + lastname TEXT NOT NULL +); + +INSERT INTO people +VALUES (1, "Alice", "Adams"); + +INSERT INTO people +VALUES (2, "Bob", "Becket"); diff --git a/rust/ql/test/query-tests/security/CWE-089/sqlx.rs b/rust/ql/test/query-tests/security/CWE-089/sqlx.rs new file mode 100644 index 00000000000..bf4cd7a96ae --- /dev/null +++ b/rust/ql/test/query-tests/security/CWE-089/sqlx.rs @@ -0,0 +1,217 @@ +use sqlx::Connection; +use sqlx::Executor; + +/** + * This test is designed to be "run" in two ways: + * - you can extract and analyze the code here using the CodeQL test runner in the usual way, + * verifying the that various vulnerabilities are detected. + * - you can compile and run the code using `cargo`, verifying that it really is a complete + * program that compiles, runs and executes SQL commands (the sqlite ones, at least). + * + * To do the latter: + * + * Install `sqlx`: + * ``` + * cargo install sqlx-cli + * ``` + * + * Create the database: + * ``` + * export DATABASE_URL="sqlite:sqlite_database.db" + * sqlx db create + * sqlx migrate run + * ``` + * + * Build and run: + * ``` + * cargo run + * ``` + * + * You can also rebuild the sqlx 'query cache' in the `.sqlx` subdirectory + * with: + * ``` + * cargo sqlx prepare + * ``` + * This allows the code (in particular the `prepare!` macro) to be built + * in the test without setting `DATABASE_URL` first. + */ + +async fn test_sqlx_mysql(url: &str, enable_remote: bool) -> Result<(), sqlx::Error> { + // connect through a MySql connection pool + let pool = sqlx::mysql::MySqlPool::connect(url).await?; + let mut conn = pool.acquire().await?; + + // construct queries (with extra variants) + let const_string = String::from("Alice"); + let arg_string = std::env::args().nth(1).unwrap_or(String::from("Alice")); // $ MISSING Source=args1 + let remote_string = reqwest::blocking::get("http://example.com/").unwrap().text().unwrap_or(String::from("Alice")); // $ MISSING Source=remote1 + let remote_number = remote_string.parse::().unwrap_or(0); + let safe_query_1 = String::from("SELECT * FROM people WHERE firstname='Alice'"); + let safe_query_2 = String::from("SELECT * FROM people WHERE firstname='") + &const_string + "'"; + let safe_query_3 = format!("SELECT * FROM people WHERE firstname='{remote_number}'"); + let unsafe_query_1 = &arg_string; + let unsafe_query_2 = &remote_string; + let unsafe_query_3 = String::from("SELECT * FROM people WHERE firstname='") + &remote_string + "'"; + let unsafe_query_4 = format!("SELECT * FROM people WHERE firstname='{remote_string}'"); + let prepared_query_1 = String::from("SELECT * FROM people WHERE firstname=?"); // (prepared arguments are safe) + + // direct execution + let _ = conn.execute(safe_query_1.as_str()).await?; + let _ = conn.execute(safe_query_2.as_str()).await?; + let _ = conn.execute(safe_query_3.as_str()).await?; + let _ = conn.execute(unsafe_query_1.as_str()).await?; // $ MISSING Alert[sql-injection]=args1 + if enable_remote { + let _ = conn.execute(unsafe_query_2.as_str()).await?; // $ MISSING Alert[sql-injection]=remote1 + let _ = conn.execute(unsafe_query_3.as_str()).await?; // $ MISSING Alert[sql-injection]=remote1 + let _ = conn.execute(unsafe_query_4.as_str()).await?; // $ MISSING Alert[sql-injection]=remote1 + } + + // prepared queries + let _ = sqlx::query(safe_query_1.as_str()).execute(&pool).await?; + let _ = sqlx::query(safe_query_2.as_str()).execute(&pool).await?; + let _ = sqlx::query(safe_query_3.as_str()).execute(&pool).await?; + let _ = sqlx::query(unsafe_query_1.as_str()).execute(&pool).await?; // $ MISSING Alert[sql-injection]=args1 + if enable_remote { + let _ = sqlx::query(unsafe_query_2.as_str()).execute(&pool).await?; // $ MISSING Alert[sql-injection]=remote1 + let _ = sqlx::query(unsafe_query_3.as_str()).execute(&pool).await?; // $ MISSING Alert[sql-injection]=remote1 + let _ = sqlx::query(unsafe_query_4.as_str()).execute(&pool).await?; // $ MISSING Alert[sql-injection]=remote1 + } + let _ = sqlx::query(prepared_query_1.as_str()).bind(const_string).execute(&pool).await?; + let _ = sqlx::query(prepared_query_1.as_str()).bind(arg_string).execute(&pool).await?; + if enable_remote { + let _ = sqlx::query(prepared_query_1.as_str()).bind(remote_string).execute(&pool).await?; + let _ = sqlx::query(prepared_query_1.as_str()).bind(remote_number).execute(&pool).await?; + } + + Ok(()) +} + +async fn test_sqlx_sqlite(url: &str, enable_remote: bool) -> Result<(), sqlx::Error> { + // connect through Sqlite, no connection pool + let mut conn = sqlx::sqlite::SqliteConnection::connect(url).await?; + + // construct queries + let const_string = String::from("Alice"); + let remote_string = reqwest::blocking::get("http://example.com/").unwrap().text().unwrap_or(String::from("Alice")); // $ MISSING Source=remote2 + let safe_query_1 = String::from("SELECT * FROM people WHERE firstname='") + &const_string + "'"; + let unsafe_query_1 = String::from("SELECT * FROM people WHERE firstname='") + &remote_string + "'"; + let prepared_query_1 = String::from("SELECT * FROM people WHERE firstname=?"); // (prepared arguments are safe) + + // direct execution (with extra variants) + let _ = conn.execute(safe_query_1.as_str()).await?; + if enable_remote { + let _ = conn.execute(unsafe_query_1.as_str()).await?; // $ MISSING Alert[sql-injection]=remote2 + } + // ... + let _ = sqlx::raw_sql(safe_query_1.as_str()).execute(&mut conn).await?; + if enable_remote { + let _ = sqlx::raw_sql(unsafe_query_1.as_str()).execute(&mut conn).await?; // $ MISSING Alert[sql-injection]=remote2 + } + + // prepared queries (with extra variants) + let _ = sqlx::query(safe_query_1.as_str()).execute(&mut conn).await?; + let _ = sqlx::query(prepared_query_1.as_str()).bind(&const_string).execute(&mut conn).await?; + if enable_remote { + let _ = sqlx::query(unsafe_query_1.as_str()).execute(&mut conn).await?; // $ MISSING Alert[sql-injection]=remote2 + let _ = sqlx::query(prepared_query_1.as_str()).bind(&remote_string).execute(&mut conn).await?; + } + // ... + let _ = sqlx::query(safe_query_1.as_str()).fetch(&mut conn); + let _ = sqlx::query(prepared_query_1.as_str()).bind(&const_string).fetch(&mut conn); + if enable_remote { + let _ = sqlx::query(unsafe_query_1.as_str()).fetch(&mut conn); // $ MISSING Alert[sql-injection]=remote2 + let _ = sqlx::query(prepared_query_1.as_str()).bind(&remote_string).fetch(&mut conn); + } + // ... + let row1: (i64, String, String) = sqlx::query_as(safe_query_1.as_str()).fetch_one(&mut conn).await?; + println!(" row1 = {:?}", row1); + let row2: (i64, String, String) = sqlx::query_as(prepared_query_1.as_str()).bind(&const_string).fetch_one(&mut conn).await?; + println!(" row2 = {:?}", row2); + if enable_remote { + let _: (i64, String, String) = sqlx::query_as(unsafe_query_1.as_str()).fetch_one(&mut conn).await?; // $ MISSING Alert[sql-injection]=remote2 + let _: (i64, String, String) = sqlx::query_as(prepared_query_1.as_str()).bind(&remote_string).fetch_one(&mut conn).await?; + } + // ... + let row3: (i64, String, String) = sqlx::query_as(safe_query_1.as_str()).fetch_optional(&mut conn).await?.expect("no data"); + println!(" row3 = {:?}", row3); + let row4: (i64, String, String) = sqlx::query_as(prepared_query_1.as_str()).bind(&const_string).fetch_optional(&mut conn).await?.expect("no data"); + println!(" row4 = {:?}", row4); + if enable_remote { + let _: (i64, String, String) = sqlx::query_as(unsafe_query_1.as_str()).fetch_optional(&mut conn).await?.expect("no data"); // $ MISSING Alert[sql-injection]=remote2 + let _: (i64, String, String) = sqlx::query_as(prepared_query_1.as_str()).bind(&remote_string).fetch_optional(&mut conn).await?.expect("no data"); + } + // ... + let _ = sqlx::query(safe_query_1.as_str()).fetch_all(&mut conn).await?; + let _ = sqlx::query(prepared_query_1.as_str()).bind(&const_string).fetch_all(&mut conn).await?; + let _ = sqlx::query("SELECT * FROM people WHERE firstname=?").bind(&const_string).fetch_all(&mut conn).await?; + if enable_remote { + let _ = sqlx::query(unsafe_query_1.as_str()).fetch_all(&mut conn).await?; // $ MISSING Alert[sql-injection]=remote2 + let _ = sqlx::query(prepared_query_1.as_str()).bind(&remote_string).fetch_all(&mut conn).await?; + let _ = sqlx::query("SELECT * FROM people WHERE firstname=?").bind(&remote_string).fetch_all(&mut conn).await?; + } + // ... + let _ = sqlx::query!("SELECT * FROM people WHERE firstname=$1", const_string).fetch_all(&mut conn).await?; // (only takes string literals, so can't be vulnerable) + if enable_remote { + let _ = sqlx::query!("SELECT * FROM people WHERE firstname=$1", remote_string).fetch_all(&mut conn).await?; + } + + Ok(()) +} + +async fn test_sqlx_postgres(url: &str, enable_remote: bool) -> Result<(), sqlx::Error> { + // connect through a PostGres connection pool + let pool = sqlx::postgres::PgPool::connect(url).await?; + let mut conn = pool.acquire().await?; + + // construct queries + let const_string = String::from("Alice"); + let remote_string = reqwest::blocking::get("http://example.com/").unwrap().text().unwrap_or(String::from("Alice")); // $ MISSING Source=remote3 + let safe_query_1 = String::from("SELECT * FROM people WHERE firstname='") + &const_string + "'"; + let unsafe_query_1 = String::from("SELECT * FROM people WHERE firstname='") + &remote_string + "'"; + let prepared_query_1 = String::from("SELECT * FROM people WHERE firstname=$1"); // (prepared arguments are safe) + + // direct execution + let _ = conn.execute(safe_query_1.as_str()).await?; + if enable_remote { + let _ = conn.execute(unsafe_query_1.as_str()).await?; // $ MISSING Alert[sql-injection]=remote3 + } + + // prepared queries + let _ = sqlx::query(safe_query_1.as_str()).execute(&pool).await?; + let _ = sqlx::query(prepared_query_1.as_str()).bind(&const_string).execute(&pool).await?; + if enable_remote { + let _ = sqlx::query(unsafe_query_1.as_str()).execute(&pool).await?; // $ MISSING Alert[sql-injection]=remote3 + let _ = sqlx::query(prepared_query_1.as_str()).bind(&remote_string).execute(&pool).await?; + } + + Ok(()) +} + +fn main() { + println!("--- CWE-089 sqlx.rs test ---"); + + // we don't *actually* use data from a remote source unless we're explicitly told to at the + // command line; that's because this test is designed to be runnable, and we don't really + // want to expose the test database to potential SQL injection from http://example.com/ - + // no matter how unlikely, local and compartmentalized that may seem. + let enable_remote = std::env::args().nth(1) == Some(String::from("ENABLE_REMOTE")); + println!("enable_remote = {enable_remote}"); + + println!("test_sqlx_mysql..."); + match futures::executor::block_on(test_sqlx_mysql("", enable_remote)) { + Ok(_) => println!(" successful!"), + Err(e) => println!(" error: {}", e), + } + + println!("test_sqlx_sqlite..."); + match futures::executor::block_on(test_sqlx_sqlite("sqlite:sqlite_database.db", enable_remote)) { + Ok(_) => println!(" successful!"), + Err(e) => println!(" error: {}", e), + } + + println!("test_sqlx_postgres..."); + match futures::executor::block_on(test_sqlx_postgres("", enable_remote)) { + Ok(_) => println!(" successful!"), + Err(e) => println!(" error: {}", e), + } +} From 28d0ad94d503d76bc95cf88de7605b97a372875a Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:56:17 +0000 Subject: [PATCH 08/47] Rust: Add placeholder SQL injection query, linked in test. --- .../queries/security/CWE-089/SqlInjection.ql | 22 +++++++++++++++++++ .../security/CWE-089/SqlInjection.expected | 0 .../security/CWE-089/SqlInjection.qlref | 2 ++ 3 files changed, 24 insertions(+) create mode 100644 rust/ql/src/queries/security/CWE-089/SqlInjection.ql create mode 100644 rust/ql/test/query-tests/security/CWE-089/SqlInjection.expected create mode 100644 rust/ql/test/query-tests/security/CWE-089/SqlInjection.qlref diff --git a/rust/ql/src/queries/security/CWE-089/SqlInjection.ql b/rust/ql/src/queries/security/CWE-089/SqlInjection.ql new file mode 100644 index 00000000000..7d24d5d1207 --- /dev/null +++ b/rust/ql/src/queries/security/CWE-089/SqlInjection.ql @@ -0,0 +1,22 @@ +/** + * @name Database query built from user-controlled sources + * @description Building a database query from user-controlled sources is vulnerable to insertion of malicious code by the user. + * @kind path-problem + * @problem.severity error + * @security-severity 8.8 + * @precision high + * @id rust/sql-injection + * @tags security + * external/cwe/cwe-089 + */ + +import codeql.rust.dataflow.DataFlow +/*import codeql.rust.security.SqlInjectionQuery +import SqlInjectionFlow::PathGraph + +from SqlInjectionFlow::PathNode sourceNode, SqlInjectionFlow::PathNode sinkNode +where SqlInjectionFlow::flowPath(sourceNode, sinkNode) +select sinkNode.getNode(), sourceNode, sinkNode, "This query depends on a $@.", + sourceNode.getNode(), "user-provided value" +*/ +select 0 diff --git a/rust/ql/test/query-tests/security/CWE-089/SqlInjection.expected b/rust/ql/test/query-tests/security/CWE-089/SqlInjection.expected new file mode 100644 index 00000000000..e69de29bb2d diff --git a/rust/ql/test/query-tests/security/CWE-089/SqlInjection.qlref b/rust/ql/test/query-tests/security/CWE-089/SqlInjection.qlref new file mode 100644 index 00000000000..504d27ff30c --- /dev/null +++ b/rust/ql/test/query-tests/security/CWE-089/SqlInjection.qlref @@ -0,0 +1,2 @@ +query: queries/security/CWE-089/SqlInjection.ql +postprocess: utils/InlineExpectationsTestQuery.ql From 2df565c84f1a5e8a886797b6cbe9d1ed315c4c3d Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Mon, 18 Nov 2024 15:24:33 +0000 Subject: [PATCH 09/47] Rust: Add options.yml and sqlx 'query cache' (result of 'sqlx prepare') so that the query test can function. --- ...b6da5ed65c28f666a68c4d73a1918f0eaa6f6.json | 32 +++++++++++++++++++ .../security/CWE-089/SqlInjection.expected | 1 + .../CWE-089/{cargo.toml => cargo.toml.manual} | 0 .../query-tests/security/CWE-089/options.yml | 5 +++ .../test/query-tests/security/CWE-089/sqlx.rs | 3 +- 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 rust/ql/test/query-tests/security/CWE-089/.sqlx/query-c996a36820ff0b98021fa553b09b6da5ed65c28f666a68c4d73a1918f0eaa6f6.json rename rust/ql/test/query-tests/security/CWE-089/{cargo.toml => cargo.toml.manual} (100%) create mode 100644 rust/ql/test/query-tests/security/CWE-089/options.yml diff --git a/rust/ql/test/query-tests/security/CWE-089/.sqlx/query-c996a36820ff0b98021fa553b09b6da5ed65c28f666a68c4d73a1918f0eaa6f6.json b/rust/ql/test/query-tests/security/CWE-089/.sqlx/query-c996a36820ff0b98021fa553b09b6da5ed65c28f666a68c4d73a1918f0eaa6f6.json new file mode 100644 index 00000000000..a4493e90c37 --- /dev/null +++ b/rust/ql/test/query-tests/security/CWE-089/.sqlx/query-c996a36820ff0b98021fa553b09b6da5ed65c28f666a68c4d73a1918f0eaa6f6.json @@ -0,0 +1,32 @@ +{ + "db_name": "SQLite", + "query": "SELECT * FROM people WHERE firstname=$1", + "describe": { + "columns": [ + { + "name": "id", + "ordinal": 0, + "type_info": "Integer" + }, + { + "name": "firstname", + "ordinal": 1, + "type_info": "Text" + }, + { + "name": "lastname", + "ordinal": 2, + "type_info": "Text" + } + ], + "parameters": { + "Right": 1 + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "c996a36820ff0b98021fa553b09b6da5ed65c28f666a68c4d73a1918f0eaa6f6" +} diff --git a/rust/ql/test/query-tests/security/CWE-089/SqlInjection.expected b/rust/ql/test/query-tests/security/CWE-089/SqlInjection.expected index e69de29bb2d..f082a67fcf6 100644 --- a/rust/ql/test/query-tests/security/CWE-089/SqlInjection.expected +++ b/rust/ql/test/query-tests/security/CWE-089/SqlInjection.expected @@ -0,0 +1 @@ +| 0 | diff --git a/rust/ql/test/query-tests/security/CWE-089/cargo.toml b/rust/ql/test/query-tests/security/CWE-089/cargo.toml.manual similarity index 100% rename from rust/ql/test/query-tests/security/CWE-089/cargo.toml rename to rust/ql/test/query-tests/security/CWE-089/cargo.toml.manual diff --git a/rust/ql/test/query-tests/security/CWE-089/options.yml b/rust/ql/test/query-tests/security/CWE-089/options.yml new file mode 100644 index 00000000000..24744b7dfb4 --- /dev/null +++ b/rust/ql/test/query-tests/security/CWE-089/options.yml @@ -0,0 +1,5 @@ +qltest_cargo_check: true +qltest_dependencies: + - reqwest = { version = "0.12.9", features = ["blocking"] } + - sqlx = { version = "0.8", features = ["mysql", "sqlite", "postgres", "runtime-async-std", "tls-native-tls"] } + - futures = { version = "0.3" } diff --git a/rust/ql/test/query-tests/security/CWE-089/sqlx.rs b/rust/ql/test/query-tests/security/CWE-089/sqlx.rs index bf4cd7a96ae..b5cc25000f9 100644 --- a/rust/ql/test/query-tests/security/CWE-089/sqlx.rs +++ b/rust/ql/test/query-tests/security/CWE-089/sqlx.rs @@ -22,8 +22,9 @@ use sqlx::Executor; * sqlx migrate run * ``` * - * Build and run: + * Build and run with the provided `cargo.toml.manual`: * ``` + * cp cargo.toml.manual cargo.toml * cargo run * ``` * From 6a7fb060866a702e774951f302b234a9a3aa4db0 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 31 Oct 2024 18:24:05 +0000 Subject: [PATCH 10/47] Rust: Add .qhelp and examples. --- .../security/CWE-089/SqlInjection.qhelp | 39 +++++++++++++++++++ .../security/CWE-089/SqlInjectionBad.rs | 7 ++++ .../security/CWE-089/SqlInjectionGood.rs | 5 +++ 3 files changed, 51 insertions(+) create mode 100644 rust/ql/src/queries/security/CWE-089/SqlInjection.qhelp create mode 100644 rust/ql/src/queries/security/CWE-089/SqlInjectionBad.rs create mode 100644 rust/ql/src/queries/security/CWE-089/SqlInjectionGood.rs diff --git a/rust/ql/src/queries/security/CWE-089/SqlInjection.qhelp b/rust/ql/src/queries/security/CWE-089/SqlInjection.qhelp new file mode 100644 index 00000000000..bcf54fca582 --- /dev/null +++ b/rust/ql/src/queries/security/CWE-089/SqlInjection.qhelp @@ -0,0 +1,39 @@ + + + + +

+If a database query (such as a SQL query) is built from user-provided data without sufficient sanitization, a user may be able to run malicious database queries. An attacker can craft the part of the query they control to change the overall meaning of the query. +

+ +
+ + +

+Most database connector libraries offer a way to safely embed untrusted data into a query using query parameters or prepared statements. You should use these features to build queries, rather than string concatenation or similar methods. You can also escape (sanitize) user-controlled strings so that they can be included directly in an SQL command. A library function should be used for escaping, because this approach is only safe if the escaping function is robust against all possible inputs. +

+ +
+ + +

+In the following examples, an SQL query is prepared using string formatting to directly include a user-controlled value remote_controlled_string. An attacker could craft remote_controlled_string to change the overall meaning of the SQL query. +

+ + + +

A better way to do this is with a prepared statement, binding remote_controlled_string to a parameter of that statement. An attacker who controls remote_controlled_string now cannot change the overall meaning of the query. +

+ + + +
+ + +
  • Wikipedia: SQL injection.
  • +
  • OWASP: SQL Injection Prevention Cheat Sheet.
  • + +
    +
    diff --git a/rust/ql/src/queries/security/CWE-089/SqlInjectionBad.rs b/rust/ql/src/queries/security/CWE-089/SqlInjectionBad.rs new file mode 100644 index 00000000000..cd0086b7eb2 --- /dev/null +++ b/rust/ql/src/queries/security/CWE-089/SqlInjectionBad.rs @@ -0,0 +1,7 @@ +// with SQLx + +let unsafe_query = format!("SELECT * FROM people WHERE firstname='{remote_controlled_string}'"); + +let _ = conn.execute(unsafe_query.as_str()).await?; // BAD (arbitrary SQL injection is possible) + +let _ = sqlx::query(unsafe_query.as_str()).fetch_all(&mut conn).await?; // $ BAD (arbitrary SQL injection is possible) diff --git a/rust/ql/src/queries/security/CWE-089/SqlInjectionGood.rs b/rust/ql/src/queries/security/CWE-089/SqlInjectionGood.rs new file mode 100644 index 00000000000..238665cc273 --- /dev/null +++ b/rust/ql/src/queries/security/CWE-089/SqlInjectionGood.rs @@ -0,0 +1,5 @@ +// with SQLx + +let prepared_query = "SELECT * FROM people WHERE firstname=?"; + +let _ = sqlx::query(prepared_query_1).bind(&remote_controlled_string).fetch_all(&mut conn).await?; // GOOD (prepared statement with bound parameter) From c7c6924fdacb8779a717b1662e3fe0d6108b34e9 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Tue, 19 Nov 2024 09:08:00 +0000 Subject: [PATCH 11/47] Rust: Implement query, source/sink/barrier classes and concepts. All of this is framework, nothing is concretely modelled yet. --- rust/ql/lib/codeql/rust/Concepts.qll | 138 ++++++++++++++++++ .../rust/security/SqlInjectionExtensions.qll | 50 +++++++ rust/ql/lib/qlpack.yml | 1 + .../queries/security/CWE-089/SqlInjection.ql | 22 ++- .../security/CWE-089/SqlInjection.expected | 5 +- 5 files changed, 212 insertions(+), 4 deletions(-) create mode 100644 rust/ql/lib/codeql/rust/Concepts.qll create mode 100644 rust/ql/lib/codeql/rust/security/SqlInjectionExtensions.qll diff --git a/rust/ql/lib/codeql/rust/Concepts.qll b/rust/ql/lib/codeql/rust/Concepts.qll new file mode 100644 index 00000000000..f64d2444573 --- /dev/null +++ b/rust/ql/lib/codeql/rust/Concepts.qll @@ -0,0 +1,138 @@ +/** + * Provides abstract classes representing generic concepts such as file system + * access or system command execution, for which individual framework libraries + * provide concrete subclasses. + */ + +private import codeql.rust.dataflow.DataFlow +private import codeql.threatmodels.ThreatModels + +/** + * A data flow source for a specific threat-model. + * + * Extend this class to refine existing API models. If you want to model new APIs, + * extend `ThreatModelSource::Range` instead. + */ +class ThreatModelSource extends DataFlow::Node instanceof ThreatModelSource::Range { + /** + * Gets a string that represents the source kind with respect to threat modeling. + * + * See + * - https://github.com/github/codeql/blob/main/docs/codeql/reusables/threat-model-description.rst + * - https://github.com/github/codeql/blob/main/shared/threat-models/ext/threat-model-grouping.model.yml + */ + string getThreatModel() { result = super.getThreatModel() } + + /** + * Gets a string that describes the type of this threat-model source. + */ + string getSourceType() { result = super.getSourceType() } +} + +/** + * Provides a class for modeling new sources for specific threat-models. + */ +module ThreatModelSource { + /** + * A data flow source, for a specific threat-model. + */ + abstract class Range extends DataFlow::Node { + /** + * Gets a string that represents the source kind with respect to threat modeling. + */ + abstract string getThreatModel(); + + /** + * Gets a string that describes the type of this threat-model source. + */ + abstract string getSourceType(); + } +} + +/** + * A data flow source that is enabled in the current threat model configuration. + */ +class ActiveThreatModelSource extends ThreatModelSource { + ActiveThreatModelSource() { + currentThreatModel(this.getThreatModel()) + } +} + +/** + * A data-flow node that constructs a SQL statement. + * + * Often, it is worthy of an alert if a SQL statement is constructed such that + * executing it would be a security risk. + * + * If it is important that the SQL statement is executed, use `SqlExecution`. + * + * Extend this class to refine existing API models. If you want to model new APIs, + * extend `SqlConstruction::Range` instead. + */ +class SqlConstruction extends DataFlow::Node instanceof SqlConstruction::Range { + /** + * Gets the argument that specifies the SQL statements to be constructed. + */ + DataFlow::Node getSql() { result = super.getSql() } +} + +/** + * Provides a class for modeling new SQL execution APIs. + */ +module SqlConstruction { + /** + * A data-flow node that constructs a SQL statement. + */ + abstract class Range extends DataFlow::Node { + /** + * Gets the argument that specifies the SQL statements to be constructed. + */ + abstract DataFlow::Node getSql(); + } +} + +/** + * A data-flow node that executes SQL statements. + * + * If the context of interest is such that merely constructing a SQL statement + * would be valuable to report, consider using `SqlConstruction`. + * + * Extend this class to refine existing API models. If you want to model new APIs, + * extend `SqlExecution::Range` instead. + */ +class SqlExecution extends DataFlow::Node instanceof SqlExecution::Range { + /** + * Gets the argument that specifies the SQL statements to be executed. + */ + DataFlow::Node getSql() { result = super.getSql() } +} + +/** + * Provides a class for modeling new SQL execution APIs. + */ +module SqlExecution { + /** + * A data-flow node that executes SQL statements. + */ + abstract class Range extends DataFlow::Node { + /** + * Gets the argument that specifies the SQL statements to be executed. + */ + abstract DataFlow::Node getSql(); + } +} + +/** + * A data-flow node that performs SQL sanitization. + */ +class SqlSanitization extends DataFlow::Node instanceof SqlSanitization::Range { } + +/** + * Provides a class for modeling new SQL sanitization APIs. + */ +module SqlSanitization { + /** + * A data-flow node that performs SQL sanitization. + */ + abstract class Range extends DataFlow::Node { } +} diff --git a/rust/ql/lib/codeql/rust/security/SqlInjectionExtensions.qll b/rust/ql/lib/codeql/rust/security/SqlInjectionExtensions.qll new file mode 100644 index 00000000000..db6239d7811 --- /dev/null +++ b/rust/ql/lib/codeql/rust/security/SqlInjectionExtensions.qll @@ -0,0 +1,50 @@ +/** + * Provides classes and predicates for reasoning about database + * queries built from user-controlled sources (that is, SQL injection + * vulnerabilities). + */ + +import rust +private import codeql.rust.dataflow.DataFlow +private import codeql.rust.Concepts +private import codeql.util.Unit + +/** + * Provides default sources, sinks and barriers for detecting SQL injection + * vulnerabilities, as well as extension points for adding your own. + */ +module SqlInjection { + /** + * A data flow source for SQL injection vulnerabilities. + */ + abstract class Source extends DataFlow::Node { } + + /** + * A data flow sink for SQL injection vulnerabilities. + */ + abstract class Sink extends DataFlow::Node { } + + /** + * A barrier for SQL injection vulnerabilities. + */ + abstract class Barrier extends DataFlow::Node { } + + /** + * An active threat-model source, considered as a flow source. + */ + private class ActiveThreatModelSourceAsSource extends Source, ActiveThreatModelSource { } + + /** + * A flow sink that is the statement of an SQL construction. + */ + class SqlConstructionAsSink extends Sink { + SqlConstructionAsSink() { this = any(SqlConstruction c).getSql() } + } + + /** + * A flow sink that is the statement of an SQL execution. + */ + class SqlExecutionAsSink extends Sink { + SqlExecutionAsSink() { this = any(SqlExecution e).getSql() } + } +} diff --git a/rust/ql/lib/qlpack.yml b/rust/ql/lib/qlpack.yml index 649d02c8e3a..53ccf6dfced 100644 --- a/rust/ql/lib/qlpack.yml +++ b/rust/ql/lib/qlpack.yml @@ -8,6 +8,7 @@ dependencies: codeql/controlflow: ${workspace} codeql/dataflow: ${workspace} codeql/regex: ${workspace} + codeql/threat-models: ${workspace} codeql/mad: ${workspace} codeql/ssa: ${workspace} codeql/tutorial: ${workspace} diff --git a/rust/ql/src/queries/security/CWE-089/SqlInjection.ql b/rust/ql/src/queries/security/CWE-089/SqlInjection.ql index 7d24d5d1207..c8db4569e59 100644 --- a/rust/ql/src/queries/security/CWE-089/SqlInjection.ql +++ b/rust/ql/src/queries/security/CWE-089/SqlInjection.ql @@ -10,13 +10,29 @@ * external/cwe/cwe-089 */ +import rust import codeql.rust.dataflow.DataFlow -/*import codeql.rust.security.SqlInjectionQuery +import codeql.rust.dataflow.TaintTracking +import codeql.rust.security.SqlInjectionExtensions import SqlInjectionFlow::PathGraph +/** + * A taint configuration for tainted data that reaches a SQL sink. + */ +module SqlInjectionConfig implements DataFlow::ConfigSig { + predicate isSource(DataFlow::Node node) { node instanceof SqlInjection::Source } + + predicate isSink(DataFlow::Node node) { node instanceof SqlInjection::Sink } + + predicate isBarrier(DataFlow::Node barrier) { barrier instanceof SqlInjection::Barrier } +} + +/** + * Detect taint flow of tainted data that reaches a SQL sink. + */ +module SqlInjectionFlow = TaintTracking::Global; + from SqlInjectionFlow::PathNode sourceNode, SqlInjectionFlow::PathNode sinkNode where SqlInjectionFlow::flowPath(sourceNode, sinkNode) select sinkNode.getNode(), sourceNode, sinkNode, "This query depends on a $@.", sourceNode.getNode(), "user-provided value" -*/ -select 0 diff --git a/rust/ql/test/query-tests/security/CWE-089/SqlInjection.expected b/rust/ql/test/query-tests/security/CWE-089/SqlInjection.expected index f082a67fcf6..58f42bec0c8 100644 --- a/rust/ql/test/query-tests/security/CWE-089/SqlInjection.expected +++ b/rust/ql/test/query-tests/security/CWE-089/SqlInjection.expected @@ -1 +1,4 @@ -| 0 | +#select +edges +nodes +subpaths From 49eefccde1a73cc3e9d2bce670556652f2beac72 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:49:02 +0000 Subject: [PATCH 12/47] Rust: Autoformat. --- rust/ql/lib/codeql/rust/Concepts.qll | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rust/ql/lib/codeql/rust/Concepts.qll b/rust/ql/lib/codeql/rust/Concepts.qll index f64d2444573..62cd24467d1 100644 --- a/rust/ql/lib/codeql/rust/Concepts.qll +++ b/rust/ql/lib/codeql/rust/Concepts.qll @@ -53,9 +53,7 @@ module ThreatModelSource { * A data flow source that is enabled in the current threat model configuration. */ class ActiveThreatModelSource extends ThreatModelSource { - ActiveThreatModelSource() { - currentThreatModel(this.getThreatModel()) - } + ActiveThreatModelSource() { currentThreatModel(this.getThreatModel()) } } /** From 758092b1d63dcdcd58f8dcdc642c50f23ede2c77 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Tue, 19 Nov 2024 12:04:15 +0000 Subject: [PATCH 13/47] Rust: Add consistency check failures. --- .../security/CWE-089/CONSISTENCY/DataFlowConsistency.expected | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 rust/ql/test/query-tests/security/CWE-089/CONSISTENCY/DataFlowConsistency.expected diff --git a/rust/ql/test/query-tests/security/CWE-089/CONSISTENCY/DataFlowConsistency.expected b/rust/ql/test/query-tests/security/CWE-089/CONSISTENCY/DataFlowConsistency.expected new file mode 100644 index 00000000000..d9a60435a6f --- /dev/null +++ b/rust/ql/test/query-tests/security/CWE-089/CONSISTENCY/DataFlowConsistency.expected @@ -0,0 +1,3 @@ +uniqueNodeToString +| sqlx.rs:154:13:154:81 | (no string representation) | Node should have one toString but has 0. | +| sqlx.rs:156:17:156:86 | (no string representation) | Node should have one toString but has 0. | From a398f707fe50aa119dc200f1aa991dd5dca1a0da Mon Sep 17 00:00:00 2001 From: Joe Farebrother Date: Tue, 19 Nov 2024 16:34:59 +0000 Subject: [PATCH 14/47] Add some test cases for flow involving global variables and captured variables --- .../global-or-captured-vars/test.expected | 4 + .../dataflow/global-or-captured-vars/test.py | 88 +++++++++++++++++++ .../dataflow/global-or-captured-vars/test.ql | 3 + 3 files changed, 95 insertions(+) create mode 100644 python/ql/test/library-tests/dataflow/global-or-captured-vars/test.expected create mode 100644 python/ql/test/library-tests/dataflow/global-or-captured-vars/test.py create mode 100644 python/ql/test/library-tests/dataflow/global-or-captured-vars/test.ql diff --git a/python/ql/test/library-tests/dataflow/global-or-captured-vars/test.expected b/python/ql/test/library-tests/dataflow/global-or-captured-vars/test.expected new file mode 100644 index 00000000000..366de37b867 --- /dev/null +++ b/python/ql/test/library-tests/dataflow/global-or-captured-vars/test.expected @@ -0,0 +1,4 @@ +argumentToEnsureNotTaintedNotMarkedAsSpurious +untaintedArgumentToEnsureTaintedNotMarkedAsMissing +testFailures +failures diff --git a/python/ql/test/library-tests/dataflow/global-or-captured-vars/test.py b/python/ql/test/library-tests/dataflow/global-or-captured-vars/test.py new file mode 100644 index 00000000000..3874d67e4a4 --- /dev/null +++ b/python/ql/test/library-tests/dataflow/global-or-captured-vars/test.py @@ -0,0 +1,88 @@ +import threading +import time + +# Test 1 +# TP - Flow is tracked through a global variable +foo1 = None + +def bar1(): + time.sleep(1) + ensure_tainted(foo1) # $tainted + +# The intent of these tests is to test how dataflow is handled through shared state accessed by different threads; +# but the presense or absense of the actual call to start a thread does not affect the results (there is no special modelling for Thread) +# threading.Thread(target=bar).start() + +foo1 = TAINTED_STRING + +# Test 2 +# FN - Flow is *not* tracked through an access path on a global variable +foo2 = [] + +def bar2(): + time.sleep(1) + ensure_tainted(foo2[0]) # $MISSING:tainted + +threading.Thread(target=bar2).start() + +foo2.append(TAINTED_STRING) + +# Test 3 +# FN - Flow is not found even when there is a direct call +foo3 = [] + +def bar3(): + time.sleep(1) + ensure_tainted(foo2[0]) # $MISSING:tainted + +foo3.append(TAINTED_STRING) +bar3() + +# Tast 4 +# TP - Sanity check: Flow is found through a ListElement directly without a call +foo4 = [] +foo4.append(TAINTED_STRING) +ensure_tainted(foo4[0]) # $tainted + +# Test 5 +# FN - Flow is *not* tracked through a shared captured but non-global variable +def test5(): + foo5 = None + + def bar5(): + time.sleep(1) + ensure_tainted(foo5) # $MISSING:tainted + + threading.Thread(target=bar5).start() # Only the presense of this thread call makes this an FN rather than a TN + + foo5 = TAINTED_STRING + + # Test 6 + # TP - Flow is tracked through a shared captured but non-global variable with a direct call +def test6(): + foo6 = [] + + def bar6(): + time.sleep(1) + ensure_tainted(foo[0]) # $tainted + + foo6.append(TAINTED_STRING) + bar6() + + +# Test 7 +# FN - Flow is *not* found through an access path on a global variable that's also used as a parameter +# We'd like to cover this case in order to be able to cover this CVE: https://github.com/github/codeql-python-CVE-coverage/issues/3176 + +foo7 = [] + +def bar7(): + time.sleep(1) + ensure_tainted(foo7[0]) # $MISSING: tainted + +def baz7(loc_foo): + loc_foo.append(TAINTED_STRING) + +threading.Thread(target=bar7).start() + +baz7(foo7) \ No newline at end of file diff --git a/python/ql/test/library-tests/dataflow/global-or-captured-vars/test.ql b/python/ql/test/library-tests/dataflow/global-or-captured-vars/test.ql new file mode 100644 index 00000000000..dd01b5d3e34 --- /dev/null +++ b/python/ql/test/library-tests/dataflow/global-or-captured-vars/test.ql @@ -0,0 +1,3 @@ +import python +import experimental.meta.InlineTaintTest +import MakeInlineTaintTest From 9b4b01a442dc37f83e5d0ac450f6653e6d1bc8c9 Mon Sep 17 00:00:00 2001 From: Joe Farebrother Date: Wed, 20 Nov 2024 10:59:27 +0000 Subject: [PATCH 15/47] Fix typo --- .../test/library-tests/dataflow/global-or-captured-vars/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ql/test/library-tests/dataflow/global-or-captured-vars/test.py b/python/ql/test/library-tests/dataflow/global-or-captured-vars/test.py index 3874d67e4a4..f60458ca4f9 100644 --- a/python/ql/test/library-tests/dataflow/global-or-captured-vars/test.py +++ b/python/ql/test/library-tests/dataflow/global-or-captured-vars/test.py @@ -64,7 +64,7 @@ def test6(): def bar6(): time.sleep(1) - ensure_tainted(foo[0]) # $tainted + ensure_tainted(foo6[0]) # $tainted foo6.append(TAINTED_STRING) bar6() From 52cd7f2c5c9d49b14975d02abf944500b5975c18 Mon Sep 17 00:00:00 2001 From: Joe Farebrother Date: Wed, 20 Nov 2024 11:22:42 +0000 Subject: [PATCH 16/47] Add 2 more cases --- .../dataflow/global-or-captured-vars/test.py | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/python/ql/test/library-tests/dataflow/global-or-captured-vars/test.py b/python/ql/test/library-tests/dataflow/global-or-captured-vars/test.py index f60458ca4f9..7719021890f 100644 --- a/python/ql/test/library-tests/dataflow/global-or-captured-vars/test.py +++ b/python/ql/test/library-tests/dataflow/global-or-captured-vars/test.py @@ -85,4 +85,34 @@ def baz7(loc_foo): threading.Thread(target=bar7).start() -baz7(foo7) \ No newline at end of file +baz7(foo7) + +# Test 8 +# FN - Flow is also *not* found in the above case through a direct call + +foo8 = [] + +def bar8(): + time.sleep(1) + ensure_tainted(foo8[0]) # $MISSING: tainted + +def baz8(loc_foo): + loc_foo.append(TAINTED_STRING) + +baz8(foo8) +bar8() + +# Test 9 +# TP - Flow is found in the above case when the variable is captured rather than global + +def test9(): + foo9 = [] + def bar9(): + time.sleep(1) + ensure_tainted(foo9[0]) # $tainted + + def baz9(loc_foo): + loc_foo.append(TAINTED_STRING) + + baz9(foo9) + bar9() \ No newline at end of file From 6344f83e4b7740dbe3e406f877064388b4dfdc2a Mon Sep 17 00:00:00 2001 From: Napalys Date: Wed, 20 Nov 2024 13:22:53 +0100 Subject: [PATCH 17/47] JS: Add: tests for taint tracking in groupBy functions --- .../TaintTracking/BasicTaintTracking.expected | 4 ++++ .../test/library-tests/TaintTracking/tst.js | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected b/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected index 79be56cbb7e..ecbab868513 100644 --- a/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected +++ b/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected @@ -246,6 +246,10 @@ typeInferenceMismatch | tst.js:2:13:2:20 | source() | tst.js:70:10:70:18 | xReversed | | tst.js:2:13:2:20 | source() | tst.js:72:10:72:31 | Map.gro ... z => z) | | tst.js:2:13:2:20 | source() | tst.js:74:10:74:34 | Object. ... z => z) | +| tst.js:2:13:2:20 | source() | tst.js:79:14:79:20 | grouped | +| tst.js:75:22:75:29 | source() | tst.js:75:10:75:52 | Map.gro ... (item)) | +| tst.js:82:23:82:30 | source() | tst.js:84:14:84:20 | grouped | +| tst.js:87:22:87:29 | source() | tst.js:90:14:90:25 | taintedValue | | xml.js:5:18:5:25 | source() | xml.js:8:14:8:17 | text | | xml.js:12:17:12:24 | source() | xml.js:13:14:13:19 | result | | xml.js:23:18:23:25 | source() | xml.js:20:14:20:17 | attr | diff --git a/javascript/ql/test/library-tests/TaintTracking/tst.js b/javascript/ql/test/library-tests/TaintTracking/tst.js index 0fab561954d..0c642b3a2c0 100644 --- a/javascript/ql/test/library-tests/TaintTracking/tst.js +++ b/javascript/ql/test/library-tests/TaintTracking/tst.js @@ -72,4 +72,28 @@ function test() { sink(Map.groupBy(x, z => z)); // NOT OK sink(Custom.groupBy(x, z => z)); // OK sink(Object.groupBy(x, z => z)); // NOT OK + sink(Map.groupBy(source(), (item) => sink(item))); // NOT OK + + { + const grouped = Map.groupBy(x, (item) => sink(item)); // NOT OK -- Should be tainted, but it is not + sink(grouped); // NOT OK + } + { + const list = [source()]; + const grouped = Map.groupBy(list, (item) => sink(item)); // NOT OK -- Should be tainted, but it is not + sink(grouped); // NOT OK + } + { + const data = source(); + const result = Object.groupBy(data, item => item); + const taintedValue = result[notDefined()]; + sink(taintedValue); // NOT OK + } + { + const data = source(); + const map = Map.groupBy(data, item => item); + const taintedValue = map.get(true); + sink(taintedValue); // NOT OK -- Should be tainted, but it is not + sink(map.get(true)); // NOT OK -- Should be tainted, but it is not + } } From 58faa2d71edf98ce13009a048a417e1032bd390b Mon Sep 17 00:00:00 2001 From: Napalys Date: Wed, 20 Nov 2024 13:34:11 +0100 Subject: [PATCH 18/47] JS: Add: dataflow step for static method of groupBy from Map. --- .../ql/lib/semmle/javascript/Collections.qll | 17 ++++++++++++++++- .../TaintTracking/BasicTaintTracking.expected | 5 +++++ .../TaintTracking/DataFlowTracking.expected | 2 ++ .../ql/test/library-tests/TaintTracking/tst.js | 8 ++++---- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/javascript/ql/lib/semmle/javascript/Collections.qll b/javascript/ql/lib/semmle/javascript/Collections.qll index c7348e603f4..df7ad317014 100644 --- a/javascript/ql/lib/semmle/javascript/Collections.qll +++ b/javascript/ql/lib/semmle/javascript/Collections.qll @@ -160,7 +160,22 @@ private module CollectionDataFlow { exists(DataFlow::MethodCallNode call | call = DataFlow::globalVarRef(["Map", "Object"]).getAMemberCall("groupBy") and pred = call.getArgument(0) and - succ = call + (succ = call.getCallback(1).getParameter(0) or succ = call.getALocalUse()) + ) + } + } + + /** + * A step for handling data flow and taint tracking for the groupBy method on iterable objects. + * Ensures propagation of taint and data flow through the groupBy operation. + */ + private class GroupByDataFlowStep extends PreCallGraphStep { + override predicate storeStep(DataFlow::Node pred, DataFlow::SourceNode succ, string prop) { + exists(DataFlow::MethodCallNode call | + call = DataFlow::globalVarRef("Map").getAMemberCall("groupBy") and + pred = call.getArgument(0) and + succ = call and + prop = mapValueUnknownKey() ) } } diff --git a/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected b/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected index ecbab868513..005327d188e 100644 --- a/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected +++ b/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected @@ -246,10 +246,15 @@ typeInferenceMismatch | tst.js:2:13:2:20 | source() | tst.js:70:10:70:18 | xReversed | | tst.js:2:13:2:20 | source() | tst.js:72:10:72:31 | Map.gro ... z => z) | | tst.js:2:13:2:20 | source() | tst.js:74:10:74:34 | Object. ... z => z) | +| tst.js:2:13:2:20 | source() | tst.js:78:55:78:58 | item | | tst.js:2:13:2:20 | source() | tst.js:79:14:79:20 | grouped | | tst.js:75:22:75:29 | source() | tst.js:75:10:75:52 | Map.gro ... (item)) | +| tst.js:75:22:75:29 | source() | tst.js:75:47:75:50 | item | +| tst.js:82:23:82:30 | source() | tst.js:83:58:83:61 | item | | tst.js:82:23:82:30 | source() | tst.js:84:14:84:20 | grouped | | tst.js:87:22:87:29 | source() | tst.js:90:14:90:25 | taintedValue | +| tst.js:93:22:93:29 | source() | tst.js:96:14:96:25 | taintedValue | +| tst.js:93:22:93:29 | source() | tst.js:97:14:97:26 | map.get(true) | | xml.js:5:18:5:25 | source() | xml.js:8:14:8:17 | text | | xml.js:12:17:12:24 | source() | xml.js:13:14:13:19 | result | | xml.js:23:18:23:25 | source() | xml.js:20:14:20:17 | attr | diff --git a/javascript/ql/test/library-tests/TaintTracking/DataFlowTracking.expected b/javascript/ql/test/library-tests/TaintTracking/DataFlowTracking.expected index 33a27661ecd..3b89229b2d7 100644 --- a/javascript/ql/test/library-tests/TaintTracking/DataFlowTracking.expected +++ b/javascript/ql/test/library-tests/TaintTracking/DataFlowTracking.expected @@ -112,3 +112,5 @@ | thisAssignments.js:7:19:7:26 | source() | thisAssignments.js:8:10:8:20 | this.field2 | | tst.js:2:13:2:20 | source() | tst.js:4:10:4:10 | x | | tst.js:2:13:2:20 | source() | tst.js:54:14:54:19 | unsafe | +| tst.js:93:22:93:29 | source() | tst.js:96:14:96:25 | taintedValue | +| tst.js:93:22:93:29 | source() | tst.js:97:14:97:26 | map.get(true) | diff --git a/javascript/ql/test/library-tests/TaintTracking/tst.js b/javascript/ql/test/library-tests/TaintTracking/tst.js index 0c642b3a2c0..a0b596802b7 100644 --- a/javascript/ql/test/library-tests/TaintTracking/tst.js +++ b/javascript/ql/test/library-tests/TaintTracking/tst.js @@ -75,12 +75,12 @@ function test() { sink(Map.groupBy(source(), (item) => sink(item))); // NOT OK { - const grouped = Map.groupBy(x, (item) => sink(item)); // NOT OK -- Should be tainted, but it is not + const grouped = Map.groupBy(x, (item) => sink(item)); // NOT OK sink(grouped); // NOT OK } { const list = [source()]; - const grouped = Map.groupBy(list, (item) => sink(item)); // NOT OK -- Should be tainted, but it is not + const grouped = Map.groupBy(list, (item) => sink(item)); // NOT OK sink(grouped); // NOT OK } { @@ -93,7 +93,7 @@ function test() { const data = source(); const map = Map.groupBy(data, item => item); const taintedValue = map.get(true); - sink(taintedValue); // NOT OK -- Should be tainted, but it is not - sink(map.get(true)); // NOT OK -- Should be tainted, but it is not + sink(taintedValue); // NOT OK + sink(map.get(true)); // NOT OK } } From cdf43f7118e2e535fdc751aa1870e663a6da499d Mon Sep 17 00:00:00 2001 From: Napalys Date: Wed, 20 Nov 2024 14:06:44 +0100 Subject: [PATCH 19/47] Added change notes --- .../ql/lib/change-notes/2024-11-20-ES2024-group-functions.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 javascript/ql/lib/change-notes/2024-11-20-ES2024-group-functions.md diff --git a/javascript/ql/lib/change-notes/2024-11-20-ES2024-group-functions.md b/javascript/ql/lib/change-notes/2024-11-20-ES2024-group-functions.md new file mode 100644 index 00000000000..8511727f8e7 --- /dev/null +++ b/javascript/ql/lib/change-notes/2024-11-20-ES2024-group-functions.md @@ -0,0 +1,4 @@ +--- +category: minorAnalysis +--- +* Added taint-steps for `Map.groupBy` and `Object.groupBy`. From 09f73d8d6f359f5681046bc5805e667d23228bdc Mon Sep 17 00:00:00 2001 From: Napalys Date: Wed, 20 Nov 2024 17:36:43 +0100 Subject: [PATCH 20/47] JS: Add: test cases for toWellFormed --- .../TaintTracking/string-immutable-operations.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 javascript/ql/test/library-tests/TaintTracking/string-immutable-operations.js diff --git a/javascript/ql/test/library-tests/TaintTracking/string-immutable-operations.js b/javascript/ql/test/library-tests/TaintTracking/string-immutable-operations.js new file mode 100644 index 00000000000..60f6c44088c --- /dev/null +++ b/javascript/ql/test/library-tests/TaintTracking/string-immutable-operations.js @@ -0,0 +1,12 @@ +function test() { + let x = source(); + sink(x.toWellFormed()); // NOT OK -- Currently not tainted, but should be + + const wellFormedX = x.toWellFormed(); + sink(wellFormedX); // NOT OK -- Currently not tainted, but should be + + const concatWellFormedX = "/" + wellFormedX + "!"; + sink(concatWellFormedX); // NOT OK -- Currently not tainted, but should be + + sink(source().toWellFormed()); // NOT OK -- Currently not tainted, but should be +} From afc2d3e6d25f24d6111072b555357151b3684222 Mon Sep 17 00:00:00 2001 From: Napalys Date: Wed, 20 Nov 2024 17:42:25 +0100 Subject: [PATCH 21/47] JS: Add: String.protytpe.toWellFormed to StringManipulationTaintStep --- .../ql/lib/semmle/javascript/dataflow/TaintTracking.qll | 2 +- .../TaintTracking/BasicTaintTracking.expected | 4 ++++ .../TaintTracking/string-immutable-operations.js | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/javascript/ql/lib/semmle/javascript/dataflow/TaintTracking.qll b/javascript/ql/lib/semmle/javascript/dataflow/TaintTracking.qll index a19691e9448..6b6fc9c4b07 100644 --- a/javascript/ql/lib/semmle/javascript/dataflow/TaintTracking.qll +++ b/javascript/ql/lib/semmle/javascript/dataflow/TaintTracking.qll @@ -612,7 +612,7 @@ module TaintTracking { "italics", "link", "padEnd", "padStart", "repeat", "replace", "replaceAll", "slice", "small", "split", "strike", "sub", "substr", "substring", "sup", "toLocaleLowerCase", "toLocaleUpperCase", "toLowerCase", "toUpperCase", "trim", - "trimLeft", "trimRight" + "trimLeft", "trimRight", "toWellFormed" ] or // sorted, interesting, properties of Object.prototype diff --git a/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected b/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected index f81405a32a2..3d4fd0b67f8 100644 --- a/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected +++ b/javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected @@ -209,6 +209,10 @@ typeInferenceMismatch | static-capture-groups.js:2:17:2:24 | source() | static-capture-groups.js:27:14:27:22 | RegExp.$1 | | static-capture-groups.js:32:17:32:24 | source() | static-capture-groups.js:38:10:38:18 | RegExp.$1 | | static-capture-groups.js:42:12:42:19 | source() | static-capture-groups.js:43:14:43:22 | RegExp.$1 | +| string-immutable-operations.js:2:13:2:20 | source() | string-immutable-operations.js:3:10:3:25 | x.toWellFormed() | +| string-immutable-operations.js:2:13:2:20 | source() | string-immutable-operations.js:6:10:6:20 | wellFormedX | +| string-immutable-operations.js:2:13:2:20 | source() | string-immutable-operations.js:9:10:9:26 | concatWellFormedX | +| string-immutable-operations.js:11:10:11:17 | source() | string-immutable-operations.js:11:10:11:32 | source( ... ormed() | | string-replace.js:3:13:3:20 | source() | string-replace.js:14:10:14:13 | data | | string-replace.js:3:13:3:20 | source() | string-replace.js:18:10:18:13 | data | | string-replace.js:3:13:3:20 | source() | string-replace.js:21:6:21:41 | safe(). ... taint) | diff --git a/javascript/ql/test/library-tests/TaintTracking/string-immutable-operations.js b/javascript/ql/test/library-tests/TaintTracking/string-immutable-operations.js index 60f6c44088c..79e93fab002 100644 --- a/javascript/ql/test/library-tests/TaintTracking/string-immutable-operations.js +++ b/javascript/ql/test/library-tests/TaintTracking/string-immutable-operations.js @@ -1,12 +1,12 @@ function test() { let x = source(); - sink(x.toWellFormed()); // NOT OK -- Currently not tainted, but should be + sink(x.toWellFormed()); // NOT OK const wellFormedX = x.toWellFormed(); - sink(wellFormedX); // NOT OK -- Currently not tainted, but should be + sink(wellFormedX); // NOT OK const concatWellFormedX = "/" + wellFormedX + "!"; - sink(concatWellFormedX); // NOT OK -- Currently not tainted, but should be + sink(concatWellFormedX); // NOT OK - sink(source().toWellFormed()); // NOT OK -- Currently not tainted, but should be + sink(source().toWellFormed()); // NOT OK } From 43eda58f83d4e81ecba1505a67b68e4a33e4b061 Mon Sep 17 00:00:00 2001 From: Napalys Date: Wed, 20 Nov 2024 17:44:36 +0100 Subject: [PATCH 22/47] Added change notes --- .../2024-11-20-ES2023-string-protytpe-toWellFormed.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 javascript/ql/lib/change-notes/2024-11-20-ES2023-string-protytpe-toWellFormed.md diff --git a/javascript/ql/lib/change-notes/2024-11-20-ES2023-string-protytpe-toWellFormed.md b/javascript/ql/lib/change-notes/2024-11-20-ES2023-string-protytpe-toWellFormed.md new file mode 100644 index 00000000000..dda4d878760 --- /dev/null +++ b/javascript/ql/lib/change-notes/2024-11-20-ES2023-string-protytpe-toWellFormed.md @@ -0,0 +1,4 @@ +--- +category: minorAnalysis +--- +* Added taint-steps for `String.prototype.toWellFormed`. From d828941b7c026df222df78f02832b44e9613bad3 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Wed, 20 Nov 2024 22:37:46 +0000 Subject: [PATCH 23/47] Rust: Address review comments. --- rust/ql/src/queries/security/CWE-089/SqlInjection.ql | 3 --- rust/ql/src/queries/security/CWE-089/SqlInjectionBad.rs | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/rust/ql/src/queries/security/CWE-089/SqlInjection.ql b/rust/ql/src/queries/security/CWE-089/SqlInjection.ql index c8db4569e59..cf1ea5534aa 100644 --- a/rust/ql/src/queries/security/CWE-089/SqlInjection.ql +++ b/rust/ql/src/queries/security/CWE-089/SqlInjection.ql @@ -27,9 +27,6 @@ module SqlInjectionConfig implements DataFlow::ConfigSig { predicate isBarrier(DataFlow::Node barrier) { barrier instanceof SqlInjection::Barrier } } -/** - * Detect taint flow of tainted data that reaches a SQL sink. - */ module SqlInjectionFlow = TaintTracking::Global; from SqlInjectionFlow::PathNode sourceNode, SqlInjectionFlow::PathNode sinkNode diff --git a/rust/ql/src/queries/security/CWE-089/SqlInjectionBad.rs b/rust/ql/src/queries/security/CWE-089/SqlInjectionBad.rs index cd0086b7eb2..4184399a4f1 100644 --- a/rust/ql/src/queries/security/CWE-089/SqlInjectionBad.rs +++ b/rust/ql/src/queries/security/CWE-089/SqlInjectionBad.rs @@ -4,4 +4,4 @@ let unsafe_query = format!("SELECT * FROM people WHERE firstname='{remote_contro let _ = conn.execute(unsafe_query.as_str()).await?; // BAD (arbitrary SQL injection is possible) -let _ = sqlx::query(unsafe_query.as_str()).fetch_all(&mut conn).await?; // $ BAD (arbitrary SQL injection is possible) +let _ = sqlx::query(unsafe_query.as_str()).fetch_all(&mut conn).await?; // BAD (arbitrary SQL injection is possible) From f25c16245c1ac0d52578b3549d91f9b8d8917c99 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 00:21:44 +0000 Subject: [PATCH 24/47] Add changed framework coverage reports --- .../library-coverage/coverage.csv | 262 ++++++++++-------- .../library-coverage/coverage.rst | 22 +- 2 files changed, 152 insertions(+), 132 deletions(-) diff --git a/go/documentation/library-coverage/coverage.csv b/go/documentation/library-coverage/coverage.csv index 547f0aa79ac..21127e396a2 100644 --- a/go/documentation/library-coverage/coverage.csv +++ b/go/documentation/library-coverage/coverage.csv @@ -1,121 +1,141 @@ -package,sink,source,summary,sink:command-injection,sink:credentials-key,sink:jwt,sink:path-injection,sink:regex-use[0],sink:regex-use[1],sink:regex-use[c],sink:request-forgery,sink:request-forgery[TCP Addr + Port],sink:url-redirection,sink:url-redirection[0],sink:url-redirection[receiver],sink:xpath-injection,source:environment,source:file,source:remote,source:stdin,summary:taint,summary:value -,,,8,,,,,,,,,,,,,,,,,,3,5 -archive/tar,,,5,,,,,,,,,,,,,,,,,,5, -archive/zip,,,6,,,,,,,,,,,,,,,,,,6, -bufio,,,17,,,,,,,,,,,,,,,,,,17, -bytes,,,43,,,,,,,,,,,,,,,,,,43, -clevergo.tech/clevergo,1,,,,,,,,,,,,,,1,,,,,,, -compress/bzip2,,,1,,,,,,,,,,,,,,,,,,1, -compress/flate,,,4,,,,,,,,,,,,,,,,,,4, -compress/gzip,,,3,,,,,,,,,,,,,,,,,,3, -compress/lzw,,,1,,,,,,,,,,,,,,,,,,1, -compress/zlib,,,4,,,,,,,,,,,,,,,,,,4, -container/heap,,,5,,,,,,,,,,,,,,,,,,5, -container/list,,,20,,,,,,,,,,,,,,,,,,20, -container/ring,,,5,,,,,,,,,,,,,,,,,,5, -context,,,5,,,,,,,,,,,,,,,,,,5, -crypto,,,10,,,,,,,,,,,,,,,,,,10, -database/sql,,,11,,,,,,,,,,,,,,,,,,11, -encoding,,,77,,,,,,,,,,,,,,,,,,77, -errors,,,3,,,,,,,,,,,,,,,,,,3, -expvar,,,6,,,,,,,,,,,,,,,,,,6, -fmt,,,16,,,,,,,,,,,,,,,,,,16, -github.com/ChrisTrenkamp/goxpath,3,,,,,,,,,,,,,,,3,,,,,, -github.com/antchfx/htmlquery,4,,,,,,,,,,,,,,,4,,,,,, -github.com/antchfx/jsonquery,4,,,,,,,,,,,,,,,4,,,,,, -github.com/antchfx/xmlquery,8,,,,,,,,,,,,,,,8,,,,,, -github.com/antchfx/xpath,4,,,,,,,,,,,,,,,4,,,,,, -github.com/appleboy/gin-jwt,1,,,,1,,,,,,,,,,,,,,,,, -github.com/astaxie/beego,7,21,21,,,,5,,,,,,2,,,,,,21,,21, -github.com/beego/beego,14,42,42,,,,10,,,,,,4,,,,,,42,,42, -github.com/caarlos0/env,,5,2,,,,,,,,,,,,,,5,,,,1,1 -github.com/clevergo/clevergo,1,,,,,,,,,,,,,,1,,,,,,, -github.com/codeskyblue/go-sh,4,,,4,,,,,,,,,,,,,,,,,, -github.com/couchbase/gocb,,,18,,,,,,,,,,,,,,,,,,18, -github.com/couchbaselabs/gocb,,,18,,,,,,,,,,,,,,,,,,18, -github.com/crankycoder/xmlpath,2,,,,,,,,,,,,,,,2,,,,,, -github.com/cristalhq/jwt,1,,,,1,,,,,,,,,,,,,,,,, -github.com/dgrijalva/jwt-go,3,,9,,2,1,,,,,,,,,,,,,,,9, -github.com/elazarl/goproxy,,2,2,,,,,,,,,,,,,,,,2,,2, -github.com/emicklei/go-restful,,7,,,,,,,,,,,,,,,,,7,,, -github.com/evanphx/json-patch,,,12,,,,,,,,,,,,,,,,,,12, -github.com/form3tech-oss/jwt-go,2,,,,2,,,,,,,,,,,,,,,,, -github.com/gin-gonic/gin,3,46,2,,,,3,,,,,,,,,,,,46,,2, -github.com/go-chi/chi,,3,,,,,,,,,,,,,,,,,3,,, -github.com/go-chi/jwtauth,1,,,,1,,,,,,,,,,,,,,,,, -github.com/go-jose/go-jose,3,,4,,2,1,,,,,,,,,,,,,,,4, -github.com/go-kit/kit/auth/jwt,1,,,,1,,,,,,,,,,,,,,,,, -github.com/go-pg/pg/orm,,,6,,,,,,,,,,,,,,,,,,6, -github.com/go-xmlpath/xmlpath,2,,,,,,,,,,,,,,,2,,,,,, -github.com/gobuffalo/envy,,7,,,,,,,,,,,,,,,7,,,,, -github.com/gobwas/ws,,2,,,,,,,,,,,,,,,,,2,,, -github.com/gofiber/fiber,5,,,,,,4,,,,,,,,1,,,,,,, -github.com/gogf/gf-jwt,1,,,,1,,,,,,,,,,,,,,,,, -github.com/going/toolkit/xmlpath,2,,,,,,,,,,,,,,,2,,,,,, -github.com/golang-jwt/jwt,3,,11,,2,1,,,,,,,,,,,,,,,11, -github.com/golang/protobuf/proto,,,4,,,,,,,,,,,,,,,,,,4, -github.com/gorilla/mux,,1,,,,,,,,,,,,,,,,,1,,, -github.com/gorilla/websocket,,3,,,,,,,,,,,,,,,,,3,,, -github.com/hashicorp/go-envparse,,1,,,,,,,,,,,,,,,1,,,,, -github.com/jbowtie/gokogiri/xml,4,,,,,,,,,,,,,,,4,,,,,, -github.com/jbowtie/gokogiri/xpath,1,,,,,,,,,,,,,,,1,,,,,, -github.com/joho/godotenv,,4,,,,,,,,,,,,,,,4,,,,, -github.com/json-iterator/go,,,4,,,,,,,,,,,,,,,,,,4, -github.com/kataras/iris/context,6,,,,,,6,,,,,,,,,,,,,,, -github.com/kataras/iris/middleware/jwt,2,,,,2,,,,,,,,,,,,,,,,, -github.com/kataras/iris/server/web/context,6,,,,,,6,,,,,,,,,,,,,,, -github.com/kataras/jwt,5,,,,5,,,,,,,,,,,,,,,,, -github.com/kelseyhightower/envconfig,,6,,,,,,,,,,,,,,,6,,,,, -github.com/labstack/echo,3,12,2,,,,2,,,,,,1,,,,,,12,,2, -github.com/lestrrat-go/jwx,2,,,,2,,,,,,,,,,,,,,,,, -github.com/lestrrat-go/libxml2/parser,3,,,,,,,,,,,,,,,3,,,,,, -github.com/lestrrat/go-jwx/jwk,1,,,,1,,,,,,,,,,,,,,,,, -github.com/masterzen/xmlpath,2,,,,,,,,,,,,,,,2,,,,,, -github.com/moovweb/gokogiri/xml,4,,,,,,,,,,,,,,,4,,,,,, -github.com/moovweb/gokogiri/xpath,1,,,,,,,,,,,,,,,1,,,,,, -github.com/ory/fosite/token/jwt,2,,,,2,,,,,,,,,,,,,,,,, -github.com/revel/revel,2,23,10,,,,1,,,,,,1,,,,,,23,,10, -github.com/robfig/revel,2,23,10,,,,1,,,,,,1,,,,,,23,,10, -github.com/santhosh-tekuri/xpathparser,2,,,,,,,,,,,,,,,2,,,,,, -github.com/sendgrid/sendgrid-go/helpers/mail,,,1,,,,,,,,,,,,,,,,,,1, -github.com/spf13/afero,34,,,,,,34,,,,,,,,,,,,,,, -github.com/square/go-jose,3,,4,,2,1,,,,,,,,,,,,,,,4, -github.com/valyala/fasthttp,35,50,5,,,,8,,,,17,8,2,,,,,,50,,5, -go.uber.org/zap,,,11,,,,,,,,,,,,,,,,,,11, -golang.org/x/crypto/ssh,4,,,4,,,,,,,,,,,,,,,,,, -golang.org/x/net/context,,,5,,,,,,,,,,,,,,,,,,5, -golang.org/x/net/html,,,16,,,,,,,,,,,,,,,,,,16, -golang.org/x/net/websocket,,2,,,,,,,,,,,,,,,,,2,,, -google.golang.org/protobuf/internal/encoding/text,,,1,,,,,,,,,,,,,,,,,,1, -google.golang.org/protobuf/internal/impl,,,2,,,,,,,,,,,,,,,,,,2, -google.golang.org/protobuf/proto,,,8,,,,,,,,,,,,,,,,,,8, -google.golang.org/protobuf/reflect/protoreflect,,,1,,,,,,,,,,,,,,,,,,1, -gopkg.in/couchbase/gocb,,,18,,,,,,,,,,,,,,,,,,18, -gopkg.in/go-jose/go-jose,3,,4,,2,1,,,,,,,,,,,,,,,4, -gopkg.in/go-xmlpath/xmlpath,2,,,,,,,,,,,,,,,2,,,,,, -gopkg.in/macaron,1,12,1,,,,,,,,,,,,1,,,,12,,1, -gopkg.in/square/go-jose,3,,4,,2,1,,,,,,,,,,,,,,,4, -gopkg.in/xmlpath,2,,,,,,,,,,,,,,,2,,,,,, -gopkg.in/yaml,,,9,,,,,,,,,,,,,,,,,,9, -html,,,8,,,,,,,,,,,,,,,,,,8, -io,5,4,34,,,,5,,,,,,,,,,,4,,,34, -k8s.io/api/core,,,10,,,,,,,,,,,,,,,,,,10, -k8s.io/apimachinery/pkg/runtime,,,47,,,,,,,,,,,,,,,,,,47, -launchpad.net/xmlpath,2,,,,,,,,,,,,,,,2,,,,,, -log,,,3,,,,,,,,,,,,,,,,,,3, -math/big,,,1,,,,,,,,,,,,,,,,,,1, -mime,,,14,,,,,,,,,,,,,,,,,,14, -net,2,16,100,,,,1,,,,,,,1,,,,,16,,100, -nhooyr.io/websocket,,2,,,,,,,,,,,,,,,,,2,,, -os,29,11,6,3,,,26,,,,,,,,,,7,3,,1,6, -path,,,18,,,,,,,,,,,,,,,,,,18, -reflect,,,37,,,,,,,,,,,,,,,,,,37, -regexp,10,,20,,,,,3,3,4,,,,,,,,,,,20, -sort,,,1,,,,,,,,,,,,,,,,,,1, -strconv,,,9,,,,,,,,,,,,,,,,,,9, -strings,,,34,,,,,,,,,,,,,,,,,,34, -sync,,,34,,,,,,,,,,,,,,,,,,34, -syscall,5,2,8,5,,,,,,,,,,,,,2,,,,8, -text/scanner,,,3,,,,,,,,,,,,,,,,,,3, -text/tabwriter,,,1,,,,,,,,,,,,,,,,,,1, -text/template,,,6,,,,,,,,,,,,,,,,,,6, +package,sink,source,summary,sink:command-injection,sink:credentials-key,sink:jwt,sink:log-injection,sink:nosql-injection,sink:path-injection,sink:regex-use[0],sink:regex-use[1],sink:regex-use[c],sink:request-forgery,sink:request-forgery[TCP Addr + Port],sink:sql-injection,sink:url-redirection,sink:url-redirection[0],sink:url-redirection[receiver],sink:xpath-injection,source:environment,source:file,source:remote,source:stdin,summary:taint,summary:value +,,,8,,,,,,,,,,,,,,,,,,,,,3,5 +archive/tar,,,5,,,,,,,,,,,,,,,,,,,,,5, +archive/zip,,,6,,,,,,,,,,,,,,,,,,,,,6, +bufio,,,17,,,,,,,,,,,,,,,,,,,,,17, +bytes,,,43,,,,,,,,,,,,,,,,,,,,,43, +clevergo.tech/clevergo,1,,,,,,,,,,,,,,,,,1,,,,,,, +compress/bzip2,,,1,,,,,,,,,,,,,,,,,,,,,1, +compress/flate,,,4,,,,,,,,,,,,,,,,,,,,,4, +compress/gzip,,,3,,,,,,,,,,,,,,,,,,,,,3, +compress/lzw,,,1,,,,,,,,,,,,,,,,,,,,,1, +compress/zlib,,,4,,,,,,,,,,,,,,,,,,,,,4, +container/heap,,,5,,,,,,,,,,,,,,,,,,,,,5, +container/list,,,20,,,,,,,,,,,,,,,,,,,,,20, +container/ring,,,5,,,,,,,,,,,,,,,,,,,,,5, +context,,,5,,,,,,,,,,,,,,,,,,,,,5, +crypto,,,10,,,,,,,,,,,,,,,,,,,,,10, +database/sql,30,,11,,,,,,,,,,,,30,,,,,,,,,11, +encoding,,,77,,,,,,,,,,,,,,,,,,,,,77, +errors,,,3,,,,,,,,,,,,,,,,,,,,,3, +expvar,,,6,,,,,,,,,,,,,,,,,,,,,6, +fmt,3,,16,,,,3,,,,,,,,,,,,,,,,,16, +github.com/ChrisTrenkamp/goxpath,3,,,,,,,,,,,,,,,,,,3,,,,,, +github.com/Masterminds/squirrel,32,,,,,,,,,,,,,,32,,,,,,,,,, +github.com/Sirupsen/logrus,145,,,,,,145,,,,,,,,,,,,,,,,,, +github.com/antchfx/htmlquery,4,,,,,,,,,,,,,,,,,,4,,,,,, +github.com/antchfx/jsonquery,4,,,,,,,,,,,,,,,,,,4,,,,,, +github.com/antchfx/xmlquery,8,,,,,,,,,,,,,,,,,,8,,,,,, +github.com/antchfx/xpath,4,,,,,,,,,,,,,,,,,,4,,,,,, +github.com/appleboy/gin-jwt,1,,,,1,,,,,,,,,,,,,,,,,,,, +github.com/astaxie/beego,71,21,21,,,,34,,5,,,,,,30,2,,,,,,21,,21, +github.com/beego/beego,142,42,42,,,,68,,10,,,,,,60,4,,,,,,42,,42, +github.com/caarlos0/env,,5,2,,,,,,,,,,,,,,,,,5,,,,1,1 +github.com/clevergo/clevergo,1,,,,,,,,,,,,,,,,,1,,,,,,, +github.com/codeskyblue/go-sh,4,,,4,,,,,,,,,,,,,,,,,,,,, +github.com/couchbase/gocb,8,,18,,,,,8,,,,,,,,,,,,,,,,18, +github.com/couchbaselabs/gocb,8,,18,,,,,8,,,,,,,,,,,,,,,,18, +github.com/crankycoder/xmlpath,2,,,,,,,,,,,,,,,,,,2,,,,,, +github.com/cristalhq/jwt,1,,,,1,,,,,,,,,,,,,,,,,,,, +github.com/davecgh/go-spew/spew,9,,,,,,9,,,,,,,,,,,,,,,,,, +github.com/dgrijalva/jwt-go,3,,9,,2,1,,,,,,,,,,,,,,,,,,9, +github.com/elazarl/goproxy,2,2,2,,,,2,,,,,,,,,,,,,,,2,,2, +github.com/emicklei/go-restful,,7,,,,,,,,,,,,,,,,,,,,7,,, +github.com/evanphx/json-patch,,,12,,,,,,,,,,,,,,,,,,,,,12, +github.com/form3tech-oss/jwt-go,2,,,,2,,,,,,,,,,,,,,,,,,,, +github.com/gin-gonic/gin,3,46,2,,,,,,3,,,,,,,,,,,,,46,,2, +github.com/go-chi/chi,,3,,,,,,,,,,,,,,,,,,,,3,,, +github.com/go-chi/jwtauth,1,,,,1,,,,,,,,,,,,,,,,,,,, +github.com/go-gorm/gorm,13,,,,,,,,,,,,,,13,,,,,,,,,, +github.com/go-jose/go-jose,3,,4,,2,1,,,,,,,,,,,,,,,,,,4, +github.com/go-kit/kit/auth/jwt,1,,,,1,,,,,,,,,,,,,,,,,,,, +github.com/go-pg/pg/orm,,,6,,,,,,,,,,,,,,,,,,,,,6, +github.com/go-xmlpath/xmlpath,2,,,,,,,,,,,,,,,,,,2,,,,,, +github.com/go-xorm/xorm,34,,,,,,,,,,,,,,34,,,,,,,,,, +github.com/gobuffalo/envy,,7,,,,,,,,,,,,,,,,,,7,,,,, +github.com/gobwas/ws,,2,,,,,,,,,,,,,,,,,,,,2,,, +github.com/gofiber/fiber,5,,,,,,,,4,,,,,,,,,1,,,,,,, +github.com/gogf/gf-jwt,1,,,,1,,,,,,,,,,,,,,,,,,,, +github.com/gogf/gf/database/gdb,51,,,,,,,,,,,,,,51,,,,,,,,,, +github.com/going/toolkit/xmlpath,2,,,,,,,,,,,,,,,,,,2,,,,,, +github.com/golang-jwt/jwt,3,,11,,2,1,,,,,,,,,,,,,,,,,,11, +github.com/golang/glog,90,,,,,,90,,,,,,,,,,,,,,,,,, +github.com/golang/protobuf/proto,,,4,,,,,,,,,,,,,,,,,,,,,4, +github.com/gorilla/mux,,1,,,,,,,,,,,,,,,,,,,,1,,, +github.com/gorilla/websocket,,3,,,,,,,,,,,,,,,,,,,,3,,, +github.com/hashicorp/go-envparse,,1,,,,,,,,,,,,,,,,,,1,,,,, +github.com/jbowtie/gokogiri/xml,4,,,,,,,,,,,,,,,,,,4,,,,,, +github.com/jbowtie/gokogiri/xpath,1,,,,,,,,,,,,,,,,,,1,,,,,, +github.com/jinzhu/gorm,13,,,,,,,,,,,,,,13,,,,,,,,,, +github.com/jmoiron/sqlx,12,,,,,,,,,,,,,,12,,,,,,,,,, +github.com/joho/godotenv,,4,,,,,,,,,,,,,,,,,,4,,,,, +github.com/json-iterator/go,,,4,,,,,,,,,,,,,,,,,,,,,4, +github.com/kataras/iris/context,6,,,,,,,,6,,,,,,,,,,,,,,,, +github.com/kataras/iris/middleware/jwt,2,,,,2,,,,,,,,,,,,,,,,,,,, +github.com/kataras/iris/server/web/context,6,,,,,,,,6,,,,,,,,,,,,,,,, +github.com/kataras/jwt,5,,,,5,,,,,,,,,,,,,,,,,,,, +github.com/kelseyhightower/envconfig,,6,,,,,,,,,,,,,,,,,,6,,,,, +github.com/labstack/echo,3,12,2,,,,,,2,,,,,,,1,,,,,,12,,2, +github.com/lann/squirrel,32,,,,,,,,,,,,,,32,,,,,,,,,, +github.com/lestrrat-go/jwx,2,,,,2,,,,,,,,,,,,,,,,,,,, +github.com/lestrrat-go/libxml2/parser,3,,,,,,,,,,,,,,,,,,3,,,,,, +github.com/lestrrat/go-jwx/jwk,1,,,,1,,,,,,,,,,,,,,,,,,,, +github.com/masterzen/xmlpath,2,,,,,,,,,,,,,,,,,,2,,,,,, +github.com/moovweb/gokogiri/xml,4,,,,,,,,,,,,,,,,,,4,,,,,, +github.com/moovweb/gokogiri/xpath,1,,,,,,,,,,,,,,,,,,1,,,,,, +github.com/ory/fosite/token/jwt,2,,,,2,,,,,,,,,,,,,,,,,,,, +github.com/raindog308/gorqlite,24,,,,,,,,,,,,,,24,,,,,,,,,, +github.com/revel/revel,2,23,10,,,,,,1,,,,,,,1,,,,,,23,,10, +github.com/robfig/revel,2,23,10,,,,,,1,,,,,,,1,,,,,,23,,10, +github.com/rqlite/gorqlite,24,,,,,,,,,,,,,,24,,,,,,,,,, +github.com/santhosh-tekuri/xpathparser,2,,,,,,,,,,,,,,,,,,2,,,,,, +github.com/sendgrid/sendgrid-go/helpers/mail,,,1,,,,,,,,,,,,,,,,,,,,,1, +github.com/sirupsen/logrus,145,,,,,,145,,,,,,,,,,,,,,,,,, +github.com/spf13/afero,34,,,,,,,,34,,,,,,,,,,,,,,,, +github.com/square/go-jose,3,,4,,2,1,,,,,,,,,,,,,,,,,,4, +github.com/uptrace/bun,63,,,,,,,,,,,,,,63,,,,,,,,,, +github.com/valyala/fasthttp,35,50,5,,,,,,8,,,,17,8,,2,,,,,,50,,5, +go.mongodb.org/mongo-driver/mongo,14,,,,,,,14,,,,,,,,,,,,,,,,, +go.uber.org/zap,33,,11,,,,33,,,,,,,,,,,,,,,,,11, +golang.org/x/crypto/ssh,4,,,4,,,,,,,,,,,,,,,,,,,,, +golang.org/x/net/context,,,5,,,,,,,,,,,,,,,,,,,,,5, +golang.org/x/net/html,,,16,,,,,,,,,,,,,,,,,,,,,16, +golang.org/x/net/websocket,,2,,,,,,,,,,,,,,,,,,,,2,,, +google.golang.org/protobuf/internal/encoding/text,,,1,,,,,,,,,,,,,,,,,,,,,1, +google.golang.org/protobuf/internal/impl,,,2,,,,,,,,,,,,,,,,,,,,,2, +google.golang.org/protobuf/proto,,,8,,,,,,,,,,,,,,,,,,,,,8, +google.golang.org/protobuf/reflect/protoreflect,,,1,,,,,,,,,,,,,,,,,,,,,1, +gopkg.in/Masterminds/squirrel,32,,,,,,,,,,,,,,32,,,,,,,,,, +gopkg.in/couchbase/gocb,8,,18,,,,,8,,,,,,,,,,,,,,,,18, +gopkg.in/glog,90,,,,,,90,,,,,,,,,,,,,,,,,, +gopkg.in/go-jose/go-jose,3,,4,,2,1,,,,,,,,,,,,,,,,,,4, +gopkg.in/go-xmlpath/xmlpath,2,,,,,,,,,,,,,,,,,,2,,,,,, +gopkg.in/macaron,1,12,1,,,,,,,,,,,,,,,1,,,,12,,1, +gopkg.in/square/go-jose,3,,4,,2,1,,,,,,,,,,,,,,,,,,4, +gopkg.in/xmlpath,2,,,,,,,,,,,,,,,,,,2,,,,,, +gopkg.in/yaml,,,9,,,,,,,,,,,,,,,,,,,,,9, +gorm.io/gorm,13,,,,,,,,,,,,,,13,,,,,,,,,, +html,,,8,,,,,,,,,,,,,,,,,,,,,8, +io,5,4,34,,,,,,5,,,,,,,,,,,,4,,,34, +k8s.io/api/core,,,10,,,,,,,,,,,,,,,,,,,,,10, +k8s.io/apimachinery/pkg/runtime,,,47,,,,,,,,,,,,,,,,,,,,,47, +k8s.io/klog,90,,,,,,90,,,,,,,,,,,,,,,,,, +launchpad.net/xmlpath,2,,,,,,,,,,,,,,,,,,2,,,,,, +log,20,,3,,,,20,,,,,,,,,,,,,,,,,3, +math/big,,,1,,,,,,,,,,,,,,,,,,,,,1, +mime,,,14,,,,,,,,,,,,,,,,,,,,,14, +net,2,16,100,,,,,,1,,,,,,,,1,,,,,16,,100, +nhooyr.io/websocket,,2,,,,,,,,,,,,,,,,,,,,2,,, +os,29,11,6,3,,,,,26,,,,,,,,,,,7,3,,1,6, +path,,,18,,,,,,,,,,,,,,,,,,,,,18, +reflect,,,37,,,,,,,,,,,,,,,,,,,,,37, +regexp,10,,20,,,,,,,3,3,4,,,,,,,,,,,,20, +sort,,,1,,,,,,,,,,,,,,,,,,,,,1, +strconv,,,9,,,,,,,,,,,,,,,,,,,,,9, +strings,,,34,,,,,,,,,,,,,,,,,,,,,34, +sync,,,34,,,,,,,,,,,,,,,,,,,,,34, +syscall,5,2,8,5,,,,,,,,,,,,,,,,2,,,,8, +text/scanner,,,3,,,,,,,,,,,,,,,,,,,,,3, +text/tabwriter,,,1,,,,,,,,,,,,,,,,,,,,,1, +text/template,,,6,,,,,,,,,,,,,,,,,,,,,6, +xorm.io/xorm,34,,,,,,,,,,,,,,34,,,,,,,,,, diff --git a/go/documentation/library-coverage/coverage.rst b/go/documentation/library-coverage/coverage.rst index 09c44b8aa80..87ac3e6f1cc 100644 --- a/go/documentation/library-coverage/coverage.rst +++ b/go/documentation/library-coverage/coverage.rst @@ -9,27 +9,27 @@ Go framework & library support Framework / library,Package,Flow sources,Taint & value steps,Sinks (total) `Afero `_,``github.com/spf13/afero*``,,,34 `CleverGo `_,"``clevergo.tech/clevergo*``, ``github.com/clevergo/clevergo*``",,,2 - `Couchbase official client(gocb) `_,"``github.com/couchbase/gocb*``, ``gopkg.in/couchbase/gocb*``",,36, - `Couchbase unofficial client `_,``github.com/couchbaselabs/gocb*``,,18, + `Couchbase official client(gocb) `_,"``github.com/couchbase/gocb*``, ``gopkg.in/couchbase/gocb*``",,36,16 + `Couchbase unofficial client `_,``github.com/couchbaselabs/gocb*``,,18,8 `Echo `_,``github.com/labstack/echo*``,12,2,3 `Fiber `_,``github.com/gofiber/fiber*``,,,5 `Fosite `_,``github.com/ory/fosite*``,,,2 `Gin `_,``github.com/gin-gonic/gin*``,46,2,3 - `Glog `_,"``github.com/golang/glog*``, ``gopkg.in/glog*``, ``k8s.io/klog*``",,, + `Glog `_,"``github.com/golang/glog*``, ``gopkg.in/glog*``, ``k8s.io/klog*``",,,270 `Go JOSE `_,"``github.com/go-jose/go-jose*``, ``github.com/square/go-jose*``, ``gopkg.in/square/go-jose*``, ``gopkg.in/go-jose/go-jose*``",,16,12 `Go kit `_,``github.com/go-kit/kit*``,,,1 - `Go-spew `_,``github.com/davecgh/go-spew/spew*``,,, + `Go-spew `_,``github.com/davecgh/go-spew/spew*``,,,9 `Gokogiri `_,"``github.com/jbowtie/gokogiri*``, ``github.com/moovweb/gokogiri*``",,,10 `Iris `_,``github.com/kataras/iris*``,,,14 `Kubernetes `_,"``k8s.io/api*``, ``k8s.io/apimachinery*``",,57, - `Logrus `_,"``github.com/Sirupsen/logrus*``, ``github.com/sirupsen/logrus*``",,, + `Logrus `_,"``github.com/Sirupsen/logrus*``, ``github.com/sirupsen/logrus*``",,,290 `Macaron `_,``gopkg.in/macaron*``,12,1,1 `Revel `_,"``github.com/revel/revel*``, ``github.com/robfig/revel*``",46,20,4 `SendGrid `_,``github.com/sendgrid/sendgrid-go*``,,1, - `Standard library `_,"````, ``archive/*``, ``bufio``, ``bytes``, ``cmp``, ``compress/*``, ``container/*``, ``context``, ``crypto``, ``crypto/*``, ``database/*``, ``debug/*``, ``embed``, ``encoding``, ``encoding/*``, ``errors``, ``expvar``, ``flag``, ``fmt``, ``go/*``, ``hash``, ``hash/*``, ``html``, ``html/*``, ``image``, ``image/*``, ``index/*``, ``io``, ``io/*``, ``log``, ``log/*``, ``maps``, ``math``, ``math/*``, ``mime``, ``mime/*``, ``net``, ``net/*``, ``os``, ``os/*``, ``path``, ``path/*``, ``plugin``, ``reflect``, ``reflect/*``, ``regexp``, ``regexp/*``, ``slices``, ``sort``, ``strconv``, ``strings``, ``sync``, ``sync/*``, ``syscall``, ``syscall/*``, ``testing``, ``testing/*``, ``text/*``, ``time``, ``time/*``, ``unicode``, ``unicode/*``, ``unsafe``",33,587,51 + `Standard library `_,"````, ``archive/*``, ``bufio``, ``bytes``, ``cmp``, ``compress/*``, ``container/*``, ``context``, ``crypto``, ``crypto/*``, ``database/*``, ``debug/*``, ``embed``, ``encoding``, ``encoding/*``, ``errors``, ``expvar``, ``flag``, ``fmt``, ``go/*``, ``hash``, ``hash/*``, ``html``, ``html/*``, ``image``, ``image/*``, ``index/*``, ``io``, ``io/*``, ``log``, ``log/*``, ``maps``, ``math``, ``math/*``, ``mime``, ``mime/*``, ``net``, ``net/*``, ``os``, ``os/*``, ``path``, ``path/*``, ``plugin``, ``reflect``, ``reflect/*``, ``regexp``, ``regexp/*``, ``slices``, ``sort``, ``strconv``, ``strings``, ``sync``, ``sync/*``, ``syscall``, ``syscall/*``, ``testing``, ``testing/*``, ``text/*``, ``time``, ``time/*``, ``unicode``, ``unicode/*``, ``unsafe``",33,587,104 `XPath `_,``github.com/antchfx/xpath*``,,,4 `appleboy/gin-jwt `_,``github.com/appleboy/gin-jwt*``,,,1 - `beego `_,"``github.com/astaxie/beego*``, ``github.com/beego/beego*``",63,63,21 + `beego `_,"``github.com/astaxie/beego*``, ``github.com/beego/beego*``",63,63,213 `chi `_,``github.com/go-chi/chi*``,3,, `cristalhq/jwt `_,``github.com/cristalhq/jwt*``,,,1 `fasthttp `_,``github.com/valyala/fasthttp*``,50,5,35 @@ -39,7 +39,7 @@ Go framework & library support `go-sh `_,``github.com/codeskyblue/go-sh*``,,,4 `golang.org/x/crypto/ssh `_,``golang.org/x/crypto/ssh*``,,,4 `golang.org/x/net `_,``golang.org/x/net*``,2,21, - `goproxy `_,``github.com/elazarl/goproxy*``,2,2, + `goproxy `_,``github.com/elazarl/goproxy*``,2,2,2 `gorilla/mux `_,``github.com/gorilla/mux*``,1,, `gorilla/websocket `_,``github.com/gorilla/websocket*``,3,, `goxpath `_,``github.com/ChrisTrenkamp/goxpath*``,,,3 @@ -59,7 +59,7 @@ Go framework & library support `xmlquery `_,``github.com/antchfx/xmlquery*``,,,8 `xpathparser `_,``github.com/santhosh-tekuri/xpathparser*``,,,2 `yaml `_,``gopkg.in/yaml*``,,9, - `zap `_,``go.uber.org/zap*``,,11, - Others,"``github.com/caarlos0/env``, ``github.com/gobuffalo/envy``, ``github.com/hashicorp/go-envparse``, ``github.com/joho/godotenv``, ``github.com/kelseyhightower/envconfig``",23,2, - Totals,,307,911,268 + `zap `_,``go.uber.org/zap*``,,11,33 + Others,"``github.com/Masterminds/squirrel``, ``github.com/caarlos0/env``, ``github.com/go-gorm/gorm``, ``github.com/go-xorm/xorm``, ``github.com/gobuffalo/envy``, ``github.com/gogf/gf/database/gdb``, ``github.com/hashicorp/go-envparse``, ``github.com/jinzhu/gorm``, ``github.com/jmoiron/sqlx``, ``github.com/joho/godotenv``, ``github.com/kelseyhightower/envconfig``, ``github.com/lann/squirrel``, ``github.com/raindog308/gorqlite``, ``github.com/rqlite/gorqlite``, ``github.com/uptrace/bun``, ``go.mongodb.org/mongo-driver/mongo``, ``gopkg.in/Masterminds/squirrel``, ``gorm.io/gorm``, ``xorm.io/xorm``",23,2,391 + Totals,,307,911,1532 From 65be8a8aedb71d9a1081bc5ef0ac2362d6fb888b Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Thu, 21 Nov 2024 13:15:49 +0100 Subject: [PATCH 25/47] CI: Set `--ram` in `compile-queries.yml` --- .github/workflows/compile-queries.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compile-queries.yml b/.github/workflows/compile-queries.yml index 38452f97d36..dfd99f6b806 100644 --- a/.github/workflows/compile-queries.yml +++ b/.github/workflows/compile-queries.yml @@ -33,9 +33,9 @@ jobs: # run with --check-only if running in a PR (github.sha != main) if : ${{ github.event_name == 'pull_request' }} shell: bash - run: codeql query compile -q -j0 */ql/{src,examples} --keep-going --warnings=error --check-only --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" --compilation-cache-size=500 + run: codeql query compile -q -j0 */ql/{src,examples} --keep-going --warnings=error --check-only --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" --compilation-cache-size=500 --ram=56000 - name: compile queries - full # do full compile if running on main - this populates the cache if : ${{ github.event_name != 'pull_request' }} shell: bash - run: codeql query compile -q -j0 */ql/{src,examples} --keep-going --warnings=error --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" --compilation-cache-size=500 + run: codeql query compile -q -j0 */ql/{src,examples} --keep-going --warnings=error --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" --compilation-cache-size=500 --ram=56000 From 7ee0a7b3982e47a7aefdeeb64fd7c24caa43a9d4 Mon Sep 17 00:00:00 2001 From: Napalys Klicius Date: Thu, 21 Nov 2024 14:02:42 +0100 Subject: [PATCH 26/47] Update javascript/ql/lib/semmle/javascript/Collections.qll Co-authored-by: Erik Krogh Kristensen --- javascript/ql/lib/semmle/javascript/Collections.qll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/ql/lib/semmle/javascript/Collections.qll b/javascript/ql/lib/semmle/javascript/Collections.qll index df7ad317014..028c3abe4b3 100644 --- a/javascript/ql/lib/semmle/javascript/Collections.qll +++ b/javascript/ql/lib/semmle/javascript/Collections.qll @@ -160,7 +160,7 @@ private module CollectionDataFlow { exists(DataFlow::MethodCallNode call | call = DataFlow::globalVarRef(["Map", "Object"]).getAMemberCall("groupBy") and pred = call.getArgument(0) and - (succ = call.getCallback(1).getParameter(0) or succ = call.getALocalUse()) + (succ = call.getCallback(1).getParameter(0) or succ = call) ) } } From 6f3e6edd0e50f256bd69ebc89d1086bf21be7ac1 Mon Sep 17 00:00:00 2001 From: Calum Grant Date: Mon, 18 Nov 2024 14:17:13 +0000 Subject: [PATCH 27/47] C++: Implement compilation_build_mode --- cpp/ql/lib/semmle/code/cpp/Compilation.qll | 3 +++ cpp/ql/lib/semmlecode.cpp.dbscheme | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/cpp/ql/lib/semmle/code/cpp/Compilation.qll b/cpp/ql/lib/semmle/code/cpp/Compilation.qll index 1a8d90f991c..407dc31e05f 100644 --- a/cpp/ql/lib/semmle/code/cpp/Compilation.qll +++ b/cpp/ql/lib/semmle/code/cpp/Compilation.qll @@ -112,4 +112,7 @@ class Compilation extends @compilation { * termination, but crashing due to something like a segfault is not. */ predicate normalTermination() { compilation_finished(this, _, _) } + + /** Holds if this compilation was compiled using the "none" build mode. */ + predicate buildModeNone() { compilation_build_mode(this, 0) } } diff --git a/cpp/ql/lib/semmlecode.cpp.dbscheme b/cpp/ql/lib/semmlecode.cpp.dbscheme index e51fad7a243..0c8b8927c0c 100644 --- a/cpp/ql/lib/semmlecode.cpp.dbscheme +++ b/cpp/ql/lib/semmlecode.cpp.dbscheme @@ -46,6 +46,20 @@ compilation_args( string arg : string ref ); +/** + * Optionally, record the build mode for each compilation. + * The build mode should be the same for all compilations. + * Build mode: + * 0 = none + * 1 = manual + * 2 = auto + */ +#keyset[id, mode] +compilation_build_mode( + int id : @compilation ref, + int mode : int ref +); + /** * The source files that are compiled by a compiler invocation. * If `id` is for the compiler invocation From ac4121dd6ceffe195f30bfbd5e6bf7fb278c22cb Mon Sep 17 00:00:00 2001 From: Calum Grant Date: Mon, 18 Nov 2024 17:20:48 +0000 Subject: [PATCH 28/47] C++: Describe compilation_build_mode using a case --- cpp/ql/lib/semmlecode.cpp.dbscheme | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cpp/ql/lib/semmlecode.cpp.dbscheme b/cpp/ql/lib/semmlecode.cpp.dbscheme index 0c8b8927c0c..54b0075a9d8 100644 --- a/cpp/ql/lib/semmlecode.cpp.dbscheme +++ b/cpp/ql/lib/semmlecode.cpp.dbscheme @@ -49,10 +49,6 @@ compilation_args( /** * Optionally, record the build mode for each compilation. * The build mode should be the same for all compilations. - * Build mode: - * 0 = none - * 1 = manual - * 2 = auto */ #keyset[id, mode] compilation_build_mode( @@ -60,6 +56,14 @@ compilation_build_mode( int mode : int ref ); +/* +case @compilation_build_mode.mode of + 0 = @build_mode_none +| 1 = @build_mode_manual +| 2 = @build_mode_auto +; +/* + /** * The source files that are compiled by a compiler invocation. * If `id` is for the compiler invocation From d3e8292db990f2839efe61eee3f9fe38f067abd5 Mon Sep 17 00:00:00 2001 From: Calum Grant Date: Tue, 19 Nov 2024 10:50:21 +0000 Subject: [PATCH 29/47] C++: Update dbscheme --- cpp/ql/lib/semmlecode.cpp.dbscheme | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cpp/ql/lib/semmlecode.cpp.dbscheme b/cpp/ql/lib/semmlecode.cpp.dbscheme index 54b0075a9d8..f0156f5f88a 100644 --- a/cpp/ql/lib/semmlecode.cpp.dbscheme +++ b/cpp/ql/lib/semmlecode.cpp.dbscheme @@ -48,11 +48,9 @@ compilation_args( /** * Optionally, record the build mode for each compilation. - * The build mode should be the same for all compilations. */ -#keyset[id, mode] compilation_build_mode( - int id : @compilation ref, + unique int id : @compilation ref, int mode : int ref ); @@ -62,7 +60,7 @@ case @compilation_build_mode.mode of | 1 = @build_mode_manual | 2 = @build_mode_auto ; -/* +*/ /** * The source files that are compiled by a compiler invocation. From 10f692b57cfb0cd7be1be70945db676390f5be39 Mon Sep 17 00:00:00 2001 From: Calum Grant Date: Tue, 19 Nov 2024 12:18:38 +0000 Subject: [PATCH 30/47] C++: DB upgrade scripts --- .../old.dbscheme | 2339 +++++++++++++++++ .../semmlecode.cpp.dbscheme | 2323 ++++++++++++++++ .../upgrade.properties | 2 + .../old.dbscheme | 2323 ++++++++++++++++ .../semmlecode.cpp.dbscheme | 2339 +++++++++++++++++ .../upgrade.properties | 2 + 6 files changed, 9328 insertions(+) create mode 100644 cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/old.dbscheme create mode 100644 cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/semmlecode.cpp.dbscheme create mode 100644 cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties create mode 100644 cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/old.dbscheme create mode 100644 cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/semmlecode.cpp.dbscheme create mode 100644 cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/upgrade.properties diff --git a/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/old.dbscheme b/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/old.dbscheme new file mode 100644 index 00000000000..f0156f5f88a --- /dev/null +++ b/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/old.dbscheme @@ -0,0 +1,2339 @@ + +/** + * An invocation of the compiler. Note that more than one file may be + * compiled per invocation. For example, this command compiles three + * source files: + * + * gcc -c f1.c f2.c f3.c + * + * The `id` simply identifies the invocation, while `cwd` is the working + * directory from which the compiler was invoked. + */ +compilations( + /** + * An invocation of the compiler. Note that more than one file may + * be compiled per invocation. For example, this command compiles + * three source files: + * + * gcc -c f1.c f2.c f3.c + */ + unique int id : @compilation, + string cwd : string ref +); + +/** + * The arguments that were passed to the extractor for a compiler + * invocation. If `id` is for the compiler invocation + * + * gcc -c f1.c f2.c f3.c + * + * then typically there will be rows for + * + * num | arg + * --- | --- + * 0 | *path to extractor* + * 1 | `--mimic` + * 2 | `/usr/bin/gcc` + * 3 | `-c` + * 4 | f1.c + * 5 | f2.c + * 6 | f3.c + */ +#keyset[id, num] +compilation_args( + int id : @compilation ref, + int num : int ref, + string arg : string ref +); + +/** + * Optionally, record the build mode for each compilation. + */ +compilation_build_mode( + unique int id : @compilation ref, + int mode : int ref +); + +/* +case @compilation_build_mode.mode of + 0 = @build_mode_none +| 1 = @build_mode_manual +| 2 = @build_mode_auto +; +*/ + +/** + * The source files that are compiled by a compiler invocation. + * If `id` is for the compiler invocation + * + * gcc -c f1.c f2.c f3.c + * + * then there will be rows for + * + * num | arg + * --- | --- + * 0 | f1.c + * 1 | f2.c + * 2 | f3.c + * + * Note that even if those files `#include` headers, those headers + * do not appear as rows. + */ +#keyset[id, num] +compilation_compiling_files( + int id : @compilation ref, + int num : int ref, + int file : @file ref +); + +/** + * The time taken by the extractor for a compiler invocation. + * + * For each file `num`, there will be rows for + * + * kind | seconds + * ---- | --- + * 1 | CPU seconds used by the extractor frontend + * 2 | Elapsed seconds during the extractor frontend + * 3 | CPU seconds used by the extractor backend + * 4 | Elapsed seconds during the extractor backend + */ +#keyset[id, num, kind] +compilation_time( + int id : @compilation ref, + int num : int ref, + /* kind: + 1 = frontend_cpu_seconds + 2 = frontend_elapsed_seconds + 3 = extractor_cpu_seconds + 4 = extractor_elapsed_seconds + */ + int kind : int ref, + float seconds : float ref +); + +/** + * An error or warning generated by the extractor. + * The diagnostic message `diagnostic` was generated during compiler + * invocation `compilation`, and is the `file_number_diagnostic_number`th + * message generated while extracting the `file_number`th file of that + * invocation. + */ +#keyset[compilation, file_number, file_number_diagnostic_number] +diagnostic_for( + int diagnostic : @diagnostic ref, + int compilation : @compilation ref, + int file_number : int ref, + int file_number_diagnostic_number : int ref +); + +/** + * If extraction was successful, then `cpu_seconds` and + * `elapsed_seconds` are the CPU time and elapsed time (respectively) + * that extraction took for compiler invocation `id`. + */ +compilation_finished( + unique int id : @compilation ref, + float cpu_seconds : float ref, + float elapsed_seconds : float ref +); + + +/** + * External data, loaded from CSV files during snapshot creation. See + * [Tutorial: Incorporating external data](https://help.semmle.com/wiki/display/SD/Tutorial%3A+Incorporating+external+data) + * for more information. + */ +externalData( + int id : @externalDataElement, + string path : string ref, + int column: int ref, + string value : string ref +); + +/** + * The source location of the snapshot. + */ +sourceLocationPrefix(string prefix : string ref); + +/** + * Information about packages that provide code used during compilation. + * The `id` is just a unique identifier. + * The `namespace` is typically the name of the package manager that + * provided the package (e.g. "dpkg" or "yum"). + * The `package_name` is the name of the package, and `version` is its + * version (as a string). + */ +external_packages( + unique int id: @external_package, + string namespace : string ref, + string package_name : string ref, + string version : string ref +); + +/** + * Holds if File `fileid` was provided by package `package`. + */ +header_to_external_package( + int fileid : @file ref, + int package : @external_package ref +); + +/* + * Version history + */ + +svnentries( + unique int id : @svnentry, + string revision : string ref, + string author : string ref, + date revisionDate : date ref, + int changeSize : int ref +) + +svnaffectedfiles( + int id : @svnentry ref, + int file : @file ref, + string action : string ref +) + +svnentrymsg( + unique int id : @svnentry ref, + string message : string ref +) + +svnchurn( + int commit : @svnentry ref, + int file : @file ref, + int addedLines : int ref, + int deletedLines : int ref +) + +/* + * C++ dbscheme + */ + +extractor_version( + string codeql_version: string ref, + string frontend_version: string ref +) + +@location = @location_stmt | @location_expr | @location_default ; + +/** + * The location of an element that is not an expression or a statement. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_default( + /** The location of an element that is not an expression or a statement. */ + unique int id: @location_default, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** + * The location of a statement. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_stmt( + /** The location of a statement. */ + unique int id: @location_stmt, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** + * The location of an expression. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_expr( + /** The location of an expression. */ + unique int id: @location_expr, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** An element for which line-count information is available. */ +@sourceline = @file | @function | @variable | @enumconstant | @xmllocatable; + +numlines( + int element_id: @sourceline ref, + int num_lines: int ref, + int num_code: int ref, + int num_comment: int ref +); + +diagnostics( + unique int id: @diagnostic, + int severity: int ref, + string error_tag: string ref, + string error_message: string ref, + string full_error_message: string ref, + int location: @location_default ref +); + +files( + unique int id: @file, + string name: string ref +); + +folders( + unique int id: @folder, + string name: string ref +); + +@container = @folder | @file + +containerparent( + int parent: @container ref, + unique int child: @container ref +); + +fileannotations( + int id: @file ref, + int kind: int ref, + string name: string ref, + string value: string ref +); + +inmacroexpansion( + int id: @element ref, + int inv: @macroinvocation ref +); + +affectedbymacroexpansion( + int id: @element ref, + int inv: @macroinvocation ref +); + +case @macroinvocation.kind of + 1 = @macro_expansion +| 2 = @other_macro_reference +; + +macroinvocations( + unique int id: @macroinvocation, + int macro_id: @ppd_define ref, + int location: @location_default ref, + int kind: int ref +); + +macroparent( + unique int id: @macroinvocation ref, + int parent_id: @macroinvocation ref +); + +// a macroinvocation may be part of another location +// the way to find a constant expression that uses a macro +// is thus to find a constant expression that has a location +// to which a macro invocation is bound +macrolocationbind( + int id: @macroinvocation ref, + int location: @location ref +); + +#keyset[invocation, argument_index] +macro_argument_unexpanded( + int invocation: @macroinvocation ref, + int argument_index: int ref, + string text: string ref +); + +#keyset[invocation, argument_index] +macro_argument_expanded( + int invocation: @macroinvocation ref, + int argument_index: int ref, + string text: string ref +); + +/* +case @function.kind of + 1 = @normal_function +| 2 = @constructor +| 3 = @destructor +| 4 = @conversion_function +| 5 = @operator +| 6 = @builtin_function // GCC built-in functions, e.g. __builtin___memcpy_chk +| 7 = @user_defined_literal +| 8 = @deduction_guide +; +*/ + +functions( + unique int id: @function, + string name: string ref, + int kind: int ref +); + +function_entry_point( + int id: @function ref, + unique int entry_point: @stmt ref +); + +function_return_type( + int id: @function ref, + int return_type: @type ref +); + +/** + * If `function` is a coroutine, then this gives the `std::experimental::resumable_traits` + * instance associated with it, and the variables representing the `handle` and `promise` + * for it. + */ +coroutine( + unique int function: @function ref, + int traits: @type ref +); + +/* +case @coroutine_placeholder_variable.kind of + 1 = @handle +| 2 = @promise +| 3 = @init_await_resume +; +*/ + +coroutine_placeholder_variable( + unique int placeholder_variable: @variable ref, + int kind: int ref, + int function: @function ref +) + +/** The `new` function used for allocating the coroutine state, if any. */ +coroutine_new( + unique int function: @function ref, + int new: @function ref +); + +/** The `delete` function used for deallocating the coroutine state, if any. */ +coroutine_delete( + unique int function: @function ref, + int delete: @function ref +); + +purefunctions(unique int id: @function ref); + +function_deleted(unique int id: @function ref); + +function_defaulted(unique int id: @function ref); + +function_prototyped(unique int id: @function ref) + +deduction_guide_for_class( + int id: @function ref, + int class_template: @usertype ref +) + +member_function_this_type( + unique int id: @function ref, + int this_type: @type ref +); + +#keyset[id, type_id] +fun_decls( + int id: @fun_decl, + int function: @function ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); +fun_def(unique int id: @fun_decl ref); +fun_specialized(unique int id: @fun_decl ref); +fun_implicit(unique int id: @fun_decl ref); +fun_decl_specifiers( + int id: @fun_decl ref, + string name: string ref +) +#keyset[fun_decl, index] +fun_decl_throws( + int fun_decl: @fun_decl ref, + int index: int ref, + int type_id: @type ref +); +/* an empty throw specification is different from none */ +fun_decl_empty_throws(unique int fun_decl: @fun_decl ref); +fun_decl_noexcept( + int fun_decl: @fun_decl ref, + int constant: @expr ref +); +fun_decl_empty_noexcept(int fun_decl: @fun_decl ref); +fun_decl_typedef_type( + unique int fun_decl: @fun_decl ref, + int typedeftype_id: @usertype ref +); + +param_decl_bind( + unique int id: @var_decl ref, + int index: int ref, + int fun_decl: @fun_decl ref +); + +#keyset[id, type_id] +var_decls( + int id: @var_decl, + int variable: @variable ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); +var_def(unique int id: @var_decl ref); +var_decl_specifiers( + int id: @var_decl ref, + string name: string ref +) +is_structured_binding(unique int id: @variable ref); + +type_decls( + unique int id: @type_decl, + int type_id: @type ref, + int location: @location_default ref +); +type_def(unique int id: @type_decl ref); +type_decl_top( + unique int type_decl: @type_decl ref +); + +namespace_decls( + unique int id: @namespace_decl, + int namespace_id: @namespace ref, + int location: @location_default ref, + int bodylocation: @location_default ref +); + +case @using.kind of + 1 = @using_declaration +| 2 = @using_directive +| 3 = @using_enum_declaration +; + +usings( + unique int id: @using, + int element_id: @element ref, + int location: @location_default ref, + int kind: int ref +); + +/** The element which contains the `using` declaration. */ +using_container( + int parent: @element ref, + int child: @using ref +); + +static_asserts( + unique int id: @static_assert, + int condition : @expr ref, + string message : string ref, + int location: @location_default ref, + int enclosing : @element ref +); + +// each function has an ordered list of parameters +#keyset[id, type_id] +#keyset[function, index, type_id] +params( + int id: @parameter, + int function: @parameterized_element ref, + int index: int ref, + int type_id: @type ref +); + +overrides( + int new: @function ref, + int old: @function ref +); + +#keyset[id, type_id] +membervariables( + int id: @membervariable, + int type_id: @type ref, + string name: string ref +); + +#keyset[id, type_id] +globalvariables( + int id: @globalvariable, + int type_id: @type ref, + string name: string ref +); + +#keyset[id, type_id] +localvariables( + int id: @localvariable, + int type_id: @type ref, + string name: string ref +); + +autoderivation( + unique int var: @variable ref, + int derivation_type: @type ref +); + +orphaned_variables( + int var: @localvariable ref, + int function: @function ref +) + +enumconstants( + unique int id: @enumconstant, + int parent: @usertype ref, + int index: int ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); + +@variable = @localscopevariable | @globalvariable | @membervariable; + +@localscopevariable = @localvariable | @parameter; + +/** + * Built-in types are the fundamental types, e.g., integral, floating, and void. + */ +case @builtintype.kind of + 1 = @errortype +| 2 = @unknowntype +| 3 = @void +| 4 = @boolean +| 5 = @char +| 6 = @unsigned_char +| 7 = @signed_char +| 8 = @short +| 9 = @unsigned_short +| 10 = @signed_short +| 11 = @int +| 12 = @unsigned_int +| 13 = @signed_int +| 14 = @long +| 15 = @unsigned_long +| 16 = @signed_long +| 17 = @long_long +| 18 = @unsigned_long_long +| 19 = @signed_long_long +// ... 20 Microsoft-specific __int8 +// ... 21 Microsoft-specific __int16 +// ... 22 Microsoft-specific __int32 +// ... 23 Microsoft-specific __int64 +| 24 = @float +| 25 = @double +| 26 = @long_double +| 27 = @complex_float // C99-specific _Complex float +| 28 = @complex_double // C99-specific _Complex double +| 29 = @complex_long_double // C99-specific _Complex long double +| 30 = @imaginary_float // C99-specific _Imaginary float +| 31 = @imaginary_double // C99-specific _Imaginary double +| 32 = @imaginary_long_double // C99-specific _Imaginary long double +| 33 = @wchar_t // Microsoft-specific +| 34 = @decltype_nullptr // C++11 +| 35 = @int128 // __int128 +| 36 = @unsigned_int128 // unsigned __int128 +| 37 = @signed_int128 // signed __int128 +| 38 = @float128 // __float128 +| 39 = @complex_float128 // _Complex __float128 +| 40 = @decimal32 // _Decimal32 +| 41 = @decimal64 // _Decimal64 +| 42 = @decimal128 // _Decimal128 +| 43 = @char16_t +| 44 = @char32_t +| 45 = @std_float32 // _Float32 +| 46 = @float32x // _Float32x +| 47 = @std_float64 // _Float64 +| 48 = @float64x // _Float64x +| 49 = @std_float128 // _Float128 +// ... 50 _Float128x +| 51 = @char8_t +| 52 = @float16 // _Float16 +| 53 = @complex_float16 // _Complex _Float16 +| 54 = @fp16 // __fp16 +| 55 = @std_bfloat16 // __bf16 +| 56 = @std_float16 // std::float16_t +| 57 = @complex_std_float32 // _Complex _Float32 +| 58 = @complex_float32x // _Complex _Float32x +| 59 = @complex_std_float64 // _Complex _Float64 +| 60 = @complex_float64x // _Complex _Float64x +| 61 = @complex_std_float128 // _Complex _Float128 +; + +builtintypes( + unique int id: @builtintype, + string name: string ref, + int kind: int ref, + int size: int ref, + int sign: int ref, + int alignment: int ref +); + +/** + * Derived types are types that are directly derived from existing types and + * point to, refer to, transform type data to return a new type. + */ +case @derivedtype.kind of + 1 = @pointer +| 2 = @reference +| 3 = @type_with_specifiers +| 4 = @array +| 5 = @gnu_vector +| 6 = @routineptr +| 7 = @routinereference +| 8 = @rvalue_reference // C++11 +// ... 9 type_conforming_to_protocols deprecated +| 10 = @block +; + +derivedtypes( + unique int id: @derivedtype, + string name: string ref, + int kind: int ref, + int type_id: @type ref +); + +pointerishsize(unique int id: @derivedtype ref, + int size: int ref, + int alignment: int ref); + +arraysizes( + unique int id: @derivedtype ref, + int num_elements: int ref, + int bytesize: int ref, + int alignment: int ref +); + +typedefbase( + unique int id: @usertype ref, + int type_id: @type ref +); + +/** + * An instance of the C++11 `decltype` operator. For example: + * ``` + * int a; + * decltype(1+a) b; + * ``` + * Here `expr` is `1+a`. + * + * Sometimes an additional pair of parentheses around the expression + * would change the semantics of this decltype, e.g. + * ``` + * struct A { double x; }; + * const A* a = new A(); + * decltype( a->x ); // type is double + * decltype((a->x)); // type is const double& + * ``` + * (Please consult the C++11 standard for more details). + * `parentheses_would_change_meaning` is `true` iff that is the case. + */ +#keyset[id, expr] +decltypes( + int id: @decltype, + int expr: @expr ref, + int base_type: @type ref, + boolean parentheses_would_change_meaning: boolean ref +); + +/* +case @usertype.kind of + 1 = @struct +| 2 = @class +| 3 = @union +| 4 = @enum +| 5 = @typedef // classic C: typedef typedef type name +| 6 = @template +| 7 = @template_parameter +| 8 = @template_template_parameter +| 9 = @proxy_class // a proxy class associated with a template parameter +// ... 10 objc_class deprecated +// ... 11 objc_protocol deprecated +// ... 12 objc_category deprecated +| 13 = @scoped_enum +| 14 = @using_alias // a using name = type style typedef +; +*/ + +usertypes( + unique int id: @usertype, + string name: string ref, + int kind: int ref +); + +usertypesize( + unique int id: @usertype ref, + int size: int ref, + int alignment: int ref +); + +usertype_final(unique int id: @usertype ref); + +usertype_uuid( + unique int id: @usertype ref, + string uuid: string ref +); + +mangled_name( + unique int id: @declaration ref, + int mangled_name : @mangledname, + boolean is_complete: boolean ref +); + +is_pod_class(unique int id: @usertype ref); +is_standard_layout_class(unique int id: @usertype ref); + +is_complete(unique int id: @usertype ref); + +is_class_template(unique int id: @usertype ref); +class_instantiation( + int to: @usertype ref, + int from: @usertype ref +); +class_template_argument( + int type_id: @usertype ref, + int index: int ref, + int arg_type: @type ref +); +class_template_argument_value( + int type_id: @usertype ref, + int index: int ref, + int arg_value: @expr ref +); + +is_proxy_class_for( + unique int id: @usertype ref, + unique int templ_param_id: @usertype ref +); + +type_mentions( + unique int id: @type_mention, + int type_id: @type ref, + int location: @location ref, + // a_symbol_reference_kind from the frontend. + int kind: int ref +); + +is_function_template(unique int id: @function ref); +function_instantiation( + unique int to: @function ref, + int from: @function ref +); +function_template_argument( + int function_id: @function ref, + int index: int ref, + int arg_type: @type ref +); +function_template_argument_value( + int function_id: @function ref, + int index: int ref, + int arg_value: @expr ref +); + +is_variable_template(unique int id: @variable ref); +variable_instantiation( + unique int to: @variable ref, + int from: @variable ref +); +variable_template_argument( + int variable_id: @variable ref, + int index: int ref, + int arg_type: @type ref +); +variable_template_argument_value( + int variable_id: @variable ref, + int index: int ref, + int arg_value: @expr ref +); + +routinetypes( + unique int id: @routinetype, + int return_type: @type ref +); + +routinetypeargs( + int routine: @routinetype ref, + int index: int ref, + int type_id: @type ref +); + +ptrtomembers( + unique int id: @ptrtomember, + int type_id: @type ref, + int class_id: @type ref +); + +/* + specifiers for types, functions, and variables + + "public", + "protected", + "private", + + "const", + "volatile", + "static", + + "pure", + "virtual", + "sealed", // Microsoft + "__interface", // Microsoft + "inline", + "explicit", + + "near", // near far extension + "far", // near far extension + "__ptr32", // Microsoft + "__ptr64", // Microsoft + "__sptr", // Microsoft + "__uptr", // Microsoft + "dllimport", // Microsoft + "dllexport", // Microsoft + "thread", // Microsoft + "naked", // Microsoft + "microsoft_inline", // Microsoft + "forceinline", // Microsoft + "selectany", // Microsoft + "nothrow", // Microsoft + "novtable", // Microsoft + "noreturn", // Microsoft + "noinline", // Microsoft + "noalias", // Microsoft + "restrict", // Microsoft +*/ + +specifiers( + unique int id: @specifier, + unique string str: string ref +); + +typespecifiers( + int type_id: @type ref, + int spec_id: @specifier ref +); + +funspecifiers( + int func_id: @function ref, + int spec_id: @specifier ref +); + +varspecifiers( + int var_id: @accessible ref, + int spec_id: @specifier ref +); + +explicit_specifier_exprs( + unique int func_id: @function ref, + int constant: @expr ref +) + +attributes( + unique int id: @attribute, + int kind: int ref, + string name: string ref, + string name_space: string ref, + int location: @location_default ref +); + +case @attribute.kind of + 0 = @gnuattribute +| 1 = @stdattribute +| 2 = @declspec +| 3 = @msattribute +| 4 = @alignas +// ... 5 @objc_propertyattribute deprecated +; + +attribute_args( + unique int id: @attribute_arg, + int kind: int ref, + int attribute: @attribute ref, + int index: int ref, + int location: @location_default ref +); + +case @attribute_arg.kind of + 0 = @attribute_arg_empty +| 1 = @attribute_arg_token +| 2 = @attribute_arg_constant +| 3 = @attribute_arg_type +| 4 = @attribute_arg_constant_expr +| 5 = @attribute_arg_expr +; + +attribute_arg_value( + unique int arg: @attribute_arg ref, + string value: string ref +); +attribute_arg_type( + unique int arg: @attribute_arg ref, + int type_id: @type ref +); +attribute_arg_constant( + unique int arg: @attribute_arg ref, + int constant: @expr ref +) +attribute_arg_expr( + unique int arg: @attribute_arg ref, + int expr: @expr ref +) +attribute_arg_name( + unique int arg: @attribute_arg ref, + string name: string ref +); + +typeattributes( + int type_id: @type ref, + int spec_id: @attribute ref +); + +funcattributes( + int func_id: @function ref, + int spec_id: @attribute ref +); + +varattributes( + int var_id: @accessible ref, + int spec_id: @attribute ref +); + +stmtattributes( + int stmt_id: @stmt ref, + int spec_id: @attribute ref +); + +@type = @builtintype + | @derivedtype + | @usertype + /* TODO | @fixedpointtype */ + | @routinetype + | @ptrtomember + | @decltype; + +unspecifiedtype( + unique int type_id: @type ref, + int unspecified_type_id: @type ref +); + +member( + int parent: @type ref, + int index: int ref, + int child: @member ref +); + +@enclosingfunction_child = @usertype | @variable | @namespace + +enclosingfunction( + unique int child: @enclosingfunction_child ref, + int parent: @function ref +); + +derivations( + unique int derivation: @derivation, + int sub: @type ref, + int index: int ref, + int super: @type ref, + int location: @location_default ref +); + +derspecifiers( + int der_id: @derivation ref, + int spec_id: @specifier ref +); + +/** + * Contains the byte offset of the base class subobject within the derived + * class. Only holds for non-virtual base classes, but see table + * `virtual_base_offsets` for offsets of virtual base class subobjects. + */ +direct_base_offsets( + unique int der_id: @derivation ref, + int offset: int ref +); + +/** + * Contains the byte offset of the virtual base class subobject for class + * `super` within a most-derived object of class `sub`. `super` can be either a + * direct or indirect base class. + */ +#keyset[sub, super] +virtual_base_offsets( + int sub: @usertype ref, + int super: @usertype ref, + int offset: int ref +); + +frienddecls( + unique int id: @frienddecl, + int type_id: @type ref, + int decl_id: @declaration ref, + int location: @location_default ref +); + +@declaredtype = @usertype ; + +@declaration = @function + | @declaredtype + | @variable + | @enumconstant + | @frienddecl; + +@member = @membervariable + | @function + | @declaredtype + | @enumconstant; + +@locatable = @diagnostic + | @declaration + | @ppd_include + | @ppd_define + | @macroinvocation + /*| @funcall*/ + | @xmllocatable + | @attribute + | @attribute_arg; + +@namedscope = @namespace | @usertype; + +@element = @locatable + | @file + | @folder + | @specifier + | @type + | @expr + | @namespace + | @initialiser + | @stmt + | @derivation + | @comment + | @preprocdirect + | @fun_decl + | @var_decl + | @type_decl + | @namespace_decl + | @using + | @namequalifier + | @specialnamequalifyingelement + | @static_assert + | @type_mention + | @lambdacapture; + +@exprparent = @element; + +comments( + unique int id: @comment, + string contents: string ref, + int location: @location_default ref +); + +commentbinding( + int id: @comment ref, + int element: @element ref +); + +exprconv( + int converted: @expr ref, + unique int conversion: @expr ref +); + +compgenerated(unique int id: @element ref); + +/** + * `destructor_call` destructs the `i`'th entity that should be + * destructed following `element`. Note that entities should be + * destructed in reverse construction order, so for a given `element` + * these should be called from highest to lowest `i`. + */ +#keyset[element, destructor_call] +#keyset[element, i] +synthetic_destructor_call( + int element: @element ref, + int i: int ref, + int destructor_call: @routineexpr ref +); + +namespaces( + unique int id: @namespace, + string name: string ref +); + +namespace_inline( + unique int id: @namespace ref +); + +namespacembrs( + int parentid: @namespace ref, + unique int memberid: @namespacembr ref +); + +@namespacembr = @declaration | @namespace; + +exprparents( + int expr_id: @expr ref, + int child_index: int ref, + int parent_id: @exprparent ref +); + +expr_isload(unique int expr_id: @expr ref); + +@cast = @c_style_cast + | @const_cast + | @dynamic_cast + | @reinterpret_cast + | @static_cast + ; + +/* +case @conversion.kind of + 0 = @simple_conversion // a numeric conversion, qualification conversion, or a reinterpret_cast +| 1 = @bool_conversion // conversion to 'bool' +| 2 = @base_class_conversion // a derived-to-base conversion +| 3 = @derived_class_conversion // a base-to-derived conversion +| 4 = @pm_base_class_conversion // a derived-to-base conversion of a pointer to member +| 5 = @pm_derived_class_conversion // a base-to-derived conversion of a pointer to member +| 6 = @glvalue_adjust // an adjustment of the type of a glvalue +| 7 = @prvalue_adjust // an adjustment of the type of a prvalue +; +*/ +/** + * Describes the semantics represented by a cast expression. This is largely + * independent of the source syntax of the cast, so it is separate from the + * regular expression kind. + */ +conversionkinds( + unique int expr_id: @cast ref, + int kind: int ref +); + +@conversion = @cast + | @array_to_pointer + | @parexpr + | @reference_to + | @ref_indirect + | @temp_init + | @c11_generic + ; + +/* +case @funbindexpr.kind of + 0 = @normal_call // a normal call +| 1 = @virtual_call // a virtual call +| 2 = @adl_call // a call whose target is only found by ADL +; +*/ +iscall( + unique int caller: @funbindexpr ref, + int kind: int ref +); + +numtemplatearguments( + unique int expr_id: @expr ref, + int num: int ref +); + +specialnamequalifyingelements( + unique int id: @specialnamequalifyingelement, + unique string name: string ref +); + +@namequalifiableelement = @expr | @namequalifier; +@namequalifyingelement = @namespace + | @specialnamequalifyingelement + | @usertype; + +namequalifiers( + unique int id: @namequalifier, + unique int qualifiableelement: @namequalifiableelement ref, + int qualifyingelement: @namequalifyingelement ref, + int location: @location_default ref +); + +varbind( + int expr: @varbindexpr ref, + int var: @accessible ref +); + +funbind( + int expr: @funbindexpr ref, + int fun: @function ref +); + +@any_new_expr = @new_expr + | @new_array_expr; + +@new_or_delete_expr = @any_new_expr + | @delete_expr + | @delete_array_expr; + +@prefix_crement_expr = @preincrexpr | @predecrexpr; + +@postfix_crement_expr = @postincrexpr | @postdecrexpr; + +@increment_expr = @preincrexpr | @postincrexpr; + +@decrement_expr = @predecrexpr | @postdecrexpr; + +@crement_expr = @increment_expr | @decrement_expr; + +@un_arith_op_expr = @arithnegexpr + | @unaryplusexpr + | @conjugation + | @realpartexpr + | @imagpartexpr + | @crement_expr + ; + +@un_bitwise_op_expr = @complementexpr; + +@un_log_op_expr = @notexpr; + +@un_op_expr = @address_of + | @indirect + | @un_arith_op_expr + | @un_bitwise_op_expr + | @builtinaddressof + | @vec_fill + | @un_log_op_expr + | @co_await + | @co_yield + ; + +@bin_log_op_expr = @andlogicalexpr | @orlogicalexpr; + +@cmp_op_expr = @eq_op_expr | @rel_op_expr; + +@eq_op_expr = @eqexpr | @neexpr; + +@rel_op_expr = @gtexpr + | @ltexpr + | @geexpr + | @leexpr + | @spaceshipexpr + ; + +@bin_bitwise_op_expr = @lshiftexpr + | @rshiftexpr + | @andexpr + | @orexpr + | @xorexpr + ; + +@p_arith_op_expr = @paddexpr + | @psubexpr + | @pdiffexpr + ; + +@bin_arith_op_expr = @addexpr + | @subexpr + | @mulexpr + | @divexpr + | @remexpr + | @jmulexpr + | @jdivexpr + | @fjaddexpr + | @jfaddexpr + | @fjsubexpr + | @jfsubexpr + | @minexpr + | @maxexpr + | @p_arith_op_expr + ; + +@bin_op_expr = @bin_arith_op_expr + | @bin_bitwise_op_expr + | @cmp_op_expr + | @bin_log_op_expr + ; + +@op_expr = @un_op_expr + | @bin_op_expr + | @assign_expr + | @conditionalexpr + ; + +@assign_arith_expr = @assignaddexpr + | @assignsubexpr + | @assignmulexpr + | @assigndivexpr + | @assignremexpr + ; + +@assign_bitwise_expr = @assignandexpr + | @assignorexpr + | @assignxorexpr + | @assignlshiftexpr + | @assignrshiftexpr + ; + +@assign_pointer_expr = @assignpaddexpr + | @assignpsubexpr + ; + +@assign_op_expr = @assign_arith_expr + | @assign_bitwise_expr + | @assign_pointer_expr + ; + +@assign_expr = @assignexpr | @assign_op_expr | @blockassignexpr + +/* + Binary encoding of the allocator form. + + case @allocator.form of + 0 = plain + | 1 = alignment + ; +*/ + +/** + * The allocator function associated with a `new` or `new[]` expression. + * The `form` column specified whether the allocation call contains an alignment + * argument. + */ +expr_allocator( + unique int expr: @any_new_expr ref, + int func: @function ref, + int form: int ref +); + +/* + Binary encoding of the deallocator form. + + case @deallocator.form of + 0 = plain + | 1 = size + | 2 = alignment + | 4 = destroying_delete + ; +*/ + +/** + * The deallocator function associated with a `delete`, `delete[]`, `new`, or + * `new[]` expression. For a `new` or `new[]` expression, the deallocator is the + * one used to free memory if the initialization throws an exception. + * The `form` column specifies whether the deallocation call contains a size + * argument, and alignment argument, or both. + */ +expr_deallocator( + unique int expr: @new_or_delete_expr ref, + int func: @function ref, + int form: int ref +); + +/** + * Holds if the `@conditionalexpr` is of the two operand form + * `guard ? : false`. + */ +expr_cond_two_operand( + unique int cond: @conditionalexpr ref +); + +/** + * The guard of `@conditionalexpr` `guard ? true : false` + */ +expr_cond_guard( + unique int cond: @conditionalexpr ref, + int guard: @expr ref +); + +/** + * The expression used when the guard of `@conditionalexpr` + * `guard ? true : false` holds. For the two operand form + * `guard ?: false` consider using `expr_cond_guard` instead. + */ +expr_cond_true( + unique int cond: @conditionalexpr ref, + int true: @expr ref +); + +/** + * The expression used when the guard of `@conditionalexpr` + * `guard ? true : false` does not hold. + */ +expr_cond_false( + unique int cond: @conditionalexpr ref, + int false: @expr ref +); + +/** A string representation of the value. */ +values( + unique int id: @value, + string str: string ref +); + +/** The actual text in the source code for the value, if any. */ +valuetext( + unique int id: @value ref, + string text: string ref +); + +valuebind( + int val: @value ref, + unique int expr: @expr ref +); + +fieldoffsets( + unique int id: @variable ref, + int byteoffset: int ref, + int bitoffset: int ref +); + +bitfield( + unique int id: @variable ref, + int bits: int ref, + int declared_bits: int ref +); + +/* TODO +memberprefix( + int member: @expr ref, + int prefix: @expr ref +); +*/ + +/* + kind(1) = mbrcallexpr + kind(2) = mbrptrcallexpr + kind(3) = mbrptrmbrcallexpr + kind(4) = ptrmbrptrmbrcallexpr + kind(5) = mbrreadexpr // x.y + kind(6) = mbrptrreadexpr // p->y + kind(7) = mbrptrmbrreadexpr // x.*pm + kind(8) = mbrptrmbrptrreadexpr // x->*pm + kind(9) = staticmbrreadexpr // static x.y + kind(10) = staticmbrptrreadexpr // static p->y +*/ +/* TODO +memberaccess( + int member: @expr ref, + int kind: int ref +); +*/ + +initialisers( + unique int init: @initialiser, + int var: @accessible ref, + unique int expr: @expr ref, + int location: @location_expr ref +); + +braced_initialisers( + int init: @initialiser ref +); + +/** + * An ancestor for the expression, for cases in which we cannot + * otherwise find the expression's parent. + */ +expr_ancestor( + int exp: @expr ref, + int ancestor: @element ref +); + +exprs( + unique int id: @expr, + int kind: int ref, + int location: @location_expr ref +); + +expr_reuse( + int reuse: @expr ref, + int original: @expr ref, + int value_category: int ref +) + +/* + case @value.category of + 1 = prval + | 2 = xval + | 3 = lval + ; +*/ +expr_types( + int id: @expr ref, + int typeid: @type ref, + int value_category: int ref +); + +case @expr.kind of + 1 = @errorexpr +| 2 = @address_of // & AddressOfExpr +| 3 = @reference_to // ReferenceToExpr (implicit?) +| 4 = @indirect // * PointerDereferenceExpr +| 5 = @ref_indirect // ReferenceDereferenceExpr (implicit?) +// ... +| 8 = @array_to_pointer // (???) +| 9 = @vacuous_destructor_call // VacuousDestructorCall +// ... +| 11 = @assume // Microsoft +| 12 = @parexpr +| 13 = @arithnegexpr +| 14 = @unaryplusexpr +| 15 = @complementexpr +| 16 = @notexpr +| 17 = @conjugation // GNU ~ operator +| 18 = @realpartexpr // GNU __real +| 19 = @imagpartexpr // GNU __imag +| 20 = @postincrexpr +| 21 = @postdecrexpr +| 22 = @preincrexpr +| 23 = @predecrexpr +| 24 = @conditionalexpr +| 25 = @addexpr +| 26 = @subexpr +| 27 = @mulexpr +| 28 = @divexpr +| 29 = @remexpr +| 30 = @jmulexpr // C99 mul imaginary +| 31 = @jdivexpr // C99 div imaginary +| 32 = @fjaddexpr // C99 add real + imaginary +| 33 = @jfaddexpr // C99 add imaginary + real +| 34 = @fjsubexpr // C99 sub real - imaginary +| 35 = @jfsubexpr // C99 sub imaginary - real +| 36 = @paddexpr // pointer add (pointer + int or int + pointer) +| 37 = @psubexpr // pointer sub (pointer - integer) +| 38 = @pdiffexpr // difference between two pointers +| 39 = @lshiftexpr +| 40 = @rshiftexpr +| 41 = @andexpr +| 42 = @orexpr +| 43 = @xorexpr +| 44 = @eqexpr +| 45 = @neexpr +| 46 = @gtexpr +| 47 = @ltexpr +| 48 = @geexpr +| 49 = @leexpr +| 50 = @minexpr // GNU minimum +| 51 = @maxexpr // GNU maximum +| 52 = @assignexpr +| 53 = @assignaddexpr +| 54 = @assignsubexpr +| 55 = @assignmulexpr +| 56 = @assigndivexpr +| 57 = @assignremexpr +| 58 = @assignlshiftexpr +| 59 = @assignrshiftexpr +| 60 = @assignandexpr +| 61 = @assignorexpr +| 62 = @assignxorexpr +| 63 = @assignpaddexpr // assign pointer add +| 64 = @assignpsubexpr // assign pointer sub +| 65 = @andlogicalexpr +| 66 = @orlogicalexpr +| 67 = @commaexpr +| 68 = @subscriptexpr // access to member of an array, e.g., a[5] +// ... 69 @objc_subscriptexpr deprecated +// ... 70 @cmdaccess deprecated +// ... +| 73 = @virtfunptrexpr +| 74 = @callexpr +// ... 75 @msgexpr_normal deprecated +// ... 76 @msgexpr_super deprecated +// ... 77 @atselectorexpr deprecated +// ... 78 @atprotocolexpr deprecated +| 79 = @vastartexpr +| 80 = @vaargexpr +| 81 = @vaendexpr +| 82 = @vacopyexpr +// ... 83 @atencodeexpr deprecated +| 84 = @varaccess +| 85 = @thisaccess +// ... 86 @objc_box_expr deprecated +| 87 = @new_expr +| 88 = @delete_expr +| 89 = @throw_expr +| 90 = @condition_decl // a variable declared in a condition, e.g., if(int x = y > 2) +| 91 = @braced_init_list +| 92 = @type_id +| 93 = @runtime_sizeof +| 94 = @runtime_alignof +| 95 = @sizeof_pack +| 96 = @expr_stmt // GNU extension +| 97 = @routineexpr +| 98 = @type_operand // used to access a type in certain contexts (haven't found any examples yet....) +| 99 = @offsetofexpr // offsetof ::= type and field +| 100 = @hasassignexpr // __has_assign ::= type +| 101 = @hascopyexpr // __has_copy ::= type +| 102 = @hasnothrowassign // __has_nothrow_assign ::= type +| 103 = @hasnothrowconstr // __has_nothrow_constructor ::= type +| 104 = @hasnothrowcopy // __has_nothrow_copy ::= type +| 105 = @hastrivialassign // __has_trivial_assign ::= type +| 106 = @hastrivialconstr // __has_trivial_constructor ::= type +| 107 = @hastrivialcopy // __has_trivial_copy ::= type +| 108 = @hasuserdestr // __has_user_destructor ::= type +| 109 = @hasvirtualdestr // __has_virtual_destructor ::= type +| 110 = @isabstractexpr // __is_abstract ::= type +| 111 = @isbaseofexpr // __is_base_of ::= type type +| 112 = @isclassexpr // __is_class ::= type +| 113 = @isconvtoexpr // __is_convertible_to ::= type type +| 114 = @isemptyexpr // __is_empty ::= type +| 115 = @isenumexpr // __is_enum ::= type +| 116 = @ispodexpr // __is_pod ::= type +| 117 = @ispolyexpr // __is_polymorphic ::= type +| 118 = @isunionexpr // __is_union ::= type +| 119 = @typescompexpr // GNU __builtin_types_compatible ::= type type +| 120 = @intaddrexpr // frontend internal builtin, used to implement offsetof +// ... +| 122 = @hastrivialdestructor // __has_trivial_destructor ::= type +| 123 = @literal +| 124 = @uuidof +| 127 = @aggregateliteral +| 128 = @delete_array_expr +| 129 = @new_array_expr +// ... 130 @objc_array_literal deprecated +// ... 131 @objc_dictionary_literal deprecated +| 132 = @foldexpr +// ... +| 200 = @ctordirectinit +| 201 = @ctorvirtualinit +| 202 = @ctorfieldinit +| 203 = @ctordelegatinginit +| 204 = @dtordirectdestruct +| 205 = @dtorvirtualdestruct +| 206 = @dtorfielddestruct +// ... +| 210 = @static_cast +| 211 = @reinterpret_cast +| 212 = @const_cast +| 213 = @dynamic_cast +| 214 = @c_style_cast +| 215 = @lambdaexpr +| 216 = @param_ref +| 217 = @noopexpr +// ... +| 294 = @istriviallyconstructibleexpr +| 295 = @isdestructibleexpr +| 296 = @isnothrowdestructibleexpr +| 297 = @istriviallydestructibleexpr +| 298 = @istriviallyassignableexpr +| 299 = @isnothrowassignableexpr +| 300 = @istrivialexpr +| 301 = @isstandardlayoutexpr +| 302 = @istriviallycopyableexpr +| 303 = @isliteraltypeexpr +| 304 = @hastrivialmoveconstructorexpr +| 305 = @hastrivialmoveassignexpr +| 306 = @hasnothrowmoveassignexpr +| 307 = @isconstructibleexpr +| 308 = @isnothrowconstructibleexpr +| 309 = @hasfinalizerexpr +| 310 = @isdelegateexpr +| 311 = @isinterfaceclassexpr +| 312 = @isrefarrayexpr +| 313 = @isrefclassexpr +| 314 = @issealedexpr +| 315 = @issimplevalueclassexpr +| 316 = @isvalueclassexpr +| 317 = @isfinalexpr +| 319 = @noexceptexpr +| 320 = @builtinshufflevector +| 321 = @builtinchooseexpr +| 322 = @builtinaddressof +| 323 = @vec_fill +| 324 = @builtinconvertvector +| 325 = @builtincomplex +| 326 = @spaceshipexpr +| 327 = @co_await +| 328 = @co_yield +| 329 = @temp_init +| 330 = @isassignable +| 331 = @isaggregate +| 332 = @hasuniqueobjectrepresentations +| 333 = @builtinbitcast +| 334 = @builtinshuffle +| 335 = @blockassignexpr +| 336 = @issame +| 337 = @isfunction +| 338 = @islayoutcompatible +| 339 = @ispointerinterconvertiblebaseof +| 340 = @isarray +| 341 = @arrayrank +| 342 = @arrayextent +| 343 = @isarithmetic +| 344 = @iscompletetype +| 345 = @iscompound +| 346 = @isconst +| 347 = @isfloatingpoint +| 348 = @isfundamental +| 349 = @isintegral +| 350 = @islvaluereference +| 351 = @ismemberfunctionpointer +| 352 = @ismemberobjectpointer +| 353 = @ismemberpointer +| 354 = @isobject +| 355 = @ispointer +| 356 = @isreference +| 357 = @isrvaluereference +| 358 = @isscalar +| 359 = @issigned +| 360 = @isunsigned +| 361 = @isvoid +| 362 = @isvolatile +| 363 = @reuseexpr +| 364 = @istriviallycopyassignable +| 365 = @isassignablenopreconditioncheck +| 366 = @referencebindstotemporary +| 367 = @issameas +| 368 = @builtinhasattribute +| 369 = @ispointerinterconvertiblewithclass +| 370 = @builtinispointerinterconvertiblewithclass +| 371 = @iscorrespondingmember +| 372 = @builtiniscorrespondingmember +| 373 = @isboundedarray +| 374 = @isunboundedarray +| 375 = @isreferenceable +| 378 = @isnothrowconvertible +| 379 = @referenceconstructsfromtemporary +| 380 = @referenceconvertsfromtemporary +| 381 = @isconvertible +| 382 = @isvalidwinrttype +| 383 = @iswinclass +| 384 = @iswininterface +| 385 = @istriviallyequalitycomparable +| 386 = @isscopedenum +| 387 = @istriviallyrelocatable +| 388 = @datasizeof +| 389 = @c11_generic +| 390 = @requires_expr +| 391 = @nested_requirement +| 392 = @compound_requirement +| 393 = @concept_id +; + +@var_args_expr = @vastartexpr + | @vaendexpr + | @vaargexpr + | @vacopyexpr + ; + +@builtin_op = @var_args_expr + | @noopexpr + | @offsetofexpr + | @intaddrexpr + | @hasassignexpr + | @hascopyexpr + | @hasnothrowassign + | @hasnothrowconstr + | @hasnothrowcopy + | @hastrivialassign + | @hastrivialconstr + | @hastrivialcopy + | @hastrivialdestructor + | @hasuserdestr + | @hasvirtualdestr + | @isabstractexpr + | @isbaseofexpr + | @isclassexpr + | @isconvtoexpr + | @isemptyexpr + | @isenumexpr + | @ispodexpr + | @ispolyexpr + | @isunionexpr + | @typescompexpr + | @builtinshufflevector + | @builtinconvertvector + | @builtinaddressof + | @istriviallyconstructibleexpr + | @isdestructibleexpr + | @isnothrowdestructibleexpr + | @istriviallydestructibleexpr + | @istriviallyassignableexpr + | @isnothrowassignableexpr + | @istrivialexpr + | @isstandardlayoutexpr + | @istriviallycopyableexpr + | @isliteraltypeexpr + | @hastrivialmoveconstructorexpr + | @hastrivialmoveassignexpr + | @hasnothrowmoveassignexpr + | @isconstructibleexpr + | @isnothrowconstructibleexpr + | @hasfinalizerexpr + | @isdelegateexpr + | @isinterfaceclassexpr + | @isrefarrayexpr + | @isrefclassexpr + | @issealedexpr + | @issimplevalueclassexpr + | @isvalueclassexpr + | @isfinalexpr + | @builtinchooseexpr + | @builtincomplex + | @isassignable + | @isaggregate + | @hasuniqueobjectrepresentations + | @builtinbitcast + | @builtinshuffle + | @issame + | @isfunction + | @islayoutcompatible + | @ispointerinterconvertiblebaseof + | @isarray + | @arrayrank + | @arrayextent + | @isarithmetic + | @iscompletetype + | @iscompound + | @isconst + | @isfloatingpoint + | @isfundamental + | @isintegral + | @islvaluereference + | @ismemberfunctionpointer + | @ismemberobjectpointer + | @ismemberpointer + | @isobject + | @ispointer + | @isreference + | @isrvaluereference + | @isscalar + | @issigned + | @isunsigned + | @isvoid + | @isvolatile + | @istriviallycopyassignable + | @isassignablenopreconditioncheck + | @referencebindstotemporary + | @issameas + | @builtinhasattribute + | @ispointerinterconvertiblewithclass + | @builtinispointerinterconvertiblewithclass + | @iscorrespondingmember + | @builtiniscorrespondingmember + | @isboundedarray + | @isunboundedarray + | @isreferenceable + | @isnothrowconvertible + | @referenceconstructsfromtemporary + | @referenceconvertsfromtemporary + | @isconvertible + | @isvalidwinrttype + | @iswinclass + | @iswininterface + | @istriviallyequalitycomparable + | @isscopedenum + | @istriviallyrelocatable + ; + +compound_requirement_is_noexcept( + int expr: @compound_requirement ref +); + +new_allocated_type( + unique int expr: @new_expr ref, + int type_id: @type ref +); + +new_array_allocated_type( + unique int expr: @new_array_expr ref, + int type_id: @type ref +); + +/** + * The field being initialized by an initializer expression within an aggregate + * initializer for a class/struct/union. Position is used to sort repeated initializers. + */ +#keyset[aggregate, position] +aggregate_field_init( + int aggregate: @aggregateliteral ref, + int initializer: @expr ref, + int field: @membervariable ref, + int position: int ref +); + +/** + * The index of the element being initialized by an initializer expression + * within an aggregate initializer for an array. Position is used to sort repeated initializers. + */ +#keyset[aggregate, position] +aggregate_array_init( + int aggregate: @aggregateliteral ref, + int initializer: @expr ref, + int element_index: int ref, + int position: int ref +); + +@ctorinit = @ctordirectinit + | @ctorvirtualinit + | @ctorfieldinit + | @ctordelegatinginit; +@dtordestruct = @dtordirectdestruct + | @dtorvirtualdestruct + | @dtorfielddestruct; + + +condition_decl_bind( + unique int expr: @condition_decl ref, + unique int decl: @declaration ref +); + +typeid_bind( + unique int expr: @type_id ref, + int type_id: @type ref +); + +uuidof_bind( + unique int expr: @uuidof ref, + int type_id: @type ref +); + +@runtime_sizeof_or_alignof = @runtime_sizeof | @runtime_alignof | @datasizeof; + +sizeof_bind( + unique int expr: @runtime_sizeof_or_alignof ref, + int type_id: @type ref +); + +code_block( + unique int block: @literal ref, + unique int routine: @function ref +); + +lambdas( + unique int expr: @lambdaexpr ref, + string default_capture: string ref, + boolean has_explicit_return_type: boolean ref +); + +lambda_capture( + unique int id: @lambdacapture, + int lambda: @lambdaexpr ref, + int index: int ref, + int field: @membervariable ref, + boolean captured_by_reference: boolean ref, + boolean is_implicit: boolean ref, + int location: @location_default ref +); + +@funbindexpr = @routineexpr + | @new_expr + | @delete_expr + | @delete_array_expr + | @ctordirectinit + | @ctorvirtualinit + | @ctordelegatinginit + | @dtordirectdestruct + | @dtorvirtualdestruct; + +@varbindexpr = @varaccess | @ctorfieldinit | @dtorfielddestruct; +@addressable = @function | @variable ; +@accessible = @addressable | @enumconstant ; + +@access = @varaccess | @routineexpr ; + +fold( + int expr: @foldexpr ref, + string operator: string ref, + boolean is_left_fold: boolean ref +); + +stmts( + unique int id: @stmt, + int kind: int ref, + int location: @location_stmt ref +); + +case @stmt.kind of + 1 = @stmt_expr +| 2 = @stmt_if +| 3 = @stmt_while +| 4 = @stmt_goto +| 5 = @stmt_label +| 6 = @stmt_return +| 7 = @stmt_block +| 8 = @stmt_end_test_while // do { ... } while ( ... ) +| 9 = @stmt_for +| 10 = @stmt_switch_case +| 11 = @stmt_switch +| 13 = @stmt_asm // "asm" statement or the body of an asm function +| 15 = @stmt_try_block +| 16 = @stmt_microsoft_try // Microsoft +| 17 = @stmt_decl +| 18 = @stmt_set_vla_size // C99 +| 19 = @stmt_vla_decl // C99 +| 25 = @stmt_assigned_goto // GNU +| 26 = @stmt_empty +| 27 = @stmt_continue +| 28 = @stmt_break +| 29 = @stmt_range_based_for // C++11 +// ... 30 @stmt_at_autoreleasepool_block deprecated +// ... 31 @stmt_objc_for_in deprecated +// ... 32 @stmt_at_synchronized deprecated +| 33 = @stmt_handler +// ... 34 @stmt_finally_end deprecated +| 35 = @stmt_constexpr_if +| 37 = @stmt_co_return +; + +type_vla( + int type_id: @type ref, + int decl: @stmt_vla_decl ref +); + +variable_vla( + int var: @variable ref, + int decl: @stmt_vla_decl ref +); + +if_initialization( + unique int if_stmt: @stmt_if ref, + int init_id: @stmt ref +); + +if_then( + unique int if_stmt: @stmt_if ref, + int then_id: @stmt ref +); + +if_else( + unique int if_stmt: @stmt_if ref, + int else_id: @stmt ref +); + +constexpr_if_initialization( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int init_id: @stmt ref +); + +constexpr_if_then( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int then_id: @stmt ref +); + +constexpr_if_else( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int else_id: @stmt ref +); + +while_body( + unique int while_stmt: @stmt_while ref, + int body_id: @stmt ref +); + +do_body( + unique int do_stmt: @stmt_end_test_while ref, + int body_id: @stmt ref +); + +switch_initialization( + unique int switch_stmt: @stmt_switch ref, + int init_id: @stmt ref +); + +#keyset[switch_stmt, index] +switch_case( + int switch_stmt: @stmt_switch ref, + int index: int ref, + int case_id: @stmt_switch_case ref +); + +switch_body( + unique int switch_stmt: @stmt_switch ref, + int body_id: @stmt ref +); + +@stmt_for_or_range_based_for = @stmt_for + | @stmt_range_based_for; + +for_initialization( + unique int for_stmt: @stmt_for_or_range_based_for ref, + int init_id: @stmt ref +); + +for_condition( + unique int for_stmt: @stmt_for ref, + int condition_id: @expr ref +); + +for_update( + unique int for_stmt: @stmt_for ref, + int update_id: @expr ref +); + +for_body( + unique int for_stmt: @stmt_for ref, + int body_id: @stmt ref +); + +@stmtparent = @stmt | @expr_stmt ; +stmtparents( + unique int id: @stmt ref, + int index: int ref, + int parent: @stmtparent ref +); + +ishandler(unique int block: @stmt_block ref); + +@cfgnode = @stmt | @expr | @function | @initialiser ; + +stmt_decl_bind( + int stmt: @stmt_decl ref, + int num: int ref, + int decl: @declaration ref +); + +stmt_decl_entry_bind( + int stmt: @stmt_decl ref, + int num: int ref, + int decl_entry: @element ref +); + +@parameterized_element = @function | @stmt_block | @requires_expr; + +blockscope( + unique int block: @stmt_block ref, + int enclosing: @parameterized_element ref +); + +@jump = @stmt_goto | @stmt_break | @stmt_continue; + +@jumporlabel = @jump | @stmt_label | @literal; + +jumpinfo( + unique int id: @jumporlabel ref, + string str: string ref, + int target: @stmt ref +); + +preprocdirects( + unique int id: @preprocdirect, + int kind: int ref, + int location: @location_default ref +); +case @preprocdirect.kind of + 0 = @ppd_if +| 1 = @ppd_ifdef +| 2 = @ppd_ifndef +| 3 = @ppd_elif +| 4 = @ppd_else +| 5 = @ppd_endif +| 6 = @ppd_plain_include +| 7 = @ppd_define +| 8 = @ppd_undef +| 9 = @ppd_line +| 10 = @ppd_error +| 11 = @ppd_pragma +| 12 = @ppd_objc_import +| 13 = @ppd_include_next +| 18 = @ppd_warning +; + +@ppd_include = @ppd_plain_include | @ppd_objc_import | @ppd_include_next; + +@ppd_branch = @ppd_if | @ppd_ifdef | @ppd_ifndef | @ppd_elif; + +preprocpair( + int begin : @ppd_branch ref, + int elseelifend : @preprocdirect ref +); + +preproctrue(int branch : @ppd_branch ref); +preprocfalse(int branch : @ppd_branch ref); + +preproctext( + unique int id: @preprocdirect ref, + string head: string ref, + string body: string ref +); + +includes( + unique int id: @ppd_include ref, + int included: @file ref +); + +link_targets( + int id: @link_target, + int binary: @file ref +); + +link_parent( + int element : @element ref, + int link_target : @link_target ref +); + +/* XML Files */ + +xmlEncoding(unique int id: @file ref, string encoding: string ref); + +xmlDTDs( + unique int id: @xmldtd, + string root: string ref, + string publicId: string ref, + string systemId: string ref, + int fileid: @file ref +); + +xmlElements( + unique int id: @xmlelement, + string name: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int fileid: @file ref +); + +xmlAttrs( + unique int id: @xmlattribute, + int elementid: @xmlelement ref, + string name: string ref, + string value: string ref, + int idx: int ref, + int fileid: @file ref +); + +xmlNs( + int id: @xmlnamespace, + string prefixName: string ref, + string URI: string ref, + int fileid: @file ref +); + +xmlHasNs( + int elementId: @xmlnamespaceable ref, + int nsId: @xmlnamespace ref, + int fileid: @file ref +); + +xmlComments( + unique int id: @xmlcomment, + string text: string ref, + int parentid: @xmlparent ref, + int fileid: @file ref +); + +xmlChars( + unique int id: @xmlcharacters, + string text: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int isCDATA: int ref, + int fileid: @file ref +); + +@xmlparent = @file | @xmlelement; +@xmlnamespaceable = @xmlelement | @xmlattribute; + +xmllocations( + int xmlElement: @xmllocatable ref, + int location: @location_default ref +); + +@xmllocatable = @xmlcharacters + | @xmlelement + | @xmlcomment + | @xmlattribute + | @xmldtd + | @file + | @xmlnamespace; diff --git a/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/semmlecode.cpp.dbscheme b/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/semmlecode.cpp.dbscheme new file mode 100644 index 00000000000..e51fad7a243 --- /dev/null +++ b/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/semmlecode.cpp.dbscheme @@ -0,0 +1,2323 @@ + +/** + * An invocation of the compiler. Note that more than one file may be + * compiled per invocation. For example, this command compiles three + * source files: + * + * gcc -c f1.c f2.c f3.c + * + * The `id` simply identifies the invocation, while `cwd` is the working + * directory from which the compiler was invoked. + */ +compilations( + /** + * An invocation of the compiler. Note that more than one file may + * be compiled per invocation. For example, this command compiles + * three source files: + * + * gcc -c f1.c f2.c f3.c + */ + unique int id : @compilation, + string cwd : string ref +); + +/** + * The arguments that were passed to the extractor for a compiler + * invocation. If `id` is for the compiler invocation + * + * gcc -c f1.c f2.c f3.c + * + * then typically there will be rows for + * + * num | arg + * --- | --- + * 0 | *path to extractor* + * 1 | `--mimic` + * 2 | `/usr/bin/gcc` + * 3 | `-c` + * 4 | f1.c + * 5 | f2.c + * 6 | f3.c + */ +#keyset[id, num] +compilation_args( + int id : @compilation ref, + int num : int ref, + string arg : string ref +); + +/** + * The source files that are compiled by a compiler invocation. + * If `id` is for the compiler invocation + * + * gcc -c f1.c f2.c f3.c + * + * then there will be rows for + * + * num | arg + * --- | --- + * 0 | f1.c + * 1 | f2.c + * 2 | f3.c + * + * Note that even if those files `#include` headers, those headers + * do not appear as rows. + */ +#keyset[id, num] +compilation_compiling_files( + int id : @compilation ref, + int num : int ref, + int file : @file ref +); + +/** + * The time taken by the extractor for a compiler invocation. + * + * For each file `num`, there will be rows for + * + * kind | seconds + * ---- | --- + * 1 | CPU seconds used by the extractor frontend + * 2 | Elapsed seconds during the extractor frontend + * 3 | CPU seconds used by the extractor backend + * 4 | Elapsed seconds during the extractor backend + */ +#keyset[id, num, kind] +compilation_time( + int id : @compilation ref, + int num : int ref, + /* kind: + 1 = frontend_cpu_seconds + 2 = frontend_elapsed_seconds + 3 = extractor_cpu_seconds + 4 = extractor_elapsed_seconds + */ + int kind : int ref, + float seconds : float ref +); + +/** + * An error or warning generated by the extractor. + * The diagnostic message `diagnostic` was generated during compiler + * invocation `compilation`, and is the `file_number_diagnostic_number`th + * message generated while extracting the `file_number`th file of that + * invocation. + */ +#keyset[compilation, file_number, file_number_diagnostic_number] +diagnostic_for( + int diagnostic : @diagnostic ref, + int compilation : @compilation ref, + int file_number : int ref, + int file_number_diagnostic_number : int ref +); + +/** + * If extraction was successful, then `cpu_seconds` and + * `elapsed_seconds` are the CPU time and elapsed time (respectively) + * that extraction took for compiler invocation `id`. + */ +compilation_finished( + unique int id : @compilation ref, + float cpu_seconds : float ref, + float elapsed_seconds : float ref +); + + +/** + * External data, loaded from CSV files during snapshot creation. See + * [Tutorial: Incorporating external data](https://help.semmle.com/wiki/display/SD/Tutorial%3A+Incorporating+external+data) + * for more information. + */ +externalData( + int id : @externalDataElement, + string path : string ref, + int column: int ref, + string value : string ref +); + +/** + * The source location of the snapshot. + */ +sourceLocationPrefix(string prefix : string ref); + +/** + * Information about packages that provide code used during compilation. + * The `id` is just a unique identifier. + * The `namespace` is typically the name of the package manager that + * provided the package (e.g. "dpkg" or "yum"). + * The `package_name` is the name of the package, and `version` is its + * version (as a string). + */ +external_packages( + unique int id: @external_package, + string namespace : string ref, + string package_name : string ref, + string version : string ref +); + +/** + * Holds if File `fileid` was provided by package `package`. + */ +header_to_external_package( + int fileid : @file ref, + int package : @external_package ref +); + +/* + * Version history + */ + +svnentries( + unique int id : @svnentry, + string revision : string ref, + string author : string ref, + date revisionDate : date ref, + int changeSize : int ref +) + +svnaffectedfiles( + int id : @svnentry ref, + int file : @file ref, + string action : string ref +) + +svnentrymsg( + unique int id : @svnentry ref, + string message : string ref +) + +svnchurn( + int commit : @svnentry ref, + int file : @file ref, + int addedLines : int ref, + int deletedLines : int ref +) + +/* + * C++ dbscheme + */ + +extractor_version( + string codeql_version: string ref, + string frontend_version: string ref +) + +@location = @location_stmt | @location_expr | @location_default ; + +/** + * The location of an element that is not an expression or a statement. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_default( + /** The location of an element that is not an expression or a statement. */ + unique int id: @location_default, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** + * The location of a statement. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_stmt( + /** The location of a statement. */ + unique int id: @location_stmt, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** + * The location of an expression. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_expr( + /** The location of an expression. */ + unique int id: @location_expr, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** An element for which line-count information is available. */ +@sourceline = @file | @function | @variable | @enumconstant | @xmllocatable; + +numlines( + int element_id: @sourceline ref, + int num_lines: int ref, + int num_code: int ref, + int num_comment: int ref +); + +diagnostics( + unique int id: @diagnostic, + int severity: int ref, + string error_tag: string ref, + string error_message: string ref, + string full_error_message: string ref, + int location: @location_default ref +); + +files( + unique int id: @file, + string name: string ref +); + +folders( + unique int id: @folder, + string name: string ref +); + +@container = @folder | @file + +containerparent( + int parent: @container ref, + unique int child: @container ref +); + +fileannotations( + int id: @file ref, + int kind: int ref, + string name: string ref, + string value: string ref +); + +inmacroexpansion( + int id: @element ref, + int inv: @macroinvocation ref +); + +affectedbymacroexpansion( + int id: @element ref, + int inv: @macroinvocation ref +); + +case @macroinvocation.kind of + 1 = @macro_expansion +| 2 = @other_macro_reference +; + +macroinvocations( + unique int id: @macroinvocation, + int macro_id: @ppd_define ref, + int location: @location_default ref, + int kind: int ref +); + +macroparent( + unique int id: @macroinvocation ref, + int parent_id: @macroinvocation ref +); + +// a macroinvocation may be part of another location +// the way to find a constant expression that uses a macro +// is thus to find a constant expression that has a location +// to which a macro invocation is bound +macrolocationbind( + int id: @macroinvocation ref, + int location: @location ref +); + +#keyset[invocation, argument_index] +macro_argument_unexpanded( + int invocation: @macroinvocation ref, + int argument_index: int ref, + string text: string ref +); + +#keyset[invocation, argument_index] +macro_argument_expanded( + int invocation: @macroinvocation ref, + int argument_index: int ref, + string text: string ref +); + +/* +case @function.kind of + 1 = @normal_function +| 2 = @constructor +| 3 = @destructor +| 4 = @conversion_function +| 5 = @operator +| 6 = @builtin_function // GCC built-in functions, e.g. __builtin___memcpy_chk +| 7 = @user_defined_literal +| 8 = @deduction_guide +; +*/ + +functions( + unique int id: @function, + string name: string ref, + int kind: int ref +); + +function_entry_point( + int id: @function ref, + unique int entry_point: @stmt ref +); + +function_return_type( + int id: @function ref, + int return_type: @type ref +); + +/** + * If `function` is a coroutine, then this gives the `std::experimental::resumable_traits` + * instance associated with it, and the variables representing the `handle` and `promise` + * for it. + */ +coroutine( + unique int function: @function ref, + int traits: @type ref +); + +/* +case @coroutine_placeholder_variable.kind of + 1 = @handle +| 2 = @promise +| 3 = @init_await_resume +; +*/ + +coroutine_placeholder_variable( + unique int placeholder_variable: @variable ref, + int kind: int ref, + int function: @function ref +) + +/** The `new` function used for allocating the coroutine state, if any. */ +coroutine_new( + unique int function: @function ref, + int new: @function ref +); + +/** The `delete` function used for deallocating the coroutine state, if any. */ +coroutine_delete( + unique int function: @function ref, + int delete: @function ref +); + +purefunctions(unique int id: @function ref); + +function_deleted(unique int id: @function ref); + +function_defaulted(unique int id: @function ref); + +function_prototyped(unique int id: @function ref) + +deduction_guide_for_class( + int id: @function ref, + int class_template: @usertype ref +) + +member_function_this_type( + unique int id: @function ref, + int this_type: @type ref +); + +#keyset[id, type_id] +fun_decls( + int id: @fun_decl, + int function: @function ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); +fun_def(unique int id: @fun_decl ref); +fun_specialized(unique int id: @fun_decl ref); +fun_implicit(unique int id: @fun_decl ref); +fun_decl_specifiers( + int id: @fun_decl ref, + string name: string ref +) +#keyset[fun_decl, index] +fun_decl_throws( + int fun_decl: @fun_decl ref, + int index: int ref, + int type_id: @type ref +); +/* an empty throw specification is different from none */ +fun_decl_empty_throws(unique int fun_decl: @fun_decl ref); +fun_decl_noexcept( + int fun_decl: @fun_decl ref, + int constant: @expr ref +); +fun_decl_empty_noexcept(int fun_decl: @fun_decl ref); +fun_decl_typedef_type( + unique int fun_decl: @fun_decl ref, + int typedeftype_id: @usertype ref +); + +param_decl_bind( + unique int id: @var_decl ref, + int index: int ref, + int fun_decl: @fun_decl ref +); + +#keyset[id, type_id] +var_decls( + int id: @var_decl, + int variable: @variable ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); +var_def(unique int id: @var_decl ref); +var_decl_specifiers( + int id: @var_decl ref, + string name: string ref +) +is_structured_binding(unique int id: @variable ref); + +type_decls( + unique int id: @type_decl, + int type_id: @type ref, + int location: @location_default ref +); +type_def(unique int id: @type_decl ref); +type_decl_top( + unique int type_decl: @type_decl ref +); + +namespace_decls( + unique int id: @namespace_decl, + int namespace_id: @namespace ref, + int location: @location_default ref, + int bodylocation: @location_default ref +); + +case @using.kind of + 1 = @using_declaration +| 2 = @using_directive +| 3 = @using_enum_declaration +; + +usings( + unique int id: @using, + int element_id: @element ref, + int location: @location_default ref, + int kind: int ref +); + +/** The element which contains the `using` declaration. */ +using_container( + int parent: @element ref, + int child: @using ref +); + +static_asserts( + unique int id: @static_assert, + int condition : @expr ref, + string message : string ref, + int location: @location_default ref, + int enclosing : @element ref +); + +// each function has an ordered list of parameters +#keyset[id, type_id] +#keyset[function, index, type_id] +params( + int id: @parameter, + int function: @parameterized_element ref, + int index: int ref, + int type_id: @type ref +); + +overrides( + int new: @function ref, + int old: @function ref +); + +#keyset[id, type_id] +membervariables( + int id: @membervariable, + int type_id: @type ref, + string name: string ref +); + +#keyset[id, type_id] +globalvariables( + int id: @globalvariable, + int type_id: @type ref, + string name: string ref +); + +#keyset[id, type_id] +localvariables( + int id: @localvariable, + int type_id: @type ref, + string name: string ref +); + +autoderivation( + unique int var: @variable ref, + int derivation_type: @type ref +); + +orphaned_variables( + int var: @localvariable ref, + int function: @function ref +) + +enumconstants( + unique int id: @enumconstant, + int parent: @usertype ref, + int index: int ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); + +@variable = @localscopevariable | @globalvariable | @membervariable; + +@localscopevariable = @localvariable | @parameter; + +/** + * Built-in types are the fundamental types, e.g., integral, floating, and void. + */ +case @builtintype.kind of + 1 = @errortype +| 2 = @unknowntype +| 3 = @void +| 4 = @boolean +| 5 = @char +| 6 = @unsigned_char +| 7 = @signed_char +| 8 = @short +| 9 = @unsigned_short +| 10 = @signed_short +| 11 = @int +| 12 = @unsigned_int +| 13 = @signed_int +| 14 = @long +| 15 = @unsigned_long +| 16 = @signed_long +| 17 = @long_long +| 18 = @unsigned_long_long +| 19 = @signed_long_long +// ... 20 Microsoft-specific __int8 +// ... 21 Microsoft-specific __int16 +// ... 22 Microsoft-specific __int32 +// ... 23 Microsoft-specific __int64 +| 24 = @float +| 25 = @double +| 26 = @long_double +| 27 = @complex_float // C99-specific _Complex float +| 28 = @complex_double // C99-specific _Complex double +| 29 = @complex_long_double // C99-specific _Complex long double +| 30 = @imaginary_float // C99-specific _Imaginary float +| 31 = @imaginary_double // C99-specific _Imaginary double +| 32 = @imaginary_long_double // C99-specific _Imaginary long double +| 33 = @wchar_t // Microsoft-specific +| 34 = @decltype_nullptr // C++11 +| 35 = @int128 // __int128 +| 36 = @unsigned_int128 // unsigned __int128 +| 37 = @signed_int128 // signed __int128 +| 38 = @float128 // __float128 +| 39 = @complex_float128 // _Complex __float128 +| 40 = @decimal32 // _Decimal32 +| 41 = @decimal64 // _Decimal64 +| 42 = @decimal128 // _Decimal128 +| 43 = @char16_t +| 44 = @char32_t +| 45 = @std_float32 // _Float32 +| 46 = @float32x // _Float32x +| 47 = @std_float64 // _Float64 +| 48 = @float64x // _Float64x +| 49 = @std_float128 // _Float128 +// ... 50 _Float128x +| 51 = @char8_t +| 52 = @float16 // _Float16 +| 53 = @complex_float16 // _Complex _Float16 +| 54 = @fp16 // __fp16 +| 55 = @std_bfloat16 // __bf16 +| 56 = @std_float16 // std::float16_t +| 57 = @complex_std_float32 // _Complex _Float32 +| 58 = @complex_float32x // _Complex _Float32x +| 59 = @complex_std_float64 // _Complex _Float64 +| 60 = @complex_float64x // _Complex _Float64x +| 61 = @complex_std_float128 // _Complex _Float128 +; + +builtintypes( + unique int id: @builtintype, + string name: string ref, + int kind: int ref, + int size: int ref, + int sign: int ref, + int alignment: int ref +); + +/** + * Derived types are types that are directly derived from existing types and + * point to, refer to, transform type data to return a new type. + */ +case @derivedtype.kind of + 1 = @pointer +| 2 = @reference +| 3 = @type_with_specifiers +| 4 = @array +| 5 = @gnu_vector +| 6 = @routineptr +| 7 = @routinereference +| 8 = @rvalue_reference // C++11 +// ... 9 type_conforming_to_protocols deprecated +| 10 = @block +; + +derivedtypes( + unique int id: @derivedtype, + string name: string ref, + int kind: int ref, + int type_id: @type ref +); + +pointerishsize(unique int id: @derivedtype ref, + int size: int ref, + int alignment: int ref); + +arraysizes( + unique int id: @derivedtype ref, + int num_elements: int ref, + int bytesize: int ref, + int alignment: int ref +); + +typedefbase( + unique int id: @usertype ref, + int type_id: @type ref +); + +/** + * An instance of the C++11 `decltype` operator. For example: + * ``` + * int a; + * decltype(1+a) b; + * ``` + * Here `expr` is `1+a`. + * + * Sometimes an additional pair of parentheses around the expression + * would change the semantics of this decltype, e.g. + * ``` + * struct A { double x; }; + * const A* a = new A(); + * decltype( a->x ); // type is double + * decltype((a->x)); // type is const double& + * ``` + * (Please consult the C++11 standard for more details). + * `parentheses_would_change_meaning` is `true` iff that is the case. + */ +#keyset[id, expr] +decltypes( + int id: @decltype, + int expr: @expr ref, + int base_type: @type ref, + boolean parentheses_would_change_meaning: boolean ref +); + +/* +case @usertype.kind of + 1 = @struct +| 2 = @class +| 3 = @union +| 4 = @enum +| 5 = @typedef // classic C: typedef typedef type name +| 6 = @template +| 7 = @template_parameter +| 8 = @template_template_parameter +| 9 = @proxy_class // a proxy class associated with a template parameter +// ... 10 objc_class deprecated +// ... 11 objc_protocol deprecated +// ... 12 objc_category deprecated +| 13 = @scoped_enum +| 14 = @using_alias // a using name = type style typedef +; +*/ + +usertypes( + unique int id: @usertype, + string name: string ref, + int kind: int ref +); + +usertypesize( + unique int id: @usertype ref, + int size: int ref, + int alignment: int ref +); + +usertype_final(unique int id: @usertype ref); + +usertype_uuid( + unique int id: @usertype ref, + string uuid: string ref +); + +mangled_name( + unique int id: @declaration ref, + int mangled_name : @mangledname, + boolean is_complete: boolean ref +); + +is_pod_class(unique int id: @usertype ref); +is_standard_layout_class(unique int id: @usertype ref); + +is_complete(unique int id: @usertype ref); + +is_class_template(unique int id: @usertype ref); +class_instantiation( + int to: @usertype ref, + int from: @usertype ref +); +class_template_argument( + int type_id: @usertype ref, + int index: int ref, + int arg_type: @type ref +); +class_template_argument_value( + int type_id: @usertype ref, + int index: int ref, + int arg_value: @expr ref +); + +is_proxy_class_for( + unique int id: @usertype ref, + unique int templ_param_id: @usertype ref +); + +type_mentions( + unique int id: @type_mention, + int type_id: @type ref, + int location: @location ref, + // a_symbol_reference_kind from the frontend. + int kind: int ref +); + +is_function_template(unique int id: @function ref); +function_instantiation( + unique int to: @function ref, + int from: @function ref +); +function_template_argument( + int function_id: @function ref, + int index: int ref, + int arg_type: @type ref +); +function_template_argument_value( + int function_id: @function ref, + int index: int ref, + int arg_value: @expr ref +); + +is_variable_template(unique int id: @variable ref); +variable_instantiation( + unique int to: @variable ref, + int from: @variable ref +); +variable_template_argument( + int variable_id: @variable ref, + int index: int ref, + int arg_type: @type ref +); +variable_template_argument_value( + int variable_id: @variable ref, + int index: int ref, + int arg_value: @expr ref +); + +routinetypes( + unique int id: @routinetype, + int return_type: @type ref +); + +routinetypeargs( + int routine: @routinetype ref, + int index: int ref, + int type_id: @type ref +); + +ptrtomembers( + unique int id: @ptrtomember, + int type_id: @type ref, + int class_id: @type ref +); + +/* + specifiers for types, functions, and variables + + "public", + "protected", + "private", + + "const", + "volatile", + "static", + + "pure", + "virtual", + "sealed", // Microsoft + "__interface", // Microsoft + "inline", + "explicit", + + "near", // near far extension + "far", // near far extension + "__ptr32", // Microsoft + "__ptr64", // Microsoft + "__sptr", // Microsoft + "__uptr", // Microsoft + "dllimport", // Microsoft + "dllexport", // Microsoft + "thread", // Microsoft + "naked", // Microsoft + "microsoft_inline", // Microsoft + "forceinline", // Microsoft + "selectany", // Microsoft + "nothrow", // Microsoft + "novtable", // Microsoft + "noreturn", // Microsoft + "noinline", // Microsoft + "noalias", // Microsoft + "restrict", // Microsoft +*/ + +specifiers( + unique int id: @specifier, + unique string str: string ref +); + +typespecifiers( + int type_id: @type ref, + int spec_id: @specifier ref +); + +funspecifiers( + int func_id: @function ref, + int spec_id: @specifier ref +); + +varspecifiers( + int var_id: @accessible ref, + int spec_id: @specifier ref +); + +explicit_specifier_exprs( + unique int func_id: @function ref, + int constant: @expr ref +) + +attributes( + unique int id: @attribute, + int kind: int ref, + string name: string ref, + string name_space: string ref, + int location: @location_default ref +); + +case @attribute.kind of + 0 = @gnuattribute +| 1 = @stdattribute +| 2 = @declspec +| 3 = @msattribute +| 4 = @alignas +// ... 5 @objc_propertyattribute deprecated +; + +attribute_args( + unique int id: @attribute_arg, + int kind: int ref, + int attribute: @attribute ref, + int index: int ref, + int location: @location_default ref +); + +case @attribute_arg.kind of + 0 = @attribute_arg_empty +| 1 = @attribute_arg_token +| 2 = @attribute_arg_constant +| 3 = @attribute_arg_type +| 4 = @attribute_arg_constant_expr +| 5 = @attribute_arg_expr +; + +attribute_arg_value( + unique int arg: @attribute_arg ref, + string value: string ref +); +attribute_arg_type( + unique int arg: @attribute_arg ref, + int type_id: @type ref +); +attribute_arg_constant( + unique int arg: @attribute_arg ref, + int constant: @expr ref +) +attribute_arg_expr( + unique int arg: @attribute_arg ref, + int expr: @expr ref +) +attribute_arg_name( + unique int arg: @attribute_arg ref, + string name: string ref +); + +typeattributes( + int type_id: @type ref, + int spec_id: @attribute ref +); + +funcattributes( + int func_id: @function ref, + int spec_id: @attribute ref +); + +varattributes( + int var_id: @accessible ref, + int spec_id: @attribute ref +); + +stmtattributes( + int stmt_id: @stmt ref, + int spec_id: @attribute ref +); + +@type = @builtintype + | @derivedtype + | @usertype + /* TODO | @fixedpointtype */ + | @routinetype + | @ptrtomember + | @decltype; + +unspecifiedtype( + unique int type_id: @type ref, + int unspecified_type_id: @type ref +); + +member( + int parent: @type ref, + int index: int ref, + int child: @member ref +); + +@enclosingfunction_child = @usertype | @variable | @namespace + +enclosingfunction( + unique int child: @enclosingfunction_child ref, + int parent: @function ref +); + +derivations( + unique int derivation: @derivation, + int sub: @type ref, + int index: int ref, + int super: @type ref, + int location: @location_default ref +); + +derspecifiers( + int der_id: @derivation ref, + int spec_id: @specifier ref +); + +/** + * Contains the byte offset of the base class subobject within the derived + * class. Only holds for non-virtual base classes, but see table + * `virtual_base_offsets` for offsets of virtual base class subobjects. + */ +direct_base_offsets( + unique int der_id: @derivation ref, + int offset: int ref +); + +/** + * Contains the byte offset of the virtual base class subobject for class + * `super` within a most-derived object of class `sub`. `super` can be either a + * direct or indirect base class. + */ +#keyset[sub, super] +virtual_base_offsets( + int sub: @usertype ref, + int super: @usertype ref, + int offset: int ref +); + +frienddecls( + unique int id: @frienddecl, + int type_id: @type ref, + int decl_id: @declaration ref, + int location: @location_default ref +); + +@declaredtype = @usertype ; + +@declaration = @function + | @declaredtype + | @variable + | @enumconstant + | @frienddecl; + +@member = @membervariable + | @function + | @declaredtype + | @enumconstant; + +@locatable = @diagnostic + | @declaration + | @ppd_include + | @ppd_define + | @macroinvocation + /*| @funcall*/ + | @xmllocatable + | @attribute + | @attribute_arg; + +@namedscope = @namespace | @usertype; + +@element = @locatable + | @file + | @folder + | @specifier + | @type + | @expr + | @namespace + | @initialiser + | @stmt + | @derivation + | @comment + | @preprocdirect + | @fun_decl + | @var_decl + | @type_decl + | @namespace_decl + | @using + | @namequalifier + | @specialnamequalifyingelement + | @static_assert + | @type_mention + | @lambdacapture; + +@exprparent = @element; + +comments( + unique int id: @comment, + string contents: string ref, + int location: @location_default ref +); + +commentbinding( + int id: @comment ref, + int element: @element ref +); + +exprconv( + int converted: @expr ref, + unique int conversion: @expr ref +); + +compgenerated(unique int id: @element ref); + +/** + * `destructor_call` destructs the `i`'th entity that should be + * destructed following `element`. Note that entities should be + * destructed in reverse construction order, so for a given `element` + * these should be called from highest to lowest `i`. + */ +#keyset[element, destructor_call] +#keyset[element, i] +synthetic_destructor_call( + int element: @element ref, + int i: int ref, + int destructor_call: @routineexpr ref +); + +namespaces( + unique int id: @namespace, + string name: string ref +); + +namespace_inline( + unique int id: @namespace ref +); + +namespacembrs( + int parentid: @namespace ref, + unique int memberid: @namespacembr ref +); + +@namespacembr = @declaration | @namespace; + +exprparents( + int expr_id: @expr ref, + int child_index: int ref, + int parent_id: @exprparent ref +); + +expr_isload(unique int expr_id: @expr ref); + +@cast = @c_style_cast + | @const_cast + | @dynamic_cast + | @reinterpret_cast + | @static_cast + ; + +/* +case @conversion.kind of + 0 = @simple_conversion // a numeric conversion, qualification conversion, or a reinterpret_cast +| 1 = @bool_conversion // conversion to 'bool' +| 2 = @base_class_conversion // a derived-to-base conversion +| 3 = @derived_class_conversion // a base-to-derived conversion +| 4 = @pm_base_class_conversion // a derived-to-base conversion of a pointer to member +| 5 = @pm_derived_class_conversion // a base-to-derived conversion of a pointer to member +| 6 = @glvalue_adjust // an adjustment of the type of a glvalue +| 7 = @prvalue_adjust // an adjustment of the type of a prvalue +; +*/ +/** + * Describes the semantics represented by a cast expression. This is largely + * independent of the source syntax of the cast, so it is separate from the + * regular expression kind. + */ +conversionkinds( + unique int expr_id: @cast ref, + int kind: int ref +); + +@conversion = @cast + | @array_to_pointer + | @parexpr + | @reference_to + | @ref_indirect + | @temp_init + | @c11_generic + ; + +/* +case @funbindexpr.kind of + 0 = @normal_call // a normal call +| 1 = @virtual_call // a virtual call +| 2 = @adl_call // a call whose target is only found by ADL +; +*/ +iscall( + unique int caller: @funbindexpr ref, + int kind: int ref +); + +numtemplatearguments( + unique int expr_id: @expr ref, + int num: int ref +); + +specialnamequalifyingelements( + unique int id: @specialnamequalifyingelement, + unique string name: string ref +); + +@namequalifiableelement = @expr | @namequalifier; +@namequalifyingelement = @namespace + | @specialnamequalifyingelement + | @usertype; + +namequalifiers( + unique int id: @namequalifier, + unique int qualifiableelement: @namequalifiableelement ref, + int qualifyingelement: @namequalifyingelement ref, + int location: @location_default ref +); + +varbind( + int expr: @varbindexpr ref, + int var: @accessible ref +); + +funbind( + int expr: @funbindexpr ref, + int fun: @function ref +); + +@any_new_expr = @new_expr + | @new_array_expr; + +@new_or_delete_expr = @any_new_expr + | @delete_expr + | @delete_array_expr; + +@prefix_crement_expr = @preincrexpr | @predecrexpr; + +@postfix_crement_expr = @postincrexpr | @postdecrexpr; + +@increment_expr = @preincrexpr | @postincrexpr; + +@decrement_expr = @predecrexpr | @postdecrexpr; + +@crement_expr = @increment_expr | @decrement_expr; + +@un_arith_op_expr = @arithnegexpr + | @unaryplusexpr + | @conjugation + | @realpartexpr + | @imagpartexpr + | @crement_expr + ; + +@un_bitwise_op_expr = @complementexpr; + +@un_log_op_expr = @notexpr; + +@un_op_expr = @address_of + | @indirect + | @un_arith_op_expr + | @un_bitwise_op_expr + | @builtinaddressof + | @vec_fill + | @un_log_op_expr + | @co_await + | @co_yield + ; + +@bin_log_op_expr = @andlogicalexpr | @orlogicalexpr; + +@cmp_op_expr = @eq_op_expr | @rel_op_expr; + +@eq_op_expr = @eqexpr | @neexpr; + +@rel_op_expr = @gtexpr + | @ltexpr + | @geexpr + | @leexpr + | @spaceshipexpr + ; + +@bin_bitwise_op_expr = @lshiftexpr + | @rshiftexpr + | @andexpr + | @orexpr + | @xorexpr + ; + +@p_arith_op_expr = @paddexpr + | @psubexpr + | @pdiffexpr + ; + +@bin_arith_op_expr = @addexpr + | @subexpr + | @mulexpr + | @divexpr + | @remexpr + | @jmulexpr + | @jdivexpr + | @fjaddexpr + | @jfaddexpr + | @fjsubexpr + | @jfsubexpr + | @minexpr + | @maxexpr + | @p_arith_op_expr + ; + +@bin_op_expr = @bin_arith_op_expr + | @bin_bitwise_op_expr + | @cmp_op_expr + | @bin_log_op_expr + ; + +@op_expr = @un_op_expr + | @bin_op_expr + | @assign_expr + | @conditionalexpr + ; + +@assign_arith_expr = @assignaddexpr + | @assignsubexpr + | @assignmulexpr + | @assigndivexpr + | @assignremexpr + ; + +@assign_bitwise_expr = @assignandexpr + | @assignorexpr + | @assignxorexpr + | @assignlshiftexpr + | @assignrshiftexpr + ; + +@assign_pointer_expr = @assignpaddexpr + | @assignpsubexpr + ; + +@assign_op_expr = @assign_arith_expr + | @assign_bitwise_expr + | @assign_pointer_expr + ; + +@assign_expr = @assignexpr | @assign_op_expr | @blockassignexpr + +/* + Binary encoding of the allocator form. + + case @allocator.form of + 0 = plain + | 1 = alignment + ; +*/ + +/** + * The allocator function associated with a `new` or `new[]` expression. + * The `form` column specified whether the allocation call contains an alignment + * argument. + */ +expr_allocator( + unique int expr: @any_new_expr ref, + int func: @function ref, + int form: int ref +); + +/* + Binary encoding of the deallocator form. + + case @deallocator.form of + 0 = plain + | 1 = size + | 2 = alignment + | 4 = destroying_delete + ; +*/ + +/** + * The deallocator function associated with a `delete`, `delete[]`, `new`, or + * `new[]` expression. For a `new` or `new[]` expression, the deallocator is the + * one used to free memory if the initialization throws an exception. + * The `form` column specifies whether the deallocation call contains a size + * argument, and alignment argument, or both. + */ +expr_deallocator( + unique int expr: @new_or_delete_expr ref, + int func: @function ref, + int form: int ref +); + +/** + * Holds if the `@conditionalexpr` is of the two operand form + * `guard ? : false`. + */ +expr_cond_two_operand( + unique int cond: @conditionalexpr ref +); + +/** + * The guard of `@conditionalexpr` `guard ? true : false` + */ +expr_cond_guard( + unique int cond: @conditionalexpr ref, + int guard: @expr ref +); + +/** + * The expression used when the guard of `@conditionalexpr` + * `guard ? true : false` holds. For the two operand form + * `guard ?: false` consider using `expr_cond_guard` instead. + */ +expr_cond_true( + unique int cond: @conditionalexpr ref, + int true: @expr ref +); + +/** + * The expression used when the guard of `@conditionalexpr` + * `guard ? true : false` does not hold. + */ +expr_cond_false( + unique int cond: @conditionalexpr ref, + int false: @expr ref +); + +/** A string representation of the value. */ +values( + unique int id: @value, + string str: string ref +); + +/** The actual text in the source code for the value, if any. */ +valuetext( + unique int id: @value ref, + string text: string ref +); + +valuebind( + int val: @value ref, + unique int expr: @expr ref +); + +fieldoffsets( + unique int id: @variable ref, + int byteoffset: int ref, + int bitoffset: int ref +); + +bitfield( + unique int id: @variable ref, + int bits: int ref, + int declared_bits: int ref +); + +/* TODO +memberprefix( + int member: @expr ref, + int prefix: @expr ref +); +*/ + +/* + kind(1) = mbrcallexpr + kind(2) = mbrptrcallexpr + kind(3) = mbrptrmbrcallexpr + kind(4) = ptrmbrptrmbrcallexpr + kind(5) = mbrreadexpr // x.y + kind(6) = mbrptrreadexpr // p->y + kind(7) = mbrptrmbrreadexpr // x.*pm + kind(8) = mbrptrmbrptrreadexpr // x->*pm + kind(9) = staticmbrreadexpr // static x.y + kind(10) = staticmbrptrreadexpr // static p->y +*/ +/* TODO +memberaccess( + int member: @expr ref, + int kind: int ref +); +*/ + +initialisers( + unique int init: @initialiser, + int var: @accessible ref, + unique int expr: @expr ref, + int location: @location_expr ref +); + +braced_initialisers( + int init: @initialiser ref +); + +/** + * An ancestor for the expression, for cases in which we cannot + * otherwise find the expression's parent. + */ +expr_ancestor( + int exp: @expr ref, + int ancestor: @element ref +); + +exprs( + unique int id: @expr, + int kind: int ref, + int location: @location_expr ref +); + +expr_reuse( + int reuse: @expr ref, + int original: @expr ref, + int value_category: int ref +) + +/* + case @value.category of + 1 = prval + | 2 = xval + | 3 = lval + ; +*/ +expr_types( + int id: @expr ref, + int typeid: @type ref, + int value_category: int ref +); + +case @expr.kind of + 1 = @errorexpr +| 2 = @address_of // & AddressOfExpr +| 3 = @reference_to // ReferenceToExpr (implicit?) +| 4 = @indirect // * PointerDereferenceExpr +| 5 = @ref_indirect // ReferenceDereferenceExpr (implicit?) +// ... +| 8 = @array_to_pointer // (???) +| 9 = @vacuous_destructor_call // VacuousDestructorCall +// ... +| 11 = @assume // Microsoft +| 12 = @parexpr +| 13 = @arithnegexpr +| 14 = @unaryplusexpr +| 15 = @complementexpr +| 16 = @notexpr +| 17 = @conjugation // GNU ~ operator +| 18 = @realpartexpr // GNU __real +| 19 = @imagpartexpr // GNU __imag +| 20 = @postincrexpr +| 21 = @postdecrexpr +| 22 = @preincrexpr +| 23 = @predecrexpr +| 24 = @conditionalexpr +| 25 = @addexpr +| 26 = @subexpr +| 27 = @mulexpr +| 28 = @divexpr +| 29 = @remexpr +| 30 = @jmulexpr // C99 mul imaginary +| 31 = @jdivexpr // C99 div imaginary +| 32 = @fjaddexpr // C99 add real + imaginary +| 33 = @jfaddexpr // C99 add imaginary + real +| 34 = @fjsubexpr // C99 sub real - imaginary +| 35 = @jfsubexpr // C99 sub imaginary - real +| 36 = @paddexpr // pointer add (pointer + int or int + pointer) +| 37 = @psubexpr // pointer sub (pointer - integer) +| 38 = @pdiffexpr // difference between two pointers +| 39 = @lshiftexpr +| 40 = @rshiftexpr +| 41 = @andexpr +| 42 = @orexpr +| 43 = @xorexpr +| 44 = @eqexpr +| 45 = @neexpr +| 46 = @gtexpr +| 47 = @ltexpr +| 48 = @geexpr +| 49 = @leexpr +| 50 = @minexpr // GNU minimum +| 51 = @maxexpr // GNU maximum +| 52 = @assignexpr +| 53 = @assignaddexpr +| 54 = @assignsubexpr +| 55 = @assignmulexpr +| 56 = @assigndivexpr +| 57 = @assignremexpr +| 58 = @assignlshiftexpr +| 59 = @assignrshiftexpr +| 60 = @assignandexpr +| 61 = @assignorexpr +| 62 = @assignxorexpr +| 63 = @assignpaddexpr // assign pointer add +| 64 = @assignpsubexpr // assign pointer sub +| 65 = @andlogicalexpr +| 66 = @orlogicalexpr +| 67 = @commaexpr +| 68 = @subscriptexpr // access to member of an array, e.g., a[5] +// ... 69 @objc_subscriptexpr deprecated +// ... 70 @cmdaccess deprecated +// ... +| 73 = @virtfunptrexpr +| 74 = @callexpr +// ... 75 @msgexpr_normal deprecated +// ... 76 @msgexpr_super deprecated +// ... 77 @atselectorexpr deprecated +// ... 78 @atprotocolexpr deprecated +| 79 = @vastartexpr +| 80 = @vaargexpr +| 81 = @vaendexpr +| 82 = @vacopyexpr +// ... 83 @atencodeexpr deprecated +| 84 = @varaccess +| 85 = @thisaccess +// ... 86 @objc_box_expr deprecated +| 87 = @new_expr +| 88 = @delete_expr +| 89 = @throw_expr +| 90 = @condition_decl // a variable declared in a condition, e.g., if(int x = y > 2) +| 91 = @braced_init_list +| 92 = @type_id +| 93 = @runtime_sizeof +| 94 = @runtime_alignof +| 95 = @sizeof_pack +| 96 = @expr_stmt // GNU extension +| 97 = @routineexpr +| 98 = @type_operand // used to access a type in certain contexts (haven't found any examples yet....) +| 99 = @offsetofexpr // offsetof ::= type and field +| 100 = @hasassignexpr // __has_assign ::= type +| 101 = @hascopyexpr // __has_copy ::= type +| 102 = @hasnothrowassign // __has_nothrow_assign ::= type +| 103 = @hasnothrowconstr // __has_nothrow_constructor ::= type +| 104 = @hasnothrowcopy // __has_nothrow_copy ::= type +| 105 = @hastrivialassign // __has_trivial_assign ::= type +| 106 = @hastrivialconstr // __has_trivial_constructor ::= type +| 107 = @hastrivialcopy // __has_trivial_copy ::= type +| 108 = @hasuserdestr // __has_user_destructor ::= type +| 109 = @hasvirtualdestr // __has_virtual_destructor ::= type +| 110 = @isabstractexpr // __is_abstract ::= type +| 111 = @isbaseofexpr // __is_base_of ::= type type +| 112 = @isclassexpr // __is_class ::= type +| 113 = @isconvtoexpr // __is_convertible_to ::= type type +| 114 = @isemptyexpr // __is_empty ::= type +| 115 = @isenumexpr // __is_enum ::= type +| 116 = @ispodexpr // __is_pod ::= type +| 117 = @ispolyexpr // __is_polymorphic ::= type +| 118 = @isunionexpr // __is_union ::= type +| 119 = @typescompexpr // GNU __builtin_types_compatible ::= type type +| 120 = @intaddrexpr // frontend internal builtin, used to implement offsetof +// ... +| 122 = @hastrivialdestructor // __has_trivial_destructor ::= type +| 123 = @literal +| 124 = @uuidof +| 127 = @aggregateliteral +| 128 = @delete_array_expr +| 129 = @new_array_expr +// ... 130 @objc_array_literal deprecated +// ... 131 @objc_dictionary_literal deprecated +| 132 = @foldexpr +// ... +| 200 = @ctordirectinit +| 201 = @ctorvirtualinit +| 202 = @ctorfieldinit +| 203 = @ctordelegatinginit +| 204 = @dtordirectdestruct +| 205 = @dtorvirtualdestruct +| 206 = @dtorfielddestruct +// ... +| 210 = @static_cast +| 211 = @reinterpret_cast +| 212 = @const_cast +| 213 = @dynamic_cast +| 214 = @c_style_cast +| 215 = @lambdaexpr +| 216 = @param_ref +| 217 = @noopexpr +// ... +| 294 = @istriviallyconstructibleexpr +| 295 = @isdestructibleexpr +| 296 = @isnothrowdestructibleexpr +| 297 = @istriviallydestructibleexpr +| 298 = @istriviallyassignableexpr +| 299 = @isnothrowassignableexpr +| 300 = @istrivialexpr +| 301 = @isstandardlayoutexpr +| 302 = @istriviallycopyableexpr +| 303 = @isliteraltypeexpr +| 304 = @hastrivialmoveconstructorexpr +| 305 = @hastrivialmoveassignexpr +| 306 = @hasnothrowmoveassignexpr +| 307 = @isconstructibleexpr +| 308 = @isnothrowconstructibleexpr +| 309 = @hasfinalizerexpr +| 310 = @isdelegateexpr +| 311 = @isinterfaceclassexpr +| 312 = @isrefarrayexpr +| 313 = @isrefclassexpr +| 314 = @issealedexpr +| 315 = @issimplevalueclassexpr +| 316 = @isvalueclassexpr +| 317 = @isfinalexpr +| 319 = @noexceptexpr +| 320 = @builtinshufflevector +| 321 = @builtinchooseexpr +| 322 = @builtinaddressof +| 323 = @vec_fill +| 324 = @builtinconvertvector +| 325 = @builtincomplex +| 326 = @spaceshipexpr +| 327 = @co_await +| 328 = @co_yield +| 329 = @temp_init +| 330 = @isassignable +| 331 = @isaggregate +| 332 = @hasuniqueobjectrepresentations +| 333 = @builtinbitcast +| 334 = @builtinshuffle +| 335 = @blockassignexpr +| 336 = @issame +| 337 = @isfunction +| 338 = @islayoutcompatible +| 339 = @ispointerinterconvertiblebaseof +| 340 = @isarray +| 341 = @arrayrank +| 342 = @arrayextent +| 343 = @isarithmetic +| 344 = @iscompletetype +| 345 = @iscompound +| 346 = @isconst +| 347 = @isfloatingpoint +| 348 = @isfundamental +| 349 = @isintegral +| 350 = @islvaluereference +| 351 = @ismemberfunctionpointer +| 352 = @ismemberobjectpointer +| 353 = @ismemberpointer +| 354 = @isobject +| 355 = @ispointer +| 356 = @isreference +| 357 = @isrvaluereference +| 358 = @isscalar +| 359 = @issigned +| 360 = @isunsigned +| 361 = @isvoid +| 362 = @isvolatile +| 363 = @reuseexpr +| 364 = @istriviallycopyassignable +| 365 = @isassignablenopreconditioncheck +| 366 = @referencebindstotemporary +| 367 = @issameas +| 368 = @builtinhasattribute +| 369 = @ispointerinterconvertiblewithclass +| 370 = @builtinispointerinterconvertiblewithclass +| 371 = @iscorrespondingmember +| 372 = @builtiniscorrespondingmember +| 373 = @isboundedarray +| 374 = @isunboundedarray +| 375 = @isreferenceable +| 378 = @isnothrowconvertible +| 379 = @referenceconstructsfromtemporary +| 380 = @referenceconvertsfromtemporary +| 381 = @isconvertible +| 382 = @isvalidwinrttype +| 383 = @iswinclass +| 384 = @iswininterface +| 385 = @istriviallyequalitycomparable +| 386 = @isscopedenum +| 387 = @istriviallyrelocatable +| 388 = @datasizeof +| 389 = @c11_generic +| 390 = @requires_expr +| 391 = @nested_requirement +| 392 = @compound_requirement +| 393 = @concept_id +; + +@var_args_expr = @vastartexpr + | @vaendexpr + | @vaargexpr + | @vacopyexpr + ; + +@builtin_op = @var_args_expr + | @noopexpr + | @offsetofexpr + | @intaddrexpr + | @hasassignexpr + | @hascopyexpr + | @hasnothrowassign + | @hasnothrowconstr + | @hasnothrowcopy + | @hastrivialassign + | @hastrivialconstr + | @hastrivialcopy + | @hastrivialdestructor + | @hasuserdestr + | @hasvirtualdestr + | @isabstractexpr + | @isbaseofexpr + | @isclassexpr + | @isconvtoexpr + | @isemptyexpr + | @isenumexpr + | @ispodexpr + | @ispolyexpr + | @isunionexpr + | @typescompexpr + | @builtinshufflevector + | @builtinconvertvector + | @builtinaddressof + | @istriviallyconstructibleexpr + | @isdestructibleexpr + | @isnothrowdestructibleexpr + | @istriviallydestructibleexpr + | @istriviallyassignableexpr + | @isnothrowassignableexpr + | @istrivialexpr + | @isstandardlayoutexpr + | @istriviallycopyableexpr + | @isliteraltypeexpr + | @hastrivialmoveconstructorexpr + | @hastrivialmoveassignexpr + | @hasnothrowmoveassignexpr + | @isconstructibleexpr + | @isnothrowconstructibleexpr + | @hasfinalizerexpr + | @isdelegateexpr + | @isinterfaceclassexpr + | @isrefarrayexpr + | @isrefclassexpr + | @issealedexpr + | @issimplevalueclassexpr + | @isvalueclassexpr + | @isfinalexpr + | @builtinchooseexpr + | @builtincomplex + | @isassignable + | @isaggregate + | @hasuniqueobjectrepresentations + | @builtinbitcast + | @builtinshuffle + | @issame + | @isfunction + | @islayoutcompatible + | @ispointerinterconvertiblebaseof + | @isarray + | @arrayrank + | @arrayextent + | @isarithmetic + | @iscompletetype + | @iscompound + | @isconst + | @isfloatingpoint + | @isfundamental + | @isintegral + | @islvaluereference + | @ismemberfunctionpointer + | @ismemberobjectpointer + | @ismemberpointer + | @isobject + | @ispointer + | @isreference + | @isrvaluereference + | @isscalar + | @issigned + | @isunsigned + | @isvoid + | @isvolatile + | @istriviallycopyassignable + | @isassignablenopreconditioncheck + | @referencebindstotemporary + | @issameas + | @builtinhasattribute + | @ispointerinterconvertiblewithclass + | @builtinispointerinterconvertiblewithclass + | @iscorrespondingmember + | @builtiniscorrespondingmember + | @isboundedarray + | @isunboundedarray + | @isreferenceable + | @isnothrowconvertible + | @referenceconstructsfromtemporary + | @referenceconvertsfromtemporary + | @isconvertible + | @isvalidwinrttype + | @iswinclass + | @iswininterface + | @istriviallyequalitycomparable + | @isscopedenum + | @istriviallyrelocatable + ; + +compound_requirement_is_noexcept( + int expr: @compound_requirement ref +); + +new_allocated_type( + unique int expr: @new_expr ref, + int type_id: @type ref +); + +new_array_allocated_type( + unique int expr: @new_array_expr ref, + int type_id: @type ref +); + +/** + * The field being initialized by an initializer expression within an aggregate + * initializer for a class/struct/union. Position is used to sort repeated initializers. + */ +#keyset[aggregate, position] +aggregate_field_init( + int aggregate: @aggregateliteral ref, + int initializer: @expr ref, + int field: @membervariable ref, + int position: int ref +); + +/** + * The index of the element being initialized by an initializer expression + * within an aggregate initializer for an array. Position is used to sort repeated initializers. + */ +#keyset[aggregate, position] +aggregate_array_init( + int aggregate: @aggregateliteral ref, + int initializer: @expr ref, + int element_index: int ref, + int position: int ref +); + +@ctorinit = @ctordirectinit + | @ctorvirtualinit + | @ctorfieldinit + | @ctordelegatinginit; +@dtordestruct = @dtordirectdestruct + | @dtorvirtualdestruct + | @dtorfielddestruct; + + +condition_decl_bind( + unique int expr: @condition_decl ref, + unique int decl: @declaration ref +); + +typeid_bind( + unique int expr: @type_id ref, + int type_id: @type ref +); + +uuidof_bind( + unique int expr: @uuidof ref, + int type_id: @type ref +); + +@runtime_sizeof_or_alignof = @runtime_sizeof | @runtime_alignof | @datasizeof; + +sizeof_bind( + unique int expr: @runtime_sizeof_or_alignof ref, + int type_id: @type ref +); + +code_block( + unique int block: @literal ref, + unique int routine: @function ref +); + +lambdas( + unique int expr: @lambdaexpr ref, + string default_capture: string ref, + boolean has_explicit_return_type: boolean ref +); + +lambda_capture( + unique int id: @lambdacapture, + int lambda: @lambdaexpr ref, + int index: int ref, + int field: @membervariable ref, + boolean captured_by_reference: boolean ref, + boolean is_implicit: boolean ref, + int location: @location_default ref +); + +@funbindexpr = @routineexpr + | @new_expr + | @delete_expr + | @delete_array_expr + | @ctordirectinit + | @ctorvirtualinit + | @ctordelegatinginit + | @dtordirectdestruct + | @dtorvirtualdestruct; + +@varbindexpr = @varaccess | @ctorfieldinit | @dtorfielddestruct; +@addressable = @function | @variable ; +@accessible = @addressable | @enumconstant ; + +@access = @varaccess | @routineexpr ; + +fold( + int expr: @foldexpr ref, + string operator: string ref, + boolean is_left_fold: boolean ref +); + +stmts( + unique int id: @stmt, + int kind: int ref, + int location: @location_stmt ref +); + +case @stmt.kind of + 1 = @stmt_expr +| 2 = @stmt_if +| 3 = @stmt_while +| 4 = @stmt_goto +| 5 = @stmt_label +| 6 = @stmt_return +| 7 = @stmt_block +| 8 = @stmt_end_test_while // do { ... } while ( ... ) +| 9 = @stmt_for +| 10 = @stmt_switch_case +| 11 = @stmt_switch +| 13 = @stmt_asm // "asm" statement or the body of an asm function +| 15 = @stmt_try_block +| 16 = @stmt_microsoft_try // Microsoft +| 17 = @stmt_decl +| 18 = @stmt_set_vla_size // C99 +| 19 = @stmt_vla_decl // C99 +| 25 = @stmt_assigned_goto // GNU +| 26 = @stmt_empty +| 27 = @stmt_continue +| 28 = @stmt_break +| 29 = @stmt_range_based_for // C++11 +// ... 30 @stmt_at_autoreleasepool_block deprecated +// ... 31 @stmt_objc_for_in deprecated +// ... 32 @stmt_at_synchronized deprecated +| 33 = @stmt_handler +// ... 34 @stmt_finally_end deprecated +| 35 = @stmt_constexpr_if +| 37 = @stmt_co_return +; + +type_vla( + int type_id: @type ref, + int decl: @stmt_vla_decl ref +); + +variable_vla( + int var: @variable ref, + int decl: @stmt_vla_decl ref +); + +if_initialization( + unique int if_stmt: @stmt_if ref, + int init_id: @stmt ref +); + +if_then( + unique int if_stmt: @stmt_if ref, + int then_id: @stmt ref +); + +if_else( + unique int if_stmt: @stmt_if ref, + int else_id: @stmt ref +); + +constexpr_if_initialization( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int init_id: @stmt ref +); + +constexpr_if_then( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int then_id: @stmt ref +); + +constexpr_if_else( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int else_id: @stmt ref +); + +while_body( + unique int while_stmt: @stmt_while ref, + int body_id: @stmt ref +); + +do_body( + unique int do_stmt: @stmt_end_test_while ref, + int body_id: @stmt ref +); + +switch_initialization( + unique int switch_stmt: @stmt_switch ref, + int init_id: @stmt ref +); + +#keyset[switch_stmt, index] +switch_case( + int switch_stmt: @stmt_switch ref, + int index: int ref, + int case_id: @stmt_switch_case ref +); + +switch_body( + unique int switch_stmt: @stmt_switch ref, + int body_id: @stmt ref +); + +@stmt_for_or_range_based_for = @stmt_for + | @stmt_range_based_for; + +for_initialization( + unique int for_stmt: @stmt_for_or_range_based_for ref, + int init_id: @stmt ref +); + +for_condition( + unique int for_stmt: @stmt_for ref, + int condition_id: @expr ref +); + +for_update( + unique int for_stmt: @stmt_for ref, + int update_id: @expr ref +); + +for_body( + unique int for_stmt: @stmt_for ref, + int body_id: @stmt ref +); + +@stmtparent = @stmt | @expr_stmt ; +stmtparents( + unique int id: @stmt ref, + int index: int ref, + int parent: @stmtparent ref +); + +ishandler(unique int block: @stmt_block ref); + +@cfgnode = @stmt | @expr | @function | @initialiser ; + +stmt_decl_bind( + int stmt: @stmt_decl ref, + int num: int ref, + int decl: @declaration ref +); + +stmt_decl_entry_bind( + int stmt: @stmt_decl ref, + int num: int ref, + int decl_entry: @element ref +); + +@parameterized_element = @function | @stmt_block | @requires_expr; + +blockscope( + unique int block: @stmt_block ref, + int enclosing: @parameterized_element ref +); + +@jump = @stmt_goto | @stmt_break | @stmt_continue; + +@jumporlabel = @jump | @stmt_label | @literal; + +jumpinfo( + unique int id: @jumporlabel ref, + string str: string ref, + int target: @stmt ref +); + +preprocdirects( + unique int id: @preprocdirect, + int kind: int ref, + int location: @location_default ref +); +case @preprocdirect.kind of + 0 = @ppd_if +| 1 = @ppd_ifdef +| 2 = @ppd_ifndef +| 3 = @ppd_elif +| 4 = @ppd_else +| 5 = @ppd_endif +| 6 = @ppd_plain_include +| 7 = @ppd_define +| 8 = @ppd_undef +| 9 = @ppd_line +| 10 = @ppd_error +| 11 = @ppd_pragma +| 12 = @ppd_objc_import +| 13 = @ppd_include_next +| 18 = @ppd_warning +; + +@ppd_include = @ppd_plain_include | @ppd_objc_import | @ppd_include_next; + +@ppd_branch = @ppd_if | @ppd_ifdef | @ppd_ifndef | @ppd_elif; + +preprocpair( + int begin : @ppd_branch ref, + int elseelifend : @preprocdirect ref +); + +preproctrue(int branch : @ppd_branch ref); +preprocfalse(int branch : @ppd_branch ref); + +preproctext( + unique int id: @preprocdirect ref, + string head: string ref, + string body: string ref +); + +includes( + unique int id: @ppd_include ref, + int included: @file ref +); + +link_targets( + int id: @link_target, + int binary: @file ref +); + +link_parent( + int element : @element ref, + int link_target : @link_target ref +); + +/* XML Files */ + +xmlEncoding(unique int id: @file ref, string encoding: string ref); + +xmlDTDs( + unique int id: @xmldtd, + string root: string ref, + string publicId: string ref, + string systemId: string ref, + int fileid: @file ref +); + +xmlElements( + unique int id: @xmlelement, + string name: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int fileid: @file ref +); + +xmlAttrs( + unique int id: @xmlattribute, + int elementid: @xmlelement ref, + string name: string ref, + string value: string ref, + int idx: int ref, + int fileid: @file ref +); + +xmlNs( + int id: @xmlnamespace, + string prefixName: string ref, + string URI: string ref, + int fileid: @file ref +); + +xmlHasNs( + int elementId: @xmlnamespaceable ref, + int nsId: @xmlnamespace ref, + int fileid: @file ref +); + +xmlComments( + unique int id: @xmlcomment, + string text: string ref, + int parentid: @xmlparent ref, + int fileid: @file ref +); + +xmlChars( + unique int id: @xmlcharacters, + string text: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int isCDATA: int ref, + int fileid: @file ref +); + +@xmlparent = @file | @xmlelement; +@xmlnamespaceable = @xmlelement | @xmlattribute; + +xmllocations( + int xmlElement: @xmllocatable ref, + int location: @location_default ref +); + +@xmllocatable = @xmlcharacters + | @xmlelement + | @xmlcomment + | @xmlattribute + | @xmldtd + | @file + | @xmlnamespace; diff --git a/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties b/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties new file mode 100644 index 00000000000..08e1dc42eb2 --- /dev/null +++ b/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties @@ -0,0 +1,2 @@ +description: Implement compilation_build_mode/2 +compatibility: backwards diff --git a/cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/old.dbscheme b/cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/old.dbscheme new file mode 100644 index 00000000000..e51fad7a243 --- /dev/null +++ b/cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/old.dbscheme @@ -0,0 +1,2323 @@ + +/** + * An invocation of the compiler. Note that more than one file may be + * compiled per invocation. For example, this command compiles three + * source files: + * + * gcc -c f1.c f2.c f3.c + * + * The `id` simply identifies the invocation, while `cwd` is the working + * directory from which the compiler was invoked. + */ +compilations( + /** + * An invocation of the compiler. Note that more than one file may + * be compiled per invocation. For example, this command compiles + * three source files: + * + * gcc -c f1.c f2.c f3.c + */ + unique int id : @compilation, + string cwd : string ref +); + +/** + * The arguments that were passed to the extractor for a compiler + * invocation. If `id` is for the compiler invocation + * + * gcc -c f1.c f2.c f3.c + * + * then typically there will be rows for + * + * num | arg + * --- | --- + * 0 | *path to extractor* + * 1 | `--mimic` + * 2 | `/usr/bin/gcc` + * 3 | `-c` + * 4 | f1.c + * 5 | f2.c + * 6 | f3.c + */ +#keyset[id, num] +compilation_args( + int id : @compilation ref, + int num : int ref, + string arg : string ref +); + +/** + * The source files that are compiled by a compiler invocation. + * If `id` is for the compiler invocation + * + * gcc -c f1.c f2.c f3.c + * + * then there will be rows for + * + * num | arg + * --- | --- + * 0 | f1.c + * 1 | f2.c + * 2 | f3.c + * + * Note that even if those files `#include` headers, those headers + * do not appear as rows. + */ +#keyset[id, num] +compilation_compiling_files( + int id : @compilation ref, + int num : int ref, + int file : @file ref +); + +/** + * The time taken by the extractor for a compiler invocation. + * + * For each file `num`, there will be rows for + * + * kind | seconds + * ---- | --- + * 1 | CPU seconds used by the extractor frontend + * 2 | Elapsed seconds during the extractor frontend + * 3 | CPU seconds used by the extractor backend + * 4 | Elapsed seconds during the extractor backend + */ +#keyset[id, num, kind] +compilation_time( + int id : @compilation ref, + int num : int ref, + /* kind: + 1 = frontend_cpu_seconds + 2 = frontend_elapsed_seconds + 3 = extractor_cpu_seconds + 4 = extractor_elapsed_seconds + */ + int kind : int ref, + float seconds : float ref +); + +/** + * An error or warning generated by the extractor. + * The diagnostic message `diagnostic` was generated during compiler + * invocation `compilation`, and is the `file_number_diagnostic_number`th + * message generated while extracting the `file_number`th file of that + * invocation. + */ +#keyset[compilation, file_number, file_number_diagnostic_number] +diagnostic_for( + int diagnostic : @diagnostic ref, + int compilation : @compilation ref, + int file_number : int ref, + int file_number_diagnostic_number : int ref +); + +/** + * If extraction was successful, then `cpu_seconds` and + * `elapsed_seconds` are the CPU time and elapsed time (respectively) + * that extraction took for compiler invocation `id`. + */ +compilation_finished( + unique int id : @compilation ref, + float cpu_seconds : float ref, + float elapsed_seconds : float ref +); + + +/** + * External data, loaded from CSV files during snapshot creation. See + * [Tutorial: Incorporating external data](https://help.semmle.com/wiki/display/SD/Tutorial%3A+Incorporating+external+data) + * for more information. + */ +externalData( + int id : @externalDataElement, + string path : string ref, + int column: int ref, + string value : string ref +); + +/** + * The source location of the snapshot. + */ +sourceLocationPrefix(string prefix : string ref); + +/** + * Information about packages that provide code used during compilation. + * The `id` is just a unique identifier. + * The `namespace` is typically the name of the package manager that + * provided the package (e.g. "dpkg" or "yum"). + * The `package_name` is the name of the package, and `version` is its + * version (as a string). + */ +external_packages( + unique int id: @external_package, + string namespace : string ref, + string package_name : string ref, + string version : string ref +); + +/** + * Holds if File `fileid` was provided by package `package`. + */ +header_to_external_package( + int fileid : @file ref, + int package : @external_package ref +); + +/* + * Version history + */ + +svnentries( + unique int id : @svnentry, + string revision : string ref, + string author : string ref, + date revisionDate : date ref, + int changeSize : int ref +) + +svnaffectedfiles( + int id : @svnentry ref, + int file : @file ref, + string action : string ref +) + +svnentrymsg( + unique int id : @svnentry ref, + string message : string ref +) + +svnchurn( + int commit : @svnentry ref, + int file : @file ref, + int addedLines : int ref, + int deletedLines : int ref +) + +/* + * C++ dbscheme + */ + +extractor_version( + string codeql_version: string ref, + string frontend_version: string ref +) + +@location = @location_stmt | @location_expr | @location_default ; + +/** + * The location of an element that is not an expression or a statement. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_default( + /** The location of an element that is not an expression or a statement. */ + unique int id: @location_default, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** + * The location of a statement. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_stmt( + /** The location of a statement. */ + unique int id: @location_stmt, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** + * The location of an expression. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_expr( + /** The location of an expression. */ + unique int id: @location_expr, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** An element for which line-count information is available. */ +@sourceline = @file | @function | @variable | @enumconstant | @xmllocatable; + +numlines( + int element_id: @sourceline ref, + int num_lines: int ref, + int num_code: int ref, + int num_comment: int ref +); + +diagnostics( + unique int id: @diagnostic, + int severity: int ref, + string error_tag: string ref, + string error_message: string ref, + string full_error_message: string ref, + int location: @location_default ref +); + +files( + unique int id: @file, + string name: string ref +); + +folders( + unique int id: @folder, + string name: string ref +); + +@container = @folder | @file + +containerparent( + int parent: @container ref, + unique int child: @container ref +); + +fileannotations( + int id: @file ref, + int kind: int ref, + string name: string ref, + string value: string ref +); + +inmacroexpansion( + int id: @element ref, + int inv: @macroinvocation ref +); + +affectedbymacroexpansion( + int id: @element ref, + int inv: @macroinvocation ref +); + +case @macroinvocation.kind of + 1 = @macro_expansion +| 2 = @other_macro_reference +; + +macroinvocations( + unique int id: @macroinvocation, + int macro_id: @ppd_define ref, + int location: @location_default ref, + int kind: int ref +); + +macroparent( + unique int id: @macroinvocation ref, + int parent_id: @macroinvocation ref +); + +// a macroinvocation may be part of another location +// the way to find a constant expression that uses a macro +// is thus to find a constant expression that has a location +// to which a macro invocation is bound +macrolocationbind( + int id: @macroinvocation ref, + int location: @location ref +); + +#keyset[invocation, argument_index] +macro_argument_unexpanded( + int invocation: @macroinvocation ref, + int argument_index: int ref, + string text: string ref +); + +#keyset[invocation, argument_index] +macro_argument_expanded( + int invocation: @macroinvocation ref, + int argument_index: int ref, + string text: string ref +); + +/* +case @function.kind of + 1 = @normal_function +| 2 = @constructor +| 3 = @destructor +| 4 = @conversion_function +| 5 = @operator +| 6 = @builtin_function // GCC built-in functions, e.g. __builtin___memcpy_chk +| 7 = @user_defined_literal +| 8 = @deduction_guide +; +*/ + +functions( + unique int id: @function, + string name: string ref, + int kind: int ref +); + +function_entry_point( + int id: @function ref, + unique int entry_point: @stmt ref +); + +function_return_type( + int id: @function ref, + int return_type: @type ref +); + +/** + * If `function` is a coroutine, then this gives the `std::experimental::resumable_traits` + * instance associated with it, and the variables representing the `handle` and `promise` + * for it. + */ +coroutine( + unique int function: @function ref, + int traits: @type ref +); + +/* +case @coroutine_placeholder_variable.kind of + 1 = @handle +| 2 = @promise +| 3 = @init_await_resume +; +*/ + +coroutine_placeholder_variable( + unique int placeholder_variable: @variable ref, + int kind: int ref, + int function: @function ref +) + +/** The `new` function used for allocating the coroutine state, if any. */ +coroutine_new( + unique int function: @function ref, + int new: @function ref +); + +/** The `delete` function used for deallocating the coroutine state, if any. */ +coroutine_delete( + unique int function: @function ref, + int delete: @function ref +); + +purefunctions(unique int id: @function ref); + +function_deleted(unique int id: @function ref); + +function_defaulted(unique int id: @function ref); + +function_prototyped(unique int id: @function ref) + +deduction_guide_for_class( + int id: @function ref, + int class_template: @usertype ref +) + +member_function_this_type( + unique int id: @function ref, + int this_type: @type ref +); + +#keyset[id, type_id] +fun_decls( + int id: @fun_decl, + int function: @function ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); +fun_def(unique int id: @fun_decl ref); +fun_specialized(unique int id: @fun_decl ref); +fun_implicit(unique int id: @fun_decl ref); +fun_decl_specifiers( + int id: @fun_decl ref, + string name: string ref +) +#keyset[fun_decl, index] +fun_decl_throws( + int fun_decl: @fun_decl ref, + int index: int ref, + int type_id: @type ref +); +/* an empty throw specification is different from none */ +fun_decl_empty_throws(unique int fun_decl: @fun_decl ref); +fun_decl_noexcept( + int fun_decl: @fun_decl ref, + int constant: @expr ref +); +fun_decl_empty_noexcept(int fun_decl: @fun_decl ref); +fun_decl_typedef_type( + unique int fun_decl: @fun_decl ref, + int typedeftype_id: @usertype ref +); + +param_decl_bind( + unique int id: @var_decl ref, + int index: int ref, + int fun_decl: @fun_decl ref +); + +#keyset[id, type_id] +var_decls( + int id: @var_decl, + int variable: @variable ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); +var_def(unique int id: @var_decl ref); +var_decl_specifiers( + int id: @var_decl ref, + string name: string ref +) +is_structured_binding(unique int id: @variable ref); + +type_decls( + unique int id: @type_decl, + int type_id: @type ref, + int location: @location_default ref +); +type_def(unique int id: @type_decl ref); +type_decl_top( + unique int type_decl: @type_decl ref +); + +namespace_decls( + unique int id: @namespace_decl, + int namespace_id: @namespace ref, + int location: @location_default ref, + int bodylocation: @location_default ref +); + +case @using.kind of + 1 = @using_declaration +| 2 = @using_directive +| 3 = @using_enum_declaration +; + +usings( + unique int id: @using, + int element_id: @element ref, + int location: @location_default ref, + int kind: int ref +); + +/** The element which contains the `using` declaration. */ +using_container( + int parent: @element ref, + int child: @using ref +); + +static_asserts( + unique int id: @static_assert, + int condition : @expr ref, + string message : string ref, + int location: @location_default ref, + int enclosing : @element ref +); + +// each function has an ordered list of parameters +#keyset[id, type_id] +#keyset[function, index, type_id] +params( + int id: @parameter, + int function: @parameterized_element ref, + int index: int ref, + int type_id: @type ref +); + +overrides( + int new: @function ref, + int old: @function ref +); + +#keyset[id, type_id] +membervariables( + int id: @membervariable, + int type_id: @type ref, + string name: string ref +); + +#keyset[id, type_id] +globalvariables( + int id: @globalvariable, + int type_id: @type ref, + string name: string ref +); + +#keyset[id, type_id] +localvariables( + int id: @localvariable, + int type_id: @type ref, + string name: string ref +); + +autoderivation( + unique int var: @variable ref, + int derivation_type: @type ref +); + +orphaned_variables( + int var: @localvariable ref, + int function: @function ref +) + +enumconstants( + unique int id: @enumconstant, + int parent: @usertype ref, + int index: int ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); + +@variable = @localscopevariable | @globalvariable | @membervariable; + +@localscopevariable = @localvariable | @parameter; + +/** + * Built-in types are the fundamental types, e.g., integral, floating, and void. + */ +case @builtintype.kind of + 1 = @errortype +| 2 = @unknowntype +| 3 = @void +| 4 = @boolean +| 5 = @char +| 6 = @unsigned_char +| 7 = @signed_char +| 8 = @short +| 9 = @unsigned_short +| 10 = @signed_short +| 11 = @int +| 12 = @unsigned_int +| 13 = @signed_int +| 14 = @long +| 15 = @unsigned_long +| 16 = @signed_long +| 17 = @long_long +| 18 = @unsigned_long_long +| 19 = @signed_long_long +// ... 20 Microsoft-specific __int8 +// ... 21 Microsoft-specific __int16 +// ... 22 Microsoft-specific __int32 +// ... 23 Microsoft-specific __int64 +| 24 = @float +| 25 = @double +| 26 = @long_double +| 27 = @complex_float // C99-specific _Complex float +| 28 = @complex_double // C99-specific _Complex double +| 29 = @complex_long_double // C99-specific _Complex long double +| 30 = @imaginary_float // C99-specific _Imaginary float +| 31 = @imaginary_double // C99-specific _Imaginary double +| 32 = @imaginary_long_double // C99-specific _Imaginary long double +| 33 = @wchar_t // Microsoft-specific +| 34 = @decltype_nullptr // C++11 +| 35 = @int128 // __int128 +| 36 = @unsigned_int128 // unsigned __int128 +| 37 = @signed_int128 // signed __int128 +| 38 = @float128 // __float128 +| 39 = @complex_float128 // _Complex __float128 +| 40 = @decimal32 // _Decimal32 +| 41 = @decimal64 // _Decimal64 +| 42 = @decimal128 // _Decimal128 +| 43 = @char16_t +| 44 = @char32_t +| 45 = @std_float32 // _Float32 +| 46 = @float32x // _Float32x +| 47 = @std_float64 // _Float64 +| 48 = @float64x // _Float64x +| 49 = @std_float128 // _Float128 +// ... 50 _Float128x +| 51 = @char8_t +| 52 = @float16 // _Float16 +| 53 = @complex_float16 // _Complex _Float16 +| 54 = @fp16 // __fp16 +| 55 = @std_bfloat16 // __bf16 +| 56 = @std_float16 // std::float16_t +| 57 = @complex_std_float32 // _Complex _Float32 +| 58 = @complex_float32x // _Complex _Float32x +| 59 = @complex_std_float64 // _Complex _Float64 +| 60 = @complex_float64x // _Complex _Float64x +| 61 = @complex_std_float128 // _Complex _Float128 +; + +builtintypes( + unique int id: @builtintype, + string name: string ref, + int kind: int ref, + int size: int ref, + int sign: int ref, + int alignment: int ref +); + +/** + * Derived types are types that are directly derived from existing types and + * point to, refer to, transform type data to return a new type. + */ +case @derivedtype.kind of + 1 = @pointer +| 2 = @reference +| 3 = @type_with_specifiers +| 4 = @array +| 5 = @gnu_vector +| 6 = @routineptr +| 7 = @routinereference +| 8 = @rvalue_reference // C++11 +// ... 9 type_conforming_to_protocols deprecated +| 10 = @block +; + +derivedtypes( + unique int id: @derivedtype, + string name: string ref, + int kind: int ref, + int type_id: @type ref +); + +pointerishsize(unique int id: @derivedtype ref, + int size: int ref, + int alignment: int ref); + +arraysizes( + unique int id: @derivedtype ref, + int num_elements: int ref, + int bytesize: int ref, + int alignment: int ref +); + +typedefbase( + unique int id: @usertype ref, + int type_id: @type ref +); + +/** + * An instance of the C++11 `decltype` operator. For example: + * ``` + * int a; + * decltype(1+a) b; + * ``` + * Here `expr` is `1+a`. + * + * Sometimes an additional pair of parentheses around the expression + * would change the semantics of this decltype, e.g. + * ``` + * struct A { double x; }; + * const A* a = new A(); + * decltype( a->x ); // type is double + * decltype((a->x)); // type is const double& + * ``` + * (Please consult the C++11 standard for more details). + * `parentheses_would_change_meaning` is `true` iff that is the case. + */ +#keyset[id, expr] +decltypes( + int id: @decltype, + int expr: @expr ref, + int base_type: @type ref, + boolean parentheses_would_change_meaning: boolean ref +); + +/* +case @usertype.kind of + 1 = @struct +| 2 = @class +| 3 = @union +| 4 = @enum +| 5 = @typedef // classic C: typedef typedef type name +| 6 = @template +| 7 = @template_parameter +| 8 = @template_template_parameter +| 9 = @proxy_class // a proxy class associated with a template parameter +// ... 10 objc_class deprecated +// ... 11 objc_protocol deprecated +// ... 12 objc_category deprecated +| 13 = @scoped_enum +| 14 = @using_alias // a using name = type style typedef +; +*/ + +usertypes( + unique int id: @usertype, + string name: string ref, + int kind: int ref +); + +usertypesize( + unique int id: @usertype ref, + int size: int ref, + int alignment: int ref +); + +usertype_final(unique int id: @usertype ref); + +usertype_uuid( + unique int id: @usertype ref, + string uuid: string ref +); + +mangled_name( + unique int id: @declaration ref, + int mangled_name : @mangledname, + boolean is_complete: boolean ref +); + +is_pod_class(unique int id: @usertype ref); +is_standard_layout_class(unique int id: @usertype ref); + +is_complete(unique int id: @usertype ref); + +is_class_template(unique int id: @usertype ref); +class_instantiation( + int to: @usertype ref, + int from: @usertype ref +); +class_template_argument( + int type_id: @usertype ref, + int index: int ref, + int arg_type: @type ref +); +class_template_argument_value( + int type_id: @usertype ref, + int index: int ref, + int arg_value: @expr ref +); + +is_proxy_class_for( + unique int id: @usertype ref, + unique int templ_param_id: @usertype ref +); + +type_mentions( + unique int id: @type_mention, + int type_id: @type ref, + int location: @location ref, + // a_symbol_reference_kind from the frontend. + int kind: int ref +); + +is_function_template(unique int id: @function ref); +function_instantiation( + unique int to: @function ref, + int from: @function ref +); +function_template_argument( + int function_id: @function ref, + int index: int ref, + int arg_type: @type ref +); +function_template_argument_value( + int function_id: @function ref, + int index: int ref, + int arg_value: @expr ref +); + +is_variable_template(unique int id: @variable ref); +variable_instantiation( + unique int to: @variable ref, + int from: @variable ref +); +variable_template_argument( + int variable_id: @variable ref, + int index: int ref, + int arg_type: @type ref +); +variable_template_argument_value( + int variable_id: @variable ref, + int index: int ref, + int arg_value: @expr ref +); + +routinetypes( + unique int id: @routinetype, + int return_type: @type ref +); + +routinetypeargs( + int routine: @routinetype ref, + int index: int ref, + int type_id: @type ref +); + +ptrtomembers( + unique int id: @ptrtomember, + int type_id: @type ref, + int class_id: @type ref +); + +/* + specifiers for types, functions, and variables + + "public", + "protected", + "private", + + "const", + "volatile", + "static", + + "pure", + "virtual", + "sealed", // Microsoft + "__interface", // Microsoft + "inline", + "explicit", + + "near", // near far extension + "far", // near far extension + "__ptr32", // Microsoft + "__ptr64", // Microsoft + "__sptr", // Microsoft + "__uptr", // Microsoft + "dllimport", // Microsoft + "dllexport", // Microsoft + "thread", // Microsoft + "naked", // Microsoft + "microsoft_inline", // Microsoft + "forceinline", // Microsoft + "selectany", // Microsoft + "nothrow", // Microsoft + "novtable", // Microsoft + "noreturn", // Microsoft + "noinline", // Microsoft + "noalias", // Microsoft + "restrict", // Microsoft +*/ + +specifiers( + unique int id: @specifier, + unique string str: string ref +); + +typespecifiers( + int type_id: @type ref, + int spec_id: @specifier ref +); + +funspecifiers( + int func_id: @function ref, + int spec_id: @specifier ref +); + +varspecifiers( + int var_id: @accessible ref, + int spec_id: @specifier ref +); + +explicit_specifier_exprs( + unique int func_id: @function ref, + int constant: @expr ref +) + +attributes( + unique int id: @attribute, + int kind: int ref, + string name: string ref, + string name_space: string ref, + int location: @location_default ref +); + +case @attribute.kind of + 0 = @gnuattribute +| 1 = @stdattribute +| 2 = @declspec +| 3 = @msattribute +| 4 = @alignas +// ... 5 @objc_propertyattribute deprecated +; + +attribute_args( + unique int id: @attribute_arg, + int kind: int ref, + int attribute: @attribute ref, + int index: int ref, + int location: @location_default ref +); + +case @attribute_arg.kind of + 0 = @attribute_arg_empty +| 1 = @attribute_arg_token +| 2 = @attribute_arg_constant +| 3 = @attribute_arg_type +| 4 = @attribute_arg_constant_expr +| 5 = @attribute_arg_expr +; + +attribute_arg_value( + unique int arg: @attribute_arg ref, + string value: string ref +); +attribute_arg_type( + unique int arg: @attribute_arg ref, + int type_id: @type ref +); +attribute_arg_constant( + unique int arg: @attribute_arg ref, + int constant: @expr ref +) +attribute_arg_expr( + unique int arg: @attribute_arg ref, + int expr: @expr ref +) +attribute_arg_name( + unique int arg: @attribute_arg ref, + string name: string ref +); + +typeattributes( + int type_id: @type ref, + int spec_id: @attribute ref +); + +funcattributes( + int func_id: @function ref, + int spec_id: @attribute ref +); + +varattributes( + int var_id: @accessible ref, + int spec_id: @attribute ref +); + +stmtattributes( + int stmt_id: @stmt ref, + int spec_id: @attribute ref +); + +@type = @builtintype + | @derivedtype + | @usertype + /* TODO | @fixedpointtype */ + | @routinetype + | @ptrtomember + | @decltype; + +unspecifiedtype( + unique int type_id: @type ref, + int unspecified_type_id: @type ref +); + +member( + int parent: @type ref, + int index: int ref, + int child: @member ref +); + +@enclosingfunction_child = @usertype | @variable | @namespace + +enclosingfunction( + unique int child: @enclosingfunction_child ref, + int parent: @function ref +); + +derivations( + unique int derivation: @derivation, + int sub: @type ref, + int index: int ref, + int super: @type ref, + int location: @location_default ref +); + +derspecifiers( + int der_id: @derivation ref, + int spec_id: @specifier ref +); + +/** + * Contains the byte offset of the base class subobject within the derived + * class. Only holds for non-virtual base classes, but see table + * `virtual_base_offsets` for offsets of virtual base class subobjects. + */ +direct_base_offsets( + unique int der_id: @derivation ref, + int offset: int ref +); + +/** + * Contains the byte offset of the virtual base class subobject for class + * `super` within a most-derived object of class `sub`. `super` can be either a + * direct or indirect base class. + */ +#keyset[sub, super] +virtual_base_offsets( + int sub: @usertype ref, + int super: @usertype ref, + int offset: int ref +); + +frienddecls( + unique int id: @frienddecl, + int type_id: @type ref, + int decl_id: @declaration ref, + int location: @location_default ref +); + +@declaredtype = @usertype ; + +@declaration = @function + | @declaredtype + | @variable + | @enumconstant + | @frienddecl; + +@member = @membervariable + | @function + | @declaredtype + | @enumconstant; + +@locatable = @diagnostic + | @declaration + | @ppd_include + | @ppd_define + | @macroinvocation + /*| @funcall*/ + | @xmllocatable + | @attribute + | @attribute_arg; + +@namedscope = @namespace | @usertype; + +@element = @locatable + | @file + | @folder + | @specifier + | @type + | @expr + | @namespace + | @initialiser + | @stmt + | @derivation + | @comment + | @preprocdirect + | @fun_decl + | @var_decl + | @type_decl + | @namespace_decl + | @using + | @namequalifier + | @specialnamequalifyingelement + | @static_assert + | @type_mention + | @lambdacapture; + +@exprparent = @element; + +comments( + unique int id: @comment, + string contents: string ref, + int location: @location_default ref +); + +commentbinding( + int id: @comment ref, + int element: @element ref +); + +exprconv( + int converted: @expr ref, + unique int conversion: @expr ref +); + +compgenerated(unique int id: @element ref); + +/** + * `destructor_call` destructs the `i`'th entity that should be + * destructed following `element`. Note that entities should be + * destructed in reverse construction order, so for a given `element` + * these should be called from highest to lowest `i`. + */ +#keyset[element, destructor_call] +#keyset[element, i] +synthetic_destructor_call( + int element: @element ref, + int i: int ref, + int destructor_call: @routineexpr ref +); + +namespaces( + unique int id: @namespace, + string name: string ref +); + +namespace_inline( + unique int id: @namespace ref +); + +namespacembrs( + int parentid: @namespace ref, + unique int memberid: @namespacembr ref +); + +@namespacembr = @declaration | @namespace; + +exprparents( + int expr_id: @expr ref, + int child_index: int ref, + int parent_id: @exprparent ref +); + +expr_isload(unique int expr_id: @expr ref); + +@cast = @c_style_cast + | @const_cast + | @dynamic_cast + | @reinterpret_cast + | @static_cast + ; + +/* +case @conversion.kind of + 0 = @simple_conversion // a numeric conversion, qualification conversion, or a reinterpret_cast +| 1 = @bool_conversion // conversion to 'bool' +| 2 = @base_class_conversion // a derived-to-base conversion +| 3 = @derived_class_conversion // a base-to-derived conversion +| 4 = @pm_base_class_conversion // a derived-to-base conversion of a pointer to member +| 5 = @pm_derived_class_conversion // a base-to-derived conversion of a pointer to member +| 6 = @glvalue_adjust // an adjustment of the type of a glvalue +| 7 = @prvalue_adjust // an adjustment of the type of a prvalue +; +*/ +/** + * Describes the semantics represented by a cast expression. This is largely + * independent of the source syntax of the cast, so it is separate from the + * regular expression kind. + */ +conversionkinds( + unique int expr_id: @cast ref, + int kind: int ref +); + +@conversion = @cast + | @array_to_pointer + | @parexpr + | @reference_to + | @ref_indirect + | @temp_init + | @c11_generic + ; + +/* +case @funbindexpr.kind of + 0 = @normal_call // a normal call +| 1 = @virtual_call // a virtual call +| 2 = @adl_call // a call whose target is only found by ADL +; +*/ +iscall( + unique int caller: @funbindexpr ref, + int kind: int ref +); + +numtemplatearguments( + unique int expr_id: @expr ref, + int num: int ref +); + +specialnamequalifyingelements( + unique int id: @specialnamequalifyingelement, + unique string name: string ref +); + +@namequalifiableelement = @expr | @namequalifier; +@namequalifyingelement = @namespace + | @specialnamequalifyingelement + | @usertype; + +namequalifiers( + unique int id: @namequalifier, + unique int qualifiableelement: @namequalifiableelement ref, + int qualifyingelement: @namequalifyingelement ref, + int location: @location_default ref +); + +varbind( + int expr: @varbindexpr ref, + int var: @accessible ref +); + +funbind( + int expr: @funbindexpr ref, + int fun: @function ref +); + +@any_new_expr = @new_expr + | @new_array_expr; + +@new_or_delete_expr = @any_new_expr + | @delete_expr + | @delete_array_expr; + +@prefix_crement_expr = @preincrexpr | @predecrexpr; + +@postfix_crement_expr = @postincrexpr | @postdecrexpr; + +@increment_expr = @preincrexpr | @postincrexpr; + +@decrement_expr = @predecrexpr | @postdecrexpr; + +@crement_expr = @increment_expr | @decrement_expr; + +@un_arith_op_expr = @arithnegexpr + | @unaryplusexpr + | @conjugation + | @realpartexpr + | @imagpartexpr + | @crement_expr + ; + +@un_bitwise_op_expr = @complementexpr; + +@un_log_op_expr = @notexpr; + +@un_op_expr = @address_of + | @indirect + | @un_arith_op_expr + | @un_bitwise_op_expr + | @builtinaddressof + | @vec_fill + | @un_log_op_expr + | @co_await + | @co_yield + ; + +@bin_log_op_expr = @andlogicalexpr | @orlogicalexpr; + +@cmp_op_expr = @eq_op_expr | @rel_op_expr; + +@eq_op_expr = @eqexpr | @neexpr; + +@rel_op_expr = @gtexpr + | @ltexpr + | @geexpr + | @leexpr + | @spaceshipexpr + ; + +@bin_bitwise_op_expr = @lshiftexpr + | @rshiftexpr + | @andexpr + | @orexpr + | @xorexpr + ; + +@p_arith_op_expr = @paddexpr + | @psubexpr + | @pdiffexpr + ; + +@bin_arith_op_expr = @addexpr + | @subexpr + | @mulexpr + | @divexpr + | @remexpr + | @jmulexpr + | @jdivexpr + | @fjaddexpr + | @jfaddexpr + | @fjsubexpr + | @jfsubexpr + | @minexpr + | @maxexpr + | @p_arith_op_expr + ; + +@bin_op_expr = @bin_arith_op_expr + | @bin_bitwise_op_expr + | @cmp_op_expr + | @bin_log_op_expr + ; + +@op_expr = @un_op_expr + | @bin_op_expr + | @assign_expr + | @conditionalexpr + ; + +@assign_arith_expr = @assignaddexpr + | @assignsubexpr + | @assignmulexpr + | @assigndivexpr + | @assignremexpr + ; + +@assign_bitwise_expr = @assignandexpr + | @assignorexpr + | @assignxorexpr + | @assignlshiftexpr + | @assignrshiftexpr + ; + +@assign_pointer_expr = @assignpaddexpr + | @assignpsubexpr + ; + +@assign_op_expr = @assign_arith_expr + | @assign_bitwise_expr + | @assign_pointer_expr + ; + +@assign_expr = @assignexpr | @assign_op_expr | @blockassignexpr + +/* + Binary encoding of the allocator form. + + case @allocator.form of + 0 = plain + | 1 = alignment + ; +*/ + +/** + * The allocator function associated with a `new` or `new[]` expression. + * The `form` column specified whether the allocation call contains an alignment + * argument. + */ +expr_allocator( + unique int expr: @any_new_expr ref, + int func: @function ref, + int form: int ref +); + +/* + Binary encoding of the deallocator form. + + case @deallocator.form of + 0 = plain + | 1 = size + | 2 = alignment + | 4 = destroying_delete + ; +*/ + +/** + * The deallocator function associated with a `delete`, `delete[]`, `new`, or + * `new[]` expression. For a `new` or `new[]` expression, the deallocator is the + * one used to free memory if the initialization throws an exception. + * The `form` column specifies whether the deallocation call contains a size + * argument, and alignment argument, or both. + */ +expr_deallocator( + unique int expr: @new_or_delete_expr ref, + int func: @function ref, + int form: int ref +); + +/** + * Holds if the `@conditionalexpr` is of the two operand form + * `guard ? : false`. + */ +expr_cond_two_operand( + unique int cond: @conditionalexpr ref +); + +/** + * The guard of `@conditionalexpr` `guard ? true : false` + */ +expr_cond_guard( + unique int cond: @conditionalexpr ref, + int guard: @expr ref +); + +/** + * The expression used when the guard of `@conditionalexpr` + * `guard ? true : false` holds. For the two operand form + * `guard ?: false` consider using `expr_cond_guard` instead. + */ +expr_cond_true( + unique int cond: @conditionalexpr ref, + int true: @expr ref +); + +/** + * The expression used when the guard of `@conditionalexpr` + * `guard ? true : false` does not hold. + */ +expr_cond_false( + unique int cond: @conditionalexpr ref, + int false: @expr ref +); + +/** A string representation of the value. */ +values( + unique int id: @value, + string str: string ref +); + +/** The actual text in the source code for the value, if any. */ +valuetext( + unique int id: @value ref, + string text: string ref +); + +valuebind( + int val: @value ref, + unique int expr: @expr ref +); + +fieldoffsets( + unique int id: @variable ref, + int byteoffset: int ref, + int bitoffset: int ref +); + +bitfield( + unique int id: @variable ref, + int bits: int ref, + int declared_bits: int ref +); + +/* TODO +memberprefix( + int member: @expr ref, + int prefix: @expr ref +); +*/ + +/* + kind(1) = mbrcallexpr + kind(2) = mbrptrcallexpr + kind(3) = mbrptrmbrcallexpr + kind(4) = ptrmbrptrmbrcallexpr + kind(5) = mbrreadexpr // x.y + kind(6) = mbrptrreadexpr // p->y + kind(7) = mbrptrmbrreadexpr // x.*pm + kind(8) = mbrptrmbrptrreadexpr // x->*pm + kind(9) = staticmbrreadexpr // static x.y + kind(10) = staticmbrptrreadexpr // static p->y +*/ +/* TODO +memberaccess( + int member: @expr ref, + int kind: int ref +); +*/ + +initialisers( + unique int init: @initialiser, + int var: @accessible ref, + unique int expr: @expr ref, + int location: @location_expr ref +); + +braced_initialisers( + int init: @initialiser ref +); + +/** + * An ancestor for the expression, for cases in which we cannot + * otherwise find the expression's parent. + */ +expr_ancestor( + int exp: @expr ref, + int ancestor: @element ref +); + +exprs( + unique int id: @expr, + int kind: int ref, + int location: @location_expr ref +); + +expr_reuse( + int reuse: @expr ref, + int original: @expr ref, + int value_category: int ref +) + +/* + case @value.category of + 1 = prval + | 2 = xval + | 3 = lval + ; +*/ +expr_types( + int id: @expr ref, + int typeid: @type ref, + int value_category: int ref +); + +case @expr.kind of + 1 = @errorexpr +| 2 = @address_of // & AddressOfExpr +| 3 = @reference_to // ReferenceToExpr (implicit?) +| 4 = @indirect // * PointerDereferenceExpr +| 5 = @ref_indirect // ReferenceDereferenceExpr (implicit?) +// ... +| 8 = @array_to_pointer // (???) +| 9 = @vacuous_destructor_call // VacuousDestructorCall +// ... +| 11 = @assume // Microsoft +| 12 = @parexpr +| 13 = @arithnegexpr +| 14 = @unaryplusexpr +| 15 = @complementexpr +| 16 = @notexpr +| 17 = @conjugation // GNU ~ operator +| 18 = @realpartexpr // GNU __real +| 19 = @imagpartexpr // GNU __imag +| 20 = @postincrexpr +| 21 = @postdecrexpr +| 22 = @preincrexpr +| 23 = @predecrexpr +| 24 = @conditionalexpr +| 25 = @addexpr +| 26 = @subexpr +| 27 = @mulexpr +| 28 = @divexpr +| 29 = @remexpr +| 30 = @jmulexpr // C99 mul imaginary +| 31 = @jdivexpr // C99 div imaginary +| 32 = @fjaddexpr // C99 add real + imaginary +| 33 = @jfaddexpr // C99 add imaginary + real +| 34 = @fjsubexpr // C99 sub real - imaginary +| 35 = @jfsubexpr // C99 sub imaginary - real +| 36 = @paddexpr // pointer add (pointer + int or int + pointer) +| 37 = @psubexpr // pointer sub (pointer - integer) +| 38 = @pdiffexpr // difference between two pointers +| 39 = @lshiftexpr +| 40 = @rshiftexpr +| 41 = @andexpr +| 42 = @orexpr +| 43 = @xorexpr +| 44 = @eqexpr +| 45 = @neexpr +| 46 = @gtexpr +| 47 = @ltexpr +| 48 = @geexpr +| 49 = @leexpr +| 50 = @minexpr // GNU minimum +| 51 = @maxexpr // GNU maximum +| 52 = @assignexpr +| 53 = @assignaddexpr +| 54 = @assignsubexpr +| 55 = @assignmulexpr +| 56 = @assigndivexpr +| 57 = @assignremexpr +| 58 = @assignlshiftexpr +| 59 = @assignrshiftexpr +| 60 = @assignandexpr +| 61 = @assignorexpr +| 62 = @assignxorexpr +| 63 = @assignpaddexpr // assign pointer add +| 64 = @assignpsubexpr // assign pointer sub +| 65 = @andlogicalexpr +| 66 = @orlogicalexpr +| 67 = @commaexpr +| 68 = @subscriptexpr // access to member of an array, e.g., a[5] +// ... 69 @objc_subscriptexpr deprecated +// ... 70 @cmdaccess deprecated +// ... +| 73 = @virtfunptrexpr +| 74 = @callexpr +// ... 75 @msgexpr_normal deprecated +// ... 76 @msgexpr_super deprecated +// ... 77 @atselectorexpr deprecated +// ... 78 @atprotocolexpr deprecated +| 79 = @vastartexpr +| 80 = @vaargexpr +| 81 = @vaendexpr +| 82 = @vacopyexpr +// ... 83 @atencodeexpr deprecated +| 84 = @varaccess +| 85 = @thisaccess +// ... 86 @objc_box_expr deprecated +| 87 = @new_expr +| 88 = @delete_expr +| 89 = @throw_expr +| 90 = @condition_decl // a variable declared in a condition, e.g., if(int x = y > 2) +| 91 = @braced_init_list +| 92 = @type_id +| 93 = @runtime_sizeof +| 94 = @runtime_alignof +| 95 = @sizeof_pack +| 96 = @expr_stmt // GNU extension +| 97 = @routineexpr +| 98 = @type_operand // used to access a type in certain contexts (haven't found any examples yet....) +| 99 = @offsetofexpr // offsetof ::= type and field +| 100 = @hasassignexpr // __has_assign ::= type +| 101 = @hascopyexpr // __has_copy ::= type +| 102 = @hasnothrowassign // __has_nothrow_assign ::= type +| 103 = @hasnothrowconstr // __has_nothrow_constructor ::= type +| 104 = @hasnothrowcopy // __has_nothrow_copy ::= type +| 105 = @hastrivialassign // __has_trivial_assign ::= type +| 106 = @hastrivialconstr // __has_trivial_constructor ::= type +| 107 = @hastrivialcopy // __has_trivial_copy ::= type +| 108 = @hasuserdestr // __has_user_destructor ::= type +| 109 = @hasvirtualdestr // __has_virtual_destructor ::= type +| 110 = @isabstractexpr // __is_abstract ::= type +| 111 = @isbaseofexpr // __is_base_of ::= type type +| 112 = @isclassexpr // __is_class ::= type +| 113 = @isconvtoexpr // __is_convertible_to ::= type type +| 114 = @isemptyexpr // __is_empty ::= type +| 115 = @isenumexpr // __is_enum ::= type +| 116 = @ispodexpr // __is_pod ::= type +| 117 = @ispolyexpr // __is_polymorphic ::= type +| 118 = @isunionexpr // __is_union ::= type +| 119 = @typescompexpr // GNU __builtin_types_compatible ::= type type +| 120 = @intaddrexpr // frontend internal builtin, used to implement offsetof +// ... +| 122 = @hastrivialdestructor // __has_trivial_destructor ::= type +| 123 = @literal +| 124 = @uuidof +| 127 = @aggregateliteral +| 128 = @delete_array_expr +| 129 = @new_array_expr +// ... 130 @objc_array_literal deprecated +// ... 131 @objc_dictionary_literal deprecated +| 132 = @foldexpr +// ... +| 200 = @ctordirectinit +| 201 = @ctorvirtualinit +| 202 = @ctorfieldinit +| 203 = @ctordelegatinginit +| 204 = @dtordirectdestruct +| 205 = @dtorvirtualdestruct +| 206 = @dtorfielddestruct +// ... +| 210 = @static_cast +| 211 = @reinterpret_cast +| 212 = @const_cast +| 213 = @dynamic_cast +| 214 = @c_style_cast +| 215 = @lambdaexpr +| 216 = @param_ref +| 217 = @noopexpr +// ... +| 294 = @istriviallyconstructibleexpr +| 295 = @isdestructibleexpr +| 296 = @isnothrowdestructibleexpr +| 297 = @istriviallydestructibleexpr +| 298 = @istriviallyassignableexpr +| 299 = @isnothrowassignableexpr +| 300 = @istrivialexpr +| 301 = @isstandardlayoutexpr +| 302 = @istriviallycopyableexpr +| 303 = @isliteraltypeexpr +| 304 = @hastrivialmoveconstructorexpr +| 305 = @hastrivialmoveassignexpr +| 306 = @hasnothrowmoveassignexpr +| 307 = @isconstructibleexpr +| 308 = @isnothrowconstructibleexpr +| 309 = @hasfinalizerexpr +| 310 = @isdelegateexpr +| 311 = @isinterfaceclassexpr +| 312 = @isrefarrayexpr +| 313 = @isrefclassexpr +| 314 = @issealedexpr +| 315 = @issimplevalueclassexpr +| 316 = @isvalueclassexpr +| 317 = @isfinalexpr +| 319 = @noexceptexpr +| 320 = @builtinshufflevector +| 321 = @builtinchooseexpr +| 322 = @builtinaddressof +| 323 = @vec_fill +| 324 = @builtinconvertvector +| 325 = @builtincomplex +| 326 = @spaceshipexpr +| 327 = @co_await +| 328 = @co_yield +| 329 = @temp_init +| 330 = @isassignable +| 331 = @isaggregate +| 332 = @hasuniqueobjectrepresentations +| 333 = @builtinbitcast +| 334 = @builtinshuffle +| 335 = @blockassignexpr +| 336 = @issame +| 337 = @isfunction +| 338 = @islayoutcompatible +| 339 = @ispointerinterconvertiblebaseof +| 340 = @isarray +| 341 = @arrayrank +| 342 = @arrayextent +| 343 = @isarithmetic +| 344 = @iscompletetype +| 345 = @iscompound +| 346 = @isconst +| 347 = @isfloatingpoint +| 348 = @isfundamental +| 349 = @isintegral +| 350 = @islvaluereference +| 351 = @ismemberfunctionpointer +| 352 = @ismemberobjectpointer +| 353 = @ismemberpointer +| 354 = @isobject +| 355 = @ispointer +| 356 = @isreference +| 357 = @isrvaluereference +| 358 = @isscalar +| 359 = @issigned +| 360 = @isunsigned +| 361 = @isvoid +| 362 = @isvolatile +| 363 = @reuseexpr +| 364 = @istriviallycopyassignable +| 365 = @isassignablenopreconditioncheck +| 366 = @referencebindstotemporary +| 367 = @issameas +| 368 = @builtinhasattribute +| 369 = @ispointerinterconvertiblewithclass +| 370 = @builtinispointerinterconvertiblewithclass +| 371 = @iscorrespondingmember +| 372 = @builtiniscorrespondingmember +| 373 = @isboundedarray +| 374 = @isunboundedarray +| 375 = @isreferenceable +| 378 = @isnothrowconvertible +| 379 = @referenceconstructsfromtemporary +| 380 = @referenceconvertsfromtemporary +| 381 = @isconvertible +| 382 = @isvalidwinrttype +| 383 = @iswinclass +| 384 = @iswininterface +| 385 = @istriviallyequalitycomparable +| 386 = @isscopedenum +| 387 = @istriviallyrelocatable +| 388 = @datasizeof +| 389 = @c11_generic +| 390 = @requires_expr +| 391 = @nested_requirement +| 392 = @compound_requirement +| 393 = @concept_id +; + +@var_args_expr = @vastartexpr + | @vaendexpr + | @vaargexpr + | @vacopyexpr + ; + +@builtin_op = @var_args_expr + | @noopexpr + | @offsetofexpr + | @intaddrexpr + | @hasassignexpr + | @hascopyexpr + | @hasnothrowassign + | @hasnothrowconstr + | @hasnothrowcopy + | @hastrivialassign + | @hastrivialconstr + | @hastrivialcopy + | @hastrivialdestructor + | @hasuserdestr + | @hasvirtualdestr + | @isabstractexpr + | @isbaseofexpr + | @isclassexpr + | @isconvtoexpr + | @isemptyexpr + | @isenumexpr + | @ispodexpr + | @ispolyexpr + | @isunionexpr + | @typescompexpr + | @builtinshufflevector + | @builtinconvertvector + | @builtinaddressof + | @istriviallyconstructibleexpr + | @isdestructibleexpr + | @isnothrowdestructibleexpr + | @istriviallydestructibleexpr + | @istriviallyassignableexpr + | @isnothrowassignableexpr + | @istrivialexpr + | @isstandardlayoutexpr + | @istriviallycopyableexpr + | @isliteraltypeexpr + | @hastrivialmoveconstructorexpr + | @hastrivialmoveassignexpr + | @hasnothrowmoveassignexpr + | @isconstructibleexpr + | @isnothrowconstructibleexpr + | @hasfinalizerexpr + | @isdelegateexpr + | @isinterfaceclassexpr + | @isrefarrayexpr + | @isrefclassexpr + | @issealedexpr + | @issimplevalueclassexpr + | @isvalueclassexpr + | @isfinalexpr + | @builtinchooseexpr + | @builtincomplex + | @isassignable + | @isaggregate + | @hasuniqueobjectrepresentations + | @builtinbitcast + | @builtinshuffle + | @issame + | @isfunction + | @islayoutcompatible + | @ispointerinterconvertiblebaseof + | @isarray + | @arrayrank + | @arrayextent + | @isarithmetic + | @iscompletetype + | @iscompound + | @isconst + | @isfloatingpoint + | @isfundamental + | @isintegral + | @islvaluereference + | @ismemberfunctionpointer + | @ismemberobjectpointer + | @ismemberpointer + | @isobject + | @ispointer + | @isreference + | @isrvaluereference + | @isscalar + | @issigned + | @isunsigned + | @isvoid + | @isvolatile + | @istriviallycopyassignable + | @isassignablenopreconditioncheck + | @referencebindstotemporary + | @issameas + | @builtinhasattribute + | @ispointerinterconvertiblewithclass + | @builtinispointerinterconvertiblewithclass + | @iscorrespondingmember + | @builtiniscorrespondingmember + | @isboundedarray + | @isunboundedarray + | @isreferenceable + | @isnothrowconvertible + | @referenceconstructsfromtemporary + | @referenceconvertsfromtemporary + | @isconvertible + | @isvalidwinrttype + | @iswinclass + | @iswininterface + | @istriviallyequalitycomparable + | @isscopedenum + | @istriviallyrelocatable + ; + +compound_requirement_is_noexcept( + int expr: @compound_requirement ref +); + +new_allocated_type( + unique int expr: @new_expr ref, + int type_id: @type ref +); + +new_array_allocated_type( + unique int expr: @new_array_expr ref, + int type_id: @type ref +); + +/** + * The field being initialized by an initializer expression within an aggregate + * initializer for a class/struct/union. Position is used to sort repeated initializers. + */ +#keyset[aggregate, position] +aggregate_field_init( + int aggregate: @aggregateliteral ref, + int initializer: @expr ref, + int field: @membervariable ref, + int position: int ref +); + +/** + * The index of the element being initialized by an initializer expression + * within an aggregate initializer for an array. Position is used to sort repeated initializers. + */ +#keyset[aggregate, position] +aggregate_array_init( + int aggregate: @aggregateliteral ref, + int initializer: @expr ref, + int element_index: int ref, + int position: int ref +); + +@ctorinit = @ctordirectinit + | @ctorvirtualinit + | @ctorfieldinit + | @ctordelegatinginit; +@dtordestruct = @dtordirectdestruct + | @dtorvirtualdestruct + | @dtorfielddestruct; + + +condition_decl_bind( + unique int expr: @condition_decl ref, + unique int decl: @declaration ref +); + +typeid_bind( + unique int expr: @type_id ref, + int type_id: @type ref +); + +uuidof_bind( + unique int expr: @uuidof ref, + int type_id: @type ref +); + +@runtime_sizeof_or_alignof = @runtime_sizeof | @runtime_alignof | @datasizeof; + +sizeof_bind( + unique int expr: @runtime_sizeof_or_alignof ref, + int type_id: @type ref +); + +code_block( + unique int block: @literal ref, + unique int routine: @function ref +); + +lambdas( + unique int expr: @lambdaexpr ref, + string default_capture: string ref, + boolean has_explicit_return_type: boolean ref +); + +lambda_capture( + unique int id: @lambdacapture, + int lambda: @lambdaexpr ref, + int index: int ref, + int field: @membervariable ref, + boolean captured_by_reference: boolean ref, + boolean is_implicit: boolean ref, + int location: @location_default ref +); + +@funbindexpr = @routineexpr + | @new_expr + | @delete_expr + | @delete_array_expr + | @ctordirectinit + | @ctorvirtualinit + | @ctordelegatinginit + | @dtordirectdestruct + | @dtorvirtualdestruct; + +@varbindexpr = @varaccess | @ctorfieldinit | @dtorfielddestruct; +@addressable = @function | @variable ; +@accessible = @addressable | @enumconstant ; + +@access = @varaccess | @routineexpr ; + +fold( + int expr: @foldexpr ref, + string operator: string ref, + boolean is_left_fold: boolean ref +); + +stmts( + unique int id: @stmt, + int kind: int ref, + int location: @location_stmt ref +); + +case @stmt.kind of + 1 = @stmt_expr +| 2 = @stmt_if +| 3 = @stmt_while +| 4 = @stmt_goto +| 5 = @stmt_label +| 6 = @stmt_return +| 7 = @stmt_block +| 8 = @stmt_end_test_while // do { ... } while ( ... ) +| 9 = @stmt_for +| 10 = @stmt_switch_case +| 11 = @stmt_switch +| 13 = @stmt_asm // "asm" statement or the body of an asm function +| 15 = @stmt_try_block +| 16 = @stmt_microsoft_try // Microsoft +| 17 = @stmt_decl +| 18 = @stmt_set_vla_size // C99 +| 19 = @stmt_vla_decl // C99 +| 25 = @stmt_assigned_goto // GNU +| 26 = @stmt_empty +| 27 = @stmt_continue +| 28 = @stmt_break +| 29 = @stmt_range_based_for // C++11 +// ... 30 @stmt_at_autoreleasepool_block deprecated +// ... 31 @stmt_objc_for_in deprecated +// ... 32 @stmt_at_synchronized deprecated +| 33 = @stmt_handler +// ... 34 @stmt_finally_end deprecated +| 35 = @stmt_constexpr_if +| 37 = @stmt_co_return +; + +type_vla( + int type_id: @type ref, + int decl: @stmt_vla_decl ref +); + +variable_vla( + int var: @variable ref, + int decl: @stmt_vla_decl ref +); + +if_initialization( + unique int if_stmt: @stmt_if ref, + int init_id: @stmt ref +); + +if_then( + unique int if_stmt: @stmt_if ref, + int then_id: @stmt ref +); + +if_else( + unique int if_stmt: @stmt_if ref, + int else_id: @stmt ref +); + +constexpr_if_initialization( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int init_id: @stmt ref +); + +constexpr_if_then( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int then_id: @stmt ref +); + +constexpr_if_else( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int else_id: @stmt ref +); + +while_body( + unique int while_stmt: @stmt_while ref, + int body_id: @stmt ref +); + +do_body( + unique int do_stmt: @stmt_end_test_while ref, + int body_id: @stmt ref +); + +switch_initialization( + unique int switch_stmt: @stmt_switch ref, + int init_id: @stmt ref +); + +#keyset[switch_stmt, index] +switch_case( + int switch_stmt: @stmt_switch ref, + int index: int ref, + int case_id: @stmt_switch_case ref +); + +switch_body( + unique int switch_stmt: @stmt_switch ref, + int body_id: @stmt ref +); + +@stmt_for_or_range_based_for = @stmt_for + | @stmt_range_based_for; + +for_initialization( + unique int for_stmt: @stmt_for_or_range_based_for ref, + int init_id: @stmt ref +); + +for_condition( + unique int for_stmt: @stmt_for ref, + int condition_id: @expr ref +); + +for_update( + unique int for_stmt: @stmt_for ref, + int update_id: @expr ref +); + +for_body( + unique int for_stmt: @stmt_for ref, + int body_id: @stmt ref +); + +@stmtparent = @stmt | @expr_stmt ; +stmtparents( + unique int id: @stmt ref, + int index: int ref, + int parent: @stmtparent ref +); + +ishandler(unique int block: @stmt_block ref); + +@cfgnode = @stmt | @expr | @function | @initialiser ; + +stmt_decl_bind( + int stmt: @stmt_decl ref, + int num: int ref, + int decl: @declaration ref +); + +stmt_decl_entry_bind( + int stmt: @stmt_decl ref, + int num: int ref, + int decl_entry: @element ref +); + +@parameterized_element = @function | @stmt_block | @requires_expr; + +blockscope( + unique int block: @stmt_block ref, + int enclosing: @parameterized_element ref +); + +@jump = @stmt_goto | @stmt_break | @stmt_continue; + +@jumporlabel = @jump | @stmt_label | @literal; + +jumpinfo( + unique int id: @jumporlabel ref, + string str: string ref, + int target: @stmt ref +); + +preprocdirects( + unique int id: @preprocdirect, + int kind: int ref, + int location: @location_default ref +); +case @preprocdirect.kind of + 0 = @ppd_if +| 1 = @ppd_ifdef +| 2 = @ppd_ifndef +| 3 = @ppd_elif +| 4 = @ppd_else +| 5 = @ppd_endif +| 6 = @ppd_plain_include +| 7 = @ppd_define +| 8 = @ppd_undef +| 9 = @ppd_line +| 10 = @ppd_error +| 11 = @ppd_pragma +| 12 = @ppd_objc_import +| 13 = @ppd_include_next +| 18 = @ppd_warning +; + +@ppd_include = @ppd_plain_include | @ppd_objc_import | @ppd_include_next; + +@ppd_branch = @ppd_if | @ppd_ifdef | @ppd_ifndef | @ppd_elif; + +preprocpair( + int begin : @ppd_branch ref, + int elseelifend : @preprocdirect ref +); + +preproctrue(int branch : @ppd_branch ref); +preprocfalse(int branch : @ppd_branch ref); + +preproctext( + unique int id: @preprocdirect ref, + string head: string ref, + string body: string ref +); + +includes( + unique int id: @ppd_include ref, + int included: @file ref +); + +link_targets( + int id: @link_target, + int binary: @file ref +); + +link_parent( + int element : @element ref, + int link_target : @link_target ref +); + +/* XML Files */ + +xmlEncoding(unique int id: @file ref, string encoding: string ref); + +xmlDTDs( + unique int id: @xmldtd, + string root: string ref, + string publicId: string ref, + string systemId: string ref, + int fileid: @file ref +); + +xmlElements( + unique int id: @xmlelement, + string name: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int fileid: @file ref +); + +xmlAttrs( + unique int id: @xmlattribute, + int elementid: @xmlelement ref, + string name: string ref, + string value: string ref, + int idx: int ref, + int fileid: @file ref +); + +xmlNs( + int id: @xmlnamespace, + string prefixName: string ref, + string URI: string ref, + int fileid: @file ref +); + +xmlHasNs( + int elementId: @xmlnamespaceable ref, + int nsId: @xmlnamespace ref, + int fileid: @file ref +); + +xmlComments( + unique int id: @xmlcomment, + string text: string ref, + int parentid: @xmlparent ref, + int fileid: @file ref +); + +xmlChars( + unique int id: @xmlcharacters, + string text: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int isCDATA: int ref, + int fileid: @file ref +); + +@xmlparent = @file | @xmlelement; +@xmlnamespaceable = @xmlelement | @xmlattribute; + +xmllocations( + int xmlElement: @xmllocatable ref, + int location: @location_default ref +); + +@xmllocatable = @xmlcharacters + | @xmlelement + | @xmlcomment + | @xmlattribute + | @xmldtd + | @file + | @xmlnamespace; diff --git a/cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/semmlecode.cpp.dbscheme b/cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/semmlecode.cpp.dbscheme new file mode 100644 index 00000000000..f0156f5f88a --- /dev/null +++ b/cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/semmlecode.cpp.dbscheme @@ -0,0 +1,2339 @@ + +/** + * An invocation of the compiler. Note that more than one file may be + * compiled per invocation. For example, this command compiles three + * source files: + * + * gcc -c f1.c f2.c f3.c + * + * The `id` simply identifies the invocation, while `cwd` is the working + * directory from which the compiler was invoked. + */ +compilations( + /** + * An invocation of the compiler. Note that more than one file may + * be compiled per invocation. For example, this command compiles + * three source files: + * + * gcc -c f1.c f2.c f3.c + */ + unique int id : @compilation, + string cwd : string ref +); + +/** + * The arguments that were passed to the extractor for a compiler + * invocation. If `id` is for the compiler invocation + * + * gcc -c f1.c f2.c f3.c + * + * then typically there will be rows for + * + * num | arg + * --- | --- + * 0 | *path to extractor* + * 1 | `--mimic` + * 2 | `/usr/bin/gcc` + * 3 | `-c` + * 4 | f1.c + * 5 | f2.c + * 6 | f3.c + */ +#keyset[id, num] +compilation_args( + int id : @compilation ref, + int num : int ref, + string arg : string ref +); + +/** + * Optionally, record the build mode for each compilation. + */ +compilation_build_mode( + unique int id : @compilation ref, + int mode : int ref +); + +/* +case @compilation_build_mode.mode of + 0 = @build_mode_none +| 1 = @build_mode_manual +| 2 = @build_mode_auto +; +*/ + +/** + * The source files that are compiled by a compiler invocation. + * If `id` is for the compiler invocation + * + * gcc -c f1.c f2.c f3.c + * + * then there will be rows for + * + * num | arg + * --- | --- + * 0 | f1.c + * 1 | f2.c + * 2 | f3.c + * + * Note that even if those files `#include` headers, those headers + * do not appear as rows. + */ +#keyset[id, num] +compilation_compiling_files( + int id : @compilation ref, + int num : int ref, + int file : @file ref +); + +/** + * The time taken by the extractor for a compiler invocation. + * + * For each file `num`, there will be rows for + * + * kind | seconds + * ---- | --- + * 1 | CPU seconds used by the extractor frontend + * 2 | Elapsed seconds during the extractor frontend + * 3 | CPU seconds used by the extractor backend + * 4 | Elapsed seconds during the extractor backend + */ +#keyset[id, num, kind] +compilation_time( + int id : @compilation ref, + int num : int ref, + /* kind: + 1 = frontend_cpu_seconds + 2 = frontend_elapsed_seconds + 3 = extractor_cpu_seconds + 4 = extractor_elapsed_seconds + */ + int kind : int ref, + float seconds : float ref +); + +/** + * An error or warning generated by the extractor. + * The diagnostic message `diagnostic` was generated during compiler + * invocation `compilation`, and is the `file_number_diagnostic_number`th + * message generated while extracting the `file_number`th file of that + * invocation. + */ +#keyset[compilation, file_number, file_number_diagnostic_number] +diagnostic_for( + int diagnostic : @diagnostic ref, + int compilation : @compilation ref, + int file_number : int ref, + int file_number_diagnostic_number : int ref +); + +/** + * If extraction was successful, then `cpu_seconds` and + * `elapsed_seconds` are the CPU time and elapsed time (respectively) + * that extraction took for compiler invocation `id`. + */ +compilation_finished( + unique int id : @compilation ref, + float cpu_seconds : float ref, + float elapsed_seconds : float ref +); + + +/** + * External data, loaded from CSV files during snapshot creation. See + * [Tutorial: Incorporating external data](https://help.semmle.com/wiki/display/SD/Tutorial%3A+Incorporating+external+data) + * for more information. + */ +externalData( + int id : @externalDataElement, + string path : string ref, + int column: int ref, + string value : string ref +); + +/** + * The source location of the snapshot. + */ +sourceLocationPrefix(string prefix : string ref); + +/** + * Information about packages that provide code used during compilation. + * The `id` is just a unique identifier. + * The `namespace` is typically the name of the package manager that + * provided the package (e.g. "dpkg" or "yum"). + * The `package_name` is the name of the package, and `version` is its + * version (as a string). + */ +external_packages( + unique int id: @external_package, + string namespace : string ref, + string package_name : string ref, + string version : string ref +); + +/** + * Holds if File `fileid` was provided by package `package`. + */ +header_to_external_package( + int fileid : @file ref, + int package : @external_package ref +); + +/* + * Version history + */ + +svnentries( + unique int id : @svnentry, + string revision : string ref, + string author : string ref, + date revisionDate : date ref, + int changeSize : int ref +) + +svnaffectedfiles( + int id : @svnentry ref, + int file : @file ref, + string action : string ref +) + +svnentrymsg( + unique int id : @svnentry ref, + string message : string ref +) + +svnchurn( + int commit : @svnentry ref, + int file : @file ref, + int addedLines : int ref, + int deletedLines : int ref +) + +/* + * C++ dbscheme + */ + +extractor_version( + string codeql_version: string ref, + string frontend_version: string ref +) + +@location = @location_stmt | @location_expr | @location_default ; + +/** + * The location of an element that is not an expression or a statement. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_default( + /** The location of an element that is not an expression or a statement. */ + unique int id: @location_default, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** + * The location of a statement. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_stmt( + /** The location of a statement. */ + unique int id: @location_stmt, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** + * The location of an expression. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_expr( + /** The location of an expression. */ + unique int id: @location_expr, + int container: @container ref, + int startLine: int ref, + int startColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +/** An element for which line-count information is available. */ +@sourceline = @file | @function | @variable | @enumconstant | @xmllocatable; + +numlines( + int element_id: @sourceline ref, + int num_lines: int ref, + int num_code: int ref, + int num_comment: int ref +); + +diagnostics( + unique int id: @diagnostic, + int severity: int ref, + string error_tag: string ref, + string error_message: string ref, + string full_error_message: string ref, + int location: @location_default ref +); + +files( + unique int id: @file, + string name: string ref +); + +folders( + unique int id: @folder, + string name: string ref +); + +@container = @folder | @file + +containerparent( + int parent: @container ref, + unique int child: @container ref +); + +fileannotations( + int id: @file ref, + int kind: int ref, + string name: string ref, + string value: string ref +); + +inmacroexpansion( + int id: @element ref, + int inv: @macroinvocation ref +); + +affectedbymacroexpansion( + int id: @element ref, + int inv: @macroinvocation ref +); + +case @macroinvocation.kind of + 1 = @macro_expansion +| 2 = @other_macro_reference +; + +macroinvocations( + unique int id: @macroinvocation, + int macro_id: @ppd_define ref, + int location: @location_default ref, + int kind: int ref +); + +macroparent( + unique int id: @macroinvocation ref, + int parent_id: @macroinvocation ref +); + +// a macroinvocation may be part of another location +// the way to find a constant expression that uses a macro +// is thus to find a constant expression that has a location +// to which a macro invocation is bound +macrolocationbind( + int id: @macroinvocation ref, + int location: @location ref +); + +#keyset[invocation, argument_index] +macro_argument_unexpanded( + int invocation: @macroinvocation ref, + int argument_index: int ref, + string text: string ref +); + +#keyset[invocation, argument_index] +macro_argument_expanded( + int invocation: @macroinvocation ref, + int argument_index: int ref, + string text: string ref +); + +/* +case @function.kind of + 1 = @normal_function +| 2 = @constructor +| 3 = @destructor +| 4 = @conversion_function +| 5 = @operator +| 6 = @builtin_function // GCC built-in functions, e.g. __builtin___memcpy_chk +| 7 = @user_defined_literal +| 8 = @deduction_guide +; +*/ + +functions( + unique int id: @function, + string name: string ref, + int kind: int ref +); + +function_entry_point( + int id: @function ref, + unique int entry_point: @stmt ref +); + +function_return_type( + int id: @function ref, + int return_type: @type ref +); + +/** + * If `function` is a coroutine, then this gives the `std::experimental::resumable_traits` + * instance associated with it, and the variables representing the `handle` and `promise` + * for it. + */ +coroutine( + unique int function: @function ref, + int traits: @type ref +); + +/* +case @coroutine_placeholder_variable.kind of + 1 = @handle +| 2 = @promise +| 3 = @init_await_resume +; +*/ + +coroutine_placeholder_variable( + unique int placeholder_variable: @variable ref, + int kind: int ref, + int function: @function ref +) + +/** The `new` function used for allocating the coroutine state, if any. */ +coroutine_new( + unique int function: @function ref, + int new: @function ref +); + +/** The `delete` function used for deallocating the coroutine state, if any. */ +coroutine_delete( + unique int function: @function ref, + int delete: @function ref +); + +purefunctions(unique int id: @function ref); + +function_deleted(unique int id: @function ref); + +function_defaulted(unique int id: @function ref); + +function_prototyped(unique int id: @function ref) + +deduction_guide_for_class( + int id: @function ref, + int class_template: @usertype ref +) + +member_function_this_type( + unique int id: @function ref, + int this_type: @type ref +); + +#keyset[id, type_id] +fun_decls( + int id: @fun_decl, + int function: @function ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); +fun_def(unique int id: @fun_decl ref); +fun_specialized(unique int id: @fun_decl ref); +fun_implicit(unique int id: @fun_decl ref); +fun_decl_specifiers( + int id: @fun_decl ref, + string name: string ref +) +#keyset[fun_decl, index] +fun_decl_throws( + int fun_decl: @fun_decl ref, + int index: int ref, + int type_id: @type ref +); +/* an empty throw specification is different from none */ +fun_decl_empty_throws(unique int fun_decl: @fun_decl ref); +fun_decl_noexcept( + int fun_decl: @fun_decl ref, + int constant: @expr ref +); +fun_decl_empty_noexcept(int fun_decl: @fun_decl ref); +fun_decl_typedef_type( + unique int fun_decl: @fun_decl ref, + int typedeftype_id: @usertype ref +); + +param_decl_bind( + unique int id: @var_decl ref, + int index: int ref, + int fun_decl: @fun_decl ref +); + +#keyset[id, type_id] +var_decls( + int id: @var_decl, + int variable: @variable ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); +var_def(unique int id: @var_decl ref); +var_decl_specifiers( + int id: @var_decl ref, + string name: string ref +) +is_structured_binding(unique int id: @variable ref); + +type_decls( + unique int id: @type_decl, + int type_id: @type ref, + int location: @location_default ref +); +type_def(unique int id: @type_decl ref); +type_decl_top( + unique int type_decl: @type_decl ref +); + +namespace_decls( + unique int id: @namespace_decl, + int namespace_id: @namespace ref, + int location: @location_default ref, + int bodylocation: @location_default ref +); + +case @using.kind of + 1 = @using_declaration +| 2 = @using_directive +| 3 = @using_enum_declaration +; + +usings( + unique int id: @using, + int element_id: @element ref, + int location: @location_default ref, + int kind: int ref +); + +/** The element which contains the `using` declaration. */ +using_container( + int parent: @element ref, + int child: @using ref +); + +static_asserts( + unique int id: @static_assert, + int condition : @expr ref, + string message : string ref, + int location: @location_default ref, + int enclosing : @element ref +); + +// each function has an ordered list of parameters +#keyset[id, type_id] +#keyset[function, index, type_id] +params( + int id: @parameter, + int function: @parameterized_element ref, + int index: int ref, + int type_id: @type ref +); + +overrides( + int new: @function ref, + int old: @function ref +); + +#keyset[id, type_id] +membervariables( + int id: @membervariable, + int type_id: @type ref, + string name: string ref +); + +#keyset[id, type_id] +globalvariables( + int id: @globalvariable, + int type_id: @type ref, + string name: string ref +); + +#keyset[id, type_id] +localvariables( + int id: @localvariable, + int type_id: @type ref, + string name: string ref +); + +autoderivation( + unique int var: @variable ref, + int derivation_type: @type ref +); + +orphaned_variables( + int var: @localvariable ref, + int function: @function ref +) + +enumconstants( + unique int id: @enumconstant, + int parent: @usertype ref, + int index: int ref, + int type_id: @type ref, + string name: string ref, + int location: @location_default ref +); + +@variable = @localscopevariable | @globalvariable | @membervariable; + +@localscopevariable = @localvariable | @parameter; + +/** + * Built-in types are the fundamental types, e.g., integral, floating, and void. + */ +case @builtintype.kind of + 1 = @errortype +| 2 = @unknowntype +| 3 = @void +| 4 = @boolean +| 5 = @char +| 6 = @unsigned_char +| 7 = @signed_char +| 8 = @short +| 9 = @unsigned_short +| 10 = @signed_short +| 11 = @int +| 12 = @unsigned_int +| 13 = @signed_int +| 14 = @long +| 15 = @unsigned_long +| 16 = @signed_long +| 17 = @long_long +| 18 = @unsigned_long_long +| 19 = @signed_long_long +// ... 20 Microsoft-specific __int8 +// ... 21 Microsoft-specific __int16 +// ... 22 Microsoft-specific __int32 +// ... 23 Microsoft-specific __int64 +| 24 = @float +| 25 = @double +| 26 = @long_double +| 27 = @complex_float // C99-specific _Complex float +| 28 = @complex_double // C99-specific _Complex double +| 29 = @complex_long_double // C99-specific _Complex long double +| 30 = @imaginary_float // C99-specific _Imaginary float +| 31 = @imaginary_double // C99-specific _Imaginary double +| 32 = @imaginary_long_double // C99-specific _Imaginary long double +| 33 = @wchar_t // Microsoft-specific +| 34 = @decltype_nullptr // C++11 +| 35 = @int128 // __int128 +| 36 = @unsigned_int128 // unsigned __int128 +| 37 = @signed_int128 // signed __int128 +| 38 = @float128 // __float128 +| 39 = @complex_float128 // _Complex __float128 +| 40 = @decimal32 // _Decimal32 +| 41 = @decimal64 // _Decimal64 +| 42 = @decimal128 // _Decimal128 +| 43 = @char16_t +| 44 = @char32_t +| 45 = @std_float32 // _Float32 +| 46 = @float32x // _Float32x +| 47 = @std_float64 // _Float64 +| 48 = @float64x // _Float64x +| 49 = @std_float128 // _Float128 +// ... 50 _Float128x +| 51 = @char8_t +| 52 = @float16 // _Float16 +| 53 = @complex_float16 // _Complex _Float16 +| 54 = @fp16 // __fp16 +| 55 = @std_bfloat16 // __bf16 +| 56 = @std_float16 // std::float16_t +| 57 = @complex_std_float32 // _Complex _Float32 +| 58 = @complex_float32x // _Complex _Float32x +| 59 = @complex_std_float64 // _Complex _Float64 +| 60 = @complex_float64x // _Complex _Float64x +| 61 = @complex_std_float128 // _Complex _Float128 +; + +builtintypes( + unique int id: @builtintype, + string name: string ref, + int kind: int ref, + int size: int ref, + int sign: int ref, + int alignment: int ref +); + +/** + * Derived types are types that are directly derived from existing types and + * point to, refer to, transform type data to return a new type. + */ +case @derivedtype.kind of + 1 = @pointer +| 2 = @reference +| 3 = @type_with_specifiers +| 4 = @array +| 5 = @gnu_vector +| 6 = @routineptr +| 7 = @routinereference +| 8 = @rvalue_reference // C++11 +// ... 9 type_conforming_to_protocols deprecated +| 10 = @block +; + +derivedtypes( + unique int id: @derivedtype, + string name: string ref, + int kind: int ref, + int type_id: @type ref +); + +pointerishsize(unique int id: @derivedtype ref, + int size: int ref, + int alignment: int ref); + +arraysizes( + unique int id: @derivedtype ref, + int num_elements: int ref, + int bytesize: int ref, + int alignment: int ref +); + +typedefbase( + unique int id: @usertype ref, + int type_id: @type ref +); + +/** + * An instance of the C++11 `decltype` operator. For example: + * ``` + * int a; + * decltype(1+a) b; + * ``` + * Here `expr` is `1+a`. + * + * Sometimes an additional pair of parentheses around the expression + * would change the semantics of this decltype, e.g. + * ``` + * struct A { double x; }; + * const A* a = new A(); + * decltype( a->x ); // type is double + * decltype((a->x)); // type is const double& + * ``` + * (Please consult the C++11 standard for more details). + * `parentheses_would_change_meaning` is `true` iff that is the case. + */ +#keyset[id, expr] +decltypes( + int id: @decltype, + int expr: @expr ref, + int base_type: @type ref, + boolean parentheses_would_change_meaning: boolean ref +); + +/* +case @usertype.kind of + 1 = @struct +| 2 = @class +| 3 = @union +| 4 = @enum +| 5 = @typedef // classic C: typedef typedef type name +| 6 = @template +| 7 = @template_parameter +| 8 = @template_template_parameter +| 9 = @proxy_class // a proxy class associated with a template parameter +// ... 10 objc_class deprecated +// ... 11 objc_protocol deprecated +// ... 12 objc_category deprecated +| 13 = @scoped_enum +| 14 = @using_alias // a using name = type style typedef +; +*/ + +usertypes( + unique int id: @usertype, + string name: string ref, + int kind: int ref +); + +usertypesize( + unique int id: @usertype ref, + int size: int ref, + int alignment: int ref +); + +usertype_final(unique int id: @usertype ref); + +usertype_uuid( + unique int id: @usertype ref, + string uuid: string ref +); + +mangled_name( + unique int id: @declaration ref, + int mangled_name : @mangledname, + boolean is_complete: boolean ref +); + +is_pod_class(unique int id: @usertype ref); +is_standard_layout_class(unique int id: @usertype ref); + +is_complete(unique int id: @usertype ref); + +is_class_template(unique int id: @usertype ref); +class_instantiation( + int to: @usertype ref, + int from: @usertype ref +); +class_template_argument( + int type_id: @usertype ref, + int index: int ref, + int arg_type: @type ref +); +class_template_argument_value( + int type_id: @usertype ref, + int index: int ref, + int arg_value: @expr ref +); + +is_proxy_class_for( + unique int id: @usertype ref, + unique int templ_param_id: @usertype ref +); + +type_mentions( + unique int id: @type_mention, + int type_id: @type ref, + int location: @location ref, + // a_symbol_reference_kind from the frontend. + int kind: int ref +); + +is_function_template(unique int id: @function ref); +function_instantiation( + unique int to: @function ref, + int from: @function ref +); +function_template_argument( + int function_id: @function ref, + int index: int ref, + int arg_type: @type ref +); +function_template_argument_value( + int function_id: @function ref, + int index: int ref, + int arg_value: @expr ref +); + +is_variable_template(unique int id: @variable ref); +variable_instantiation( + unique int to: @variable ref, + int from: @variable ref +); +variable_template_argument( + int variable_id: @variable ref, + int index: int ref, + int arg_type: @type ref +); +variable_template_argument_value( + int variable_id: @variable ref, + int index: int ref, + int arg_value: @expr ref +); + +routinetypes( + unique int id: @routinetype, + int return_type: @type ref +); + +routinetypeargs( + int routine: @routinetype ref, + int index: int ref, + int type_id: @type ref +); + +ptrtomembers( + unique int id: @ptrtomember, + int type_id: @type ref, + int class_id: @type ref +); + +/* + specifiers for types, functions, and variables + + "public", + "protected", + "private", + + "const", + "volatile", + "static", + + "pure", + "virtual", + "sealed", // Microsoft + "__interface", // Microsoft + "inline", + "explicit", + + "near", // near far extension + "far", // near far extension + "__ptr32", // Microsoft + "__ptr64", // Microsoft + "__sptr", // Microsoft + "__uptr", // Microsoft + "dllimport", // Microsoft + "dllexport", // Microsoft + "thread", // Microsoft + "naked", // Microsoft + "microsoft_inline", // Microsoft + "forceinline", // Microsoft + "selectany", // Microsoft + "nothrow", // Microsoft + "novtable", // Microsoft + "noreturn", // Microsoft + "noinline", // Microsoft + "noalias", // Microsoft + "restrict", // Microsoft +*/ + +specifiers( + unique int id: @specifier, + unique string str: string ref +); + +typespecifiers( + int type_id: @type ref, + int spec_id: @specifier ref +); + +funspecifiers( + int func_id: @function ref, + int spec_id: @specifier ref +); + +varspecifiers( + int var_id: @accessible ref, + int spec_id: @specifier ref +); + +explicit_specifier_exprs( + unique int func_id: @function ref, + int constant: @expr ref +) + +attributes( + unique int id: @attribute, + int kind: int ref, + string name: string ref, + string name_space: string ref, + int location: @location_default ref +); + +case @attribute.kind of + 0 = @gnuattribute +| 1 = @stdattribute +| 2 = @declspec +| 3 = @msattribute +| 4 = @alignas +// ... 5 @objc_propertyattribute deprecated +; + +attribute_args( + unique int id: @attribute_arg, + int kind: int ref, + int attribute: @attribute ref, + int index: int ref, + int location: @location_default ref +); + +case @attribute_arg.kind of + 0 = @attribute_arg_empty +| 1 = @attribute_arg_token +| 2 = @attribute_arg_constant +| 3 = @attribute_arg_type +| 4 = @attribute_arg_constant_expr +| 5 = @attribute_arg_expr +; + +attribute_arg_value( + unique int arg: @attribute_arg ref, + string value: string ref +); +attribute_arg_type( + unique int arg: @attribute_arg ref, + int type_id: @type ref +); +attribute_arg_constant( + unique int arg: @attribute_arg ref, + int constant: @expr ref +) +attribute_arg_expr( + unique int arg: @attribute_arg ref, + int expr: @expr ref +) +attribute_arg_name( + unique int arg: @attribute_arg ref, + string name: string ref +); + +typeattributes( + int type_id: @type ref, + int spec_id: @attribute ref +); + +funcattributes( + int func_id: @function ref, + int spec_id: @attribute ref +); + +varattributes( + int var_id: @accessible ref, + int spec_id: @attribute ref +); + +stmtattributes( + int stmt_id: @stmt ref, + int spec_id: @attribute ref +); + +@type = @builtintype + | @derivedtype + | @usertype + /* TODO | @fixedpointtype */ + | @routinetype + | @ptrtomember + | @decltype; + +unspecifiedtype( + unique int type_id: @type ref, + int unspecified_type_id: @type ref +); + +member( + int parent: @type ref, + int index: int ref, + int child: @member ref +); + +@enclosingfunction_child = @usertype | @variable | @namespace + +enclosingfunction( + unique int child: @enclosingfunction_child ref, + int parent: @function ref +); + +derivations( + unique int derivation: @derivation, + int sub: @type ref, + int index: int ref, + int super: @type ref, + int location: @location_default ref +); + +derspecifiers( + int der_id: @derivation ref, + int spec_id: @specifier ref +); + +/** + * Contains the byte offset of the base class subobject within the derived + * class. Only holds for non-virtual base classes, but see table + * `virtual_base_offsets` for offsets of virtual base class subobjects. + */ +direct_base_offsets( + unique int der_id: @derivation ref, + int offset: int ref +); + +/** + * Contains the byte offset of the virtual base class subobject for class + * `super` within a most-derived object of class `sub`. `super` can be either a + * direct or indirect base class. + */ +#keyset[sub, super] +virtual_base_offsets( + int sub: @usertype ref, + int super: @usertype ref, + int offset: int ref +); + +frienddecls( + unique int id: @frienddecl, + int type_id: @type ref, + int decl_id: @declaration ref, + int location: @location_default ref +); + +@declaredtype = @usertype ; + +@declaration = @function + | @declaredtype + | @variable + | @enumconstant + | @frienddecl; + +@member = @membervariable + | @function + | @declaredtype + | @enumconstant; + +@locatable = @diagnostic + | @declaration + | @ppd_include + | @ppd_define + | @macroinvocation + /*| @funcall*/ + | @xmllocatable + | @attribute + | @attribute_arg; + +@namedscope = @namespace | @usertype; + +@element = @locatable + | @file + | @folder + | @specifier + | @type + | @expr + | @namespace + | @initialiser + | @stmt + | @derivation + | @comment + | @preprocdirect + | @fun_decl + | @var_decl + | @type_decl + | @namespace_decl + | @using + | @namequalifier + | @specialnamequalifyingelement + | @static_assert + | @type_mention + | @lambdacapture; + +@exprparent = @element; + +comments( + unique int id: @comment, + string contents: string ref, + int location: @location_default ref +); + +commentbinding( + int id: @comment ref, + int element: @element ref +); + +exprconv( + int converted: @expr ref, + unique int conversion: @expr ref +); + +compgenerated(unique int id: @element ref); + +/** + * `destructor_call` destructs the `i`'th entity that should be + * destructed following `element`. Note that entities should be + * destructed in reverse construction order, so for a given `element` + * these should be called from highest to lowest `i`. + */ +#keyset[element, destructor_call] +#keyset[element, i] +synthetic_destructor_call( + int element: @element ref, + int i: int ref, + int destructor_call: @routineexpr ref +); + +namespaces( + unique int id: @namespace, + string name: string ref +); + +namespace_inline( + unique int id: @namespace ref +); + +namespacembrs( + int parentid: @namespace ref, + unique int memberid: @namespacembr ref +); + +@namespacembr = @declaration | @namespace; + +exprparents( + int expr_id: @expr ref, + int child_index: int ref, + int parent_id: @exprparent ref +); + +expr_isload(unique int expr_id: @expr ref); + +@cast = @c_style_cast + | @const_cast + | @dynamic_cast + | @reinterpret_cast + | @static_cast + ; + +/* +case @conversion.kind of + 0 = @simple_conversion // a numeric conversion, qualification conversion, or a reinterpret_cast +| 1 = @bool_conversion // conversion to 'bool' +| 2 = @base_class_conversion // a derived-to-base conversion +| 3 = @derived_class_conversion // a base-to-derived conversion +| 4 = @pm_base_class_conversion // a derived-to-base conversion of a pointer to member +| 5 = @pm_derived_class_conversion // a base-to-derived conversion of a pointer to member +| 6 = @glvalue_adjust // an adjustment of the type of a glvalue +| 7 = @prvalue_adjust // an adjustment of the type of a prvalue +; +*/ +/** + * Describes the semantics represented by a cast expression. This is largely + * independent of the source syntax of the cast, so it is separate from the + * regular expression kind. + */ +conversionkinds( + unique int expr_id: @cast ref, + int kind: int ref +); + +@conversion = @cast + | @array_to_pointer + | @parexpr + | @reference_to + | @ref_indirect + | @temp_init + | @c11_generic + ; + +/* +case @funbindexpr.kind of + 0 = @normal_call // a normal call +| 1 = @virtual_call // a virtual call +| 2 = @adl_call // a call whose target is only found by ADL +; +*/ +iscall( + unique int caller: @funbindexpr ref, + int kind: int ref +); + +numtemplatearguments( + unique int expr_id: @expr ref, + int num: int ref +); + +specialnamequalifyingelements( + unique int id: @specialnamequalifyingelement, + unique string name: string ref +); + +@namequalifiableelement = @expr | @namequalifier; +@namequalifyingelement = @namespace + | @specialnamequalifyingelement + | @usertype; + +namequalifiers( + unique int id: @namequalifier, + unique int qualifiableelement: @namequalifiableelement ref, + int qualifyingelement: @namequalifyingelement ref, + int location: @location_default ref +); + +varbind( + int expr: @varbindexpr ref, + int var: @accessible ref +); + +funbind( + int expr: @funbindexpr ref, + int fun: @function ref +); + +@any_new_expr = @new_expr + | @new_array_expr; + +@new_or_delete_expr = @any_new_expr + | @delete_expr + | @delete_array_expr; + +@prefix_crement_expr = @preincrexpr | @predecrexpr; + +@postfix_crement_expr = @postincrexpr | @postdecrexpr; + +@increment_expr = @preincrexpr | @postincrexpr; + +@decrement_expr = @predecrexpr | @postdecrexpr; + +@crement_expr = @increment_expr | @decrement_expr; + +@un_arith_op_expr = @arithnegexpr + | @unaryplusexpr + | @conjugation + | @realpartexpr + | @imagpartexpr + | @crement_expr + ; + +@un_bitwise_op_expr = @complementexpr; + +@un_log_op_expr = @notexpr; + +@un_op_expr = @address_of + | @indirect + | @un_arith_op_expr + | @un_bitwise_op_expr + | @builtinaddressof + | @vec_fill + | @un_log_op_expr + | @co_await + | @co_yield + ; + +@bin_log_op_expr = @andlogicalexpr | @orlogicalexpr; + +@cmp_op_expr = @eq_op_expr | @rel_op_expr; + +@eq_op_expr = @eqexpr | @neexpr; + +@rel_op_expr = @gtexpr + | @ltexpr + | @geexpr + | @leexpr + | @spaceshipexpr + ; + +@bin_bitwise_op_expr = @lshiftexpr + | @rshiftexpr + | @andexpr + | @orexpr + | @xorexpr + ; + +@p_arith_op_expr = @paddexpr + | @psubexpr + | @pdiffexpr + ; + +@bin_arith_op_expr = @addexpr + | @subexpr + | @mulexpr + | @divexpr + | @remexpr + | @jmulexpr + | @jdivexpr + | @fjaddexpr + | @jfaddexpr + | @fjsubexpr + | @jfsubexpr + | @minexpr + | @maxexpr + | @p_arith_op_expr + ; + +@bin_op_expr = @bin_arith_op_expr + | @bin_bitwise_op_expr + | @cmp_op_expr + | @bin_log_op_expr + ; + +@op_expr = @un_op_expr + | @bin_op_expr + | @assign_expr + | @conditionalexpr + ; + +@assign_arith_expr = @assignaddexpr + | @assignsubexpr + | @assignmulexpr + | @assigndivexpr + | @assignremexpr + ; + +@assign_bitwise_expr = @assignandexpr + | @assignorexpr + | @assignxorexpr + | @assignlshiftexpr + | @assignrshiftexpr + ; + +@assign_pointer_expr = @assignpaddexpr + | @assignpsubexpr + ; + +@assign_op_expr = @assign_arith_expr + | @assign_bitwise_expr + | @assign_pointer_expr + ; + +@assign_expr = @assignexpr | @assign_op_expr | @blockassignexpr + +/* + Binary encoding of the allocator form. + + case @allocator.form of + 0 = plain + | 1 = alignment + ; +*/ + +/** + * The allocator function associated with a `new` or `new[]` expression. + * The `form` column specified whether the allocation call contains an alignment + * argument. + */ +expr_allocator( + unique int expr: @any_new_expr ref, + int func: @function ref, + int form: int ref +); + +/* + Binary encoding of the deallocator form. + + case @deallocator.form of + 0 = plain + | 1 = size + | 2 = alignment + | 4 = destroying_delete + ; +*/ + +/** + * The deallocator function associated with a `delete`, `delete[]`, `new`, or + * `new[]` expression. For a `new` or `new[]` expression, the deallocator is the + * one used to free memory if the initialization throws an exception. + * The `form` column specifies whether the deallocation call contains a size + * argument, and alignment argument, or both. + */ +expr_deallocator( + unique int expr: @new_or_delete_expr ref, + int func: @function ref, + int form: int ref +); + +/** + * Holds if the `@conditionalexpr` is of the two operand form + * `guard ? : false`. + */ +expr_cond_two_operand( + unique int cond: @conditionalexpr ref +); + +/** + * The guard of `@conditionalexpr` `guard ? true : false` + */ +expr_cond_guard( + unique int cond: @conditionalexpr ref, + int guard: @expr ref +); + +/** + * The expression used when the guard of `@conditionalexpr` + * `guard ? true : false` holds. For the two operand form + * `guard ?: false` consider using `expr_cond_guard` instead. + */ +expr_cond_true( + unique int cond: @conditionalexpr ref, + int true: @expr ref +); + +/** + * The expression used when the guard of `@conditionalexpr` + * `guard ? true : false` does not hold. + */ +expr_cond_false( + unique int cond: @conditionalexpr ref, + int false: @expr ref +); + +/** A string representation of the value. */ +values( + unique int id: @value, + string str: string ref +); + +/** The actual text in the source code for the value, if any. */ +valuetext( + unique int id: @value ref, + string text: string ref +); + +valuebind( + int val: @value ref, + unique int expr: @expr ref +); + +fieldoffsets( + unique int id: @variable ref, + int byteoffset: int ref, + int bitoffset: int ref +); + +bitfield( + unique int id: @variable ref, + int bits: int ref, + int declared_bits: int ref +); + +/* TODO +memberprefix( + int member: @expr ref, + int prefix: @expr ref +); +*/ + +/* + kind(1) = mbrcallexpr + kind(2) = mbrptrcallexpr + kind(3) = mbrptrmbrcallexpr + kind(4) = ptrmbrptrmbrcallexpr + kind(5) = mbrreadexpr // x.y + kind(6) = mbrptrreadexpr // p->y + kind(7) = mbrptrmbrreadexpr // x.*pm + kind(8) = mbrptrmbrptrreadexpr // x->*pm + kind(9) = staticmbrreadexpr // static x.y + kind(10) = staticmbrptrreadexpr // static p->y +*/ +/* TODO +memberaccess( + int member: @expr ref, + int kind: int ref +); +*/ + +initialisers( + unique int init: @initialiser, + int var: @accessible ref, + unique int expr: @expr ref, + int location: @location_expr ref +); + +braced_initialisers( + int init: @initialiser ref +); + +/** + * An ancestor for the expression, for cases in which we cannot + * otherwise find the expression's parent. + */ +expr_ancestor( + int exp: @expr ref, + int ancestor: @element ref +); + +exprs( + unique int id: @expr, + int kind: int ref, + int location: @location_expr ref +); + +expr_reuse( + int reuse: @expr ref, + int original: @expr ref, + int value_category: int ref +) + +/* + case @value.category of + 1 = prval + | 2 = xval + | 3 = lval + ; +*/ +expr_types( + int id: @expr ref, + int typeid: @type ref, + int value_category: int ref +); + +case @expr.kind of + 1 = @errorexpr +| 2 = @address_of // & AddressOfExpr +| 3 = @reference_to // ReferenceToExpr (implicit?) +| 4 = @indirect // * PointerDereferenceExpr +| 5 = @ref_indirect // ReferenceDereferenceExpr (implicit?) +// ... +| 8 = @array_to_pointer // (???) +| 9 = @vacuous_destructor_call // VacuousDestructorCall +// ... +| 11 = @assume // Microsoft +| 12 = @parexpr +| 13 = @arithnegexpr +| 14 = @unaryplusexpr +| 15 = @complementexpr +| 16 = @notexpr +| 17 = @conjugation // GNU ~ operator +| 18 = @realpartexpr // GNU __real +| 19 = @imagpartexpr // GNU __imag +| 20 = @postincrexpr +| 21 = @postdecrexpr +| 22 = @preincrexpr +| 23 = @predecrexpr +| 24 = @conditionalexpr +| 25 = @addexpr +| 26 = @subexpr +| 27 = @mulexpr +| 28 = @divexpr +| 29 = @remexpr +| 30 = @jmulexpr // C99 mul imaginary +| 31 = @jdivexpr // C99 div imaginary +| 32 = @fjaddexpr // C99 add real + imaginary +| 33 = @jfaddexpr // C99 add imaginary + real +| 34 = @fjsubexpr // C99 sub real - imaginary +| 35 = @jfsubexpr // C99 sub imaginary - real +| 36 = @paddexpr // pointer add (pointer + int or int + pointer) +| 37 = @psubexpr // pointer sub (pointer - integer) +| 38 = @pdiffexpr // difference between two pointers +| 39 = @lshiftexpr +| 40 = @rshiftexpr +| 41 = @andexpr +| 42 = @orexpr +| 43 = @xorexpr +| 44 = @eqexpr +| 45 = @neexpr +| 46 = @gtexpr +| 47 = @ltexpr +| 48 = @geexpr +| 49 = @leexpr +| 50 = @minexpr // GNU minimum +| 51 = @maxexpr // GNU maximum +| 52 = @assignexpr +| 53 = @assignaddexpr +| 54 = @assignsubexpr +| 55 = @assignmulexpr +| 56 = @assigndivexpr +| 57 = @assignremexpr +| 58 = @assignlshiftexpr +| 59 = @assignrshiftexpr +| 60 = @assignandexpr +| 61 = @assignorexpr +| 62 = @assignxorexpr +| 63 = @assignpaddexpr // assign pointer add +| 64 = @assignpsubexpr // assign pointer sub +| 65 = @andlogicalexpr +| 66 = @orlogicalexpr +| 67 = @commaexpr +| 68 = @subscriptexpr // access to member of an array, e.g., a[5] +// ... 69 @objc_subscriptexpr deprecated +// ... 70 @cmdaccess deprecated +// ... +| 73 = @virtfunptrexpr +| 74 = @callexpr +// ... 75 @msgexpr_normal deprecated +// ... 76 @msgexpr_super deprecated +// ... 77 @atselectorexpr deprecated +// ... 78 @atprotocolexpr deprecated +| 79 = @vastartexpr +| 80 = @vaargexpr +| 81 = @vaendexpr +| 82 = @vacopyexpr +// ... 83 @atencodeexpr deprecated +| 84 = @varaccess +| 85 = @thisaccess +// ... 86 @objc_box_expr deprecated +| 87 = @new_expr +| 88 = @delete_expr +| 89 = @throw_expr +| 90 = @condition_decl // a variable declared in a condition, e.g., if(int x = y > 2) +| 91 = @braced_init_list +| 92 = @type_id +| 93 = @runtime_sizeof +| 94 = @runtime_alignof +| 95 = @sizeof_pack +| 96 = @expr_stmt // GNU extension +| 97 = @routineexpr +| 98 = @type_operand // used to access a type in certain contexts (haven't found any examples yet....) +| 99 = @offsetofexpr // offsetof ::= type and field +| 100 = @hasassignexpr // __has_assign ::= type +| 101 = @hascopyexpr // __has_copy ::= type +| 102 = @hasnothrowassign // __has_nothrow_assign ::= type +| 103 = @hasnothrowconstr // __has_nothrow_constructor ::= type +| 104 = @hasnothrowcopy // __has_nothrow_copy ::= type +| 105 = @hastrivialassign // __has_trivial_assign ::= type +| 106 = @hastrivialconstr // __has_trivial_constructor ::= type +| 107 = @hastrivialcopy // __has_trivial_copy ::= type +| 108 = @hasuserdestr // __has_user_destructor ::= type +| 109 = @hasvirtualdestr // __has_virtual_destructor ::= type +| 110 = @isabstractexpr // __is_abstract ::= type +| 111 = @isbaseofexpr // __is_base_of ::= type type +| 112 = @isclassexpr // __is_class ::= type +| 113 = @isconvtoexpr // __is_convertible_to ::= type type +| 114 = @isemptyexpr // __is_empty ::= type +| 115 = @isenumexpr // __is_enum ::= type +| 116 = @ispodexpr // __is_pod ::= type +| 117 = @ispolyexpr // __is_polymorphic ::= type +| 118 = @isunionexpr // __is_union ::= type +| 119 = @typescompexpr // GNU __builtin_types_compatible ::= type type +| 120 = @intaddrexpr // frontend internal builtin, used to implement offsetof +// ... +| 122 = @hastrivialdestructor // __has_trivial_destructor ::= type +| 123 = @literal +| 124 = @uuidof +| 127 = @aggregateliteral +| 128 = @delete_array_expr +| 129 = @new_array_expr +// ... 130 @objc_array_literal deprecated +// ... 131 @objc_dictionary_literal deprecated +| 132 = @foldexpr +// ... +| 200 = @ctordirectinit +| 201 = @ctorvirtualinit +| 202 = @ctorfieldinit +| 203 = @ctordelegatinginit +| 204 = @dtordirectdestruct +| 205 = @dtorvirtualdestruct +| 206 = @dtorfielddestruct +// ... +| 210 = @static_cast +| 211 = @reinterpret_cast +| 212 = @const_cast +| 213 = @dynamic_cast +| 214 = @c_style_cast +| 215 = @lambdaexpr +| 216 = @param_ref +| 217 = @noopexpr +// ... +| 294 = @istriviallyconstructibleexpr +| 295 = @isdestructibleexpr +| 296 = @isnothrowdestructibleexpr +| 297 = @istriviallydestructibleexpr +| 298 = @istriviallyassignableexpr +| 299 = @isnothrowassignableexpr +| 300 = @istrivialexpr +| 301 = @isstandardlayoutexpr +| 302 = @istriviallycopyableexpr +| 303 = @isliteraltypeexpr +| 304 = @hastrivialmoveconstructorexpr +| 305 = @hastrivialmoveassignexpr +| 306 = @hasnothrowmoveassignexpr +| 307 = @isconstructibleexpr +| 308 = @isnothrowconstructibleexpr +| 309 = @hasfinalizerexpr +| 310 = @isdelegateexpr +| 311 = @isinterfaceclassexpr +| 312 = @isrefarrayexpr +| 313 = @isrefclassexpr +| 314 = @issealedexpr +| 315 = @issimplevalueclassexpr +| 316 = @isvalueclassexpr +| 317 = @isfinalexpr +| 319 = @noexceptexpr +| 320 = @builtinshufflevector +| 321 = @builtinchooseexpr +| 322 = @builtinaddressof +| 323 = @vec_fill +| 324 = @builtinconvertvector +| 325 = @builtincomplex +| 326 = @spaceshipexpr +| 327 = @co_await +| 328 = @co_yield +| 329 = @temp_init +| 330 = @isassignable +| 331 = @isaggregate +| 332 = @hasuniqueobjectrepresentations +| 333 = @builtinbitcast +| 334 = @builtinshuffle +| 335 = @blockassignexpr +| 336 = @issame +| 337 = @isfunction +| 338 = @islayoutcompatible +| 339 = @ispointerinterconvertiblebaseof +| 340 = @isarray +| 341 = @arrayrank +| 342 = @arrayextent +| 343 = @isarithmetic +| 344 = @iscompletetype +| 345 = @iscompound +| 346 = @isconst +| 347 = @isfloatingpoint +| 348 = @isfundamental +| 349 = @isintegral +| 350 = @islvaluereference +| 351 = @ismemberfunctionpointer +| 352 = @ismemberobjectpointer +| 353 = @ismemberpointer +| 354 = @isobject +| 355 = @ispointer +| 356 = @isreference +| 357 = @isrvaluereference +| 358 = @isscalar +| 359 = @issigned +| 360 = @isunsigned +| 361 = @isvoid +| 362 = @isvolatile +| 363 = @reuseexpr +| 364 = @istriviallycopyassignable +| 365 = @isassignablenopreconditioncheck +| 366 = @referencebindstotemporary +| 367 = @issameas +| 368 = @builtinhasattribute +| 369 = @ispointerinterconvertiblewithclass +| 370 = @builtinispointerinterconvertiblewithclass +| 371 = @iscorrespondingmember +| 372 = @builtiniscorrespondingmember +| 373 = @isboundedarray +| 374 = @isunboundedarray +| 375 = @isreferenceable +| 378 = @isnothrowconvertible +| 379 = @referenceconstructsfromtemporary +| 380 = @referenceconvertsfromtemporary +| 381 = @isconvertible +| 382 = @isvalidwinrttype +| 383 = @iswinclass +| 384 = @iswininterface +| 385 = @istriviallyequalitycomparable +| 386 = @isscopedenum +| 387 = @istriviallyrelocatable +| 388 = @datasizeof +| 389 = @c11_generic +| 390 = @requires_expr +| 391 = @nested_requirement +| 392 = @compound_requirement +| 393 = @concept_id +; + +@var_args_expr = @vastartexpr + | @vaendexpr + | @vaargexpr + | @vacopyexpr + ; + +@builtin_op = @var_args_expr + | @noopexpr + | @offsetofexpr + | @intaddrexpr + | @hasassignexpr + | @hascopyexpr + | @hasnothrowassign + | @hasnothrowconstr + | @hasnothrowcopy + | @hastrivialassign + | @hastrivialconstr + | @hastrivialcopy + | @hastrivialdestructor + | @hasuserdestr + | @hasvirtualdestr + | @isabstractexpr + | @isbaseofexpr + | @isclassexpr + | @isconvtoexpr + | @isemptyexpr + | @isenumexpr + | @ispodexpr + | @ispolyexpr + | @isunionexpr + | @typescompexpr + | @builtinshufflevector + | @builtinconvertvector + | @builtinaddressof + | @istriviallyconstructibleexpr + | @isdestructibleexpr + | @isnothrowdestructibleexpr + | @istriviallydestructibleexpr + | @istriviallyassignableexpr + | @isnothrowassignableexpr + | @istrivialexpr + | @isstandardlayoutexpr + | @istriviallycopyableexpr + | @isliteraltypeexpr + | @hastrivialmoveconstructorexpr + | @hastrivialmoveassignexpr + | @hasnothrowmoveassignexpr + | @isconstructibleexpr + | @isnothrowconstructibleexpr + | @hasfinalizerexpr + | @isdelegateexpr + | @isinterfaceclassexpr + | @isrefarrayexpr + | @isrefclassexpr + | @issealedexpr + | @issimplevalueclassexpr + | @isvalueclassexpr + | @isfinalexpr + | @builtinchooseexpr + | @builtincomplex + | @isassignable + | @isaggregate + | @hasuniqueobjectrepresentations + | @builtinbitcast + | @builtinshuffle + | @issame + | @isfunction + | @islayoutcompatible + | @ispointerinterconvertiblebaseof + | @isarray + | @arrayrank + | @arrayextent + | @isarithmetic + | @iscompletetype + | @iscompound + | @isconst + | @isfloatingpoint + | @isfundamental + | @isintegral + | @islvaluereference + | @ismemberfunctionpointer + | @ismemberobjectpointer + | @ismemberpointer + | @isobject + | @ispointer + | @isreference + | @isrvaluereference + | @isscalar + | @issigned + | @isunsigned + | @isvoid + | @isvolatile + | @istriviallycopyassignable + | @isassignablenopreconditioncheck + | @referencebindstotemporary + | @issameas + | @builtinhasattribute + | @ispointerinterconvertiblewithclass + | @builtinispointerinterconvertiblewithclass + | @iscorrespondingmember + | @builtiniscorrespondingmember + | @isboundedarray + | @isunboundedarray + | @isreferenceable + | @isnothrowconvertible + | @referenceconstructsfromtemporary + | @referenceconvertsfromtemporary + | @isconvertible + | @isvalidwinrttype + | @iswinclass + | @iswininterface + | @istriviallyequalitycomparable + | @isscopedenum + | @istriviallyrelocatable + ; + +compound_requirement_is_noexcept( + int expr: @compound_requirement ref +); + +new_allocated_type( + unique int expr: @new_expr ref, + int type_id: @type ref +); + +new_array_allocated_type( + unique int expr: @new_array_expr ref, + int type_id: @type ref +); + +/** + * The field being initialized by an initializer expression within an aggregate + * initializer for a class/struct/union. Position is used to sort repeated initializers. + */ +#keyset[aggregate, position] +aggregate_field_init( + int aggregate: @aggregateliteral ref, + int initializer: @expr ref, + int field: @membervariable ref, + int position: int ref +); + +/** + * The index of the element being initialized by an initializer expression + * within an aggregate initializer for an array. Position is used to sort repeated initializers. + */ +#keyset[aggregate, position] +aggregate_array_init( + int aggregate: @aggregateliteral ref, + int initializer: @expr ref, + int element_index: int ref, + int position: int ref +); + +@ctorinit = @ctordirectinit + | @ctorvirtualinit + | @ctorfieldinit + | @ctordelegatinginit; +@dtordestruct = @dtordirectdestruct + | @dtorvirtualdestruct + | @dtorfielddestruct; + + +condition_decl_bind( + unique int expr: @condition_decl ref, + unique int decl: @declaration ref +); + +typeid_bind( + unique int expr: @type_id ref, + int type_id: @type ref +); + +uuidof_bind( + unique int expr: @uuidof ref, + int type_id: @type ref +); + +@runtime_sizeof_or_alignof = @runtime_sizeof | @runtime_alignof | @datasizeof; + +sizeof_bind( + unique int expr: @runtime_sizeof_or_alignof ref, + int type_id: @type ref +); + +code_block( + unique int block: @literal ref, + unique int routine: @function ref +); + +lambdas( + unique int expr: @lambdaexpr ref, + string default_capture: string ref, + boolean has_explicit_return_type: boolean ref +); + +lambda_capture( + unique int id: @lambdacapture, + int lambda: @lambdaexpr ref, + int index: int ref, + int field: @membervariable ref, + boolean captured_by_reference: boolean ref, + boolean is_implicit: boolean ref, + int location: @location_default ref +); + +@funbindexpr = @routineexpr + | @new_expr + | @delete_expr + | @delete_array_expr + | @ctordirectinit + | @ctorvirtualinit + | @ctordelegatinginit + | @dtordirectdestruct + | @dtorvirtualdestruct; + +@varbindexpr = @varaccess | @ctorfieldinit | @dtorfielddestruct; +@addressable = @function | @variable ; +@accessible = @addressable | @enumconstant ; + +@access = @varaccess | @routineexpr ; + +fold( + int expr: @foldexpr ref, + string operator: string ref, + boolean is_left_fold: boolean ref +); + +stmts( + unique int id: @stmt, + int kind: int ref, + int location: @location_stmt ref +); + +case @stmt.kind of + 1 = @stmt_expr +| 2 = @stmt_if +| 3 = @stmt_while +| 4 = @stmt_goto +| 5 = @stmt_label +| 6 = @stmt_return +| 7 = @stmt_block +| 8 = @stmt_end_test_while // do { ... } while ( ... ) +| 9 = @stmt_for +| 10 = @stmt_switch_case +| 11 = @stmt_switch +| 13 = @stmt_asm // "asm" statement or the body of an asm function +| 15 = @stmt_try_block +| 16 = @stmt_microsoft_try // Microsoft +| 17 = @stmt_decl +| 18 = @stmt_set_vla_size // C99 +| 19 = @stmt_vla_decl // C99 +| 25 = @stmt_assigned_goto // GNU +| 26 = @stmt_empty +| 27 = @stmt_continue +| 28 = @stmt_break +| 29 = @stmt_range_based_for // C++11 +// ... 30 @stmt_at_autoreleasepool_block deprecated +// ... 31 @stmt_objc_for_in deprecated +// ... 32 @stmt_at_synchronized deprecated +| 33 = @stmt_handler +// ... 34 @stmt_finally_end deprecated +| 35 = @stmt_constexpr_if +| 37 = @stmt_co_return +; + +type_vla( + int type_id: @type ref, + int decl: @stmt_vla_decl ref +); + +variable_vla( + int var: @variable ref, + int decl: @stmt_vla_decl ref +); + +if_initialization( + unique int if_stmt: @stmt_if ref, + int init_id: @stmt ref +); + +if_then( + unique int if_stmt: @stmt_if ref, + int then_id: @stmt ref +); + +if_else( + unique int if_stmt: @stmt_if ref, + int else_id: @stmt ref +); + +constexpr_if_initialization( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int init_id: @stmt ref +); + +constexpr_if_then( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int then_id: @stmt ref +); + +constexpr_if_else( + unique int constexpr_if_stmt: @stmt_constexpr_if ref, + int else_id: @stmt ref +); + +while_body( + unique int while_stmt: @stmt_while ref, + int body_id: @stmt ref +); + +do_body( + unique int do_stmt: @stmt_end_test_while ref, + int body_id: @stmt ref +); + +switch_initialization( + unique int switch_stmt: @stmt_switch ref, + int init_id: @stmt ref +); + +#keyset[switch_stmt, index] +switch_case( + int switch_stmt: @stmt_switch ref, + int index: int ref, + int case_id: @stmt_switch_case ref +); + +switch_body( + unique int switch_stmt: @stmt_switch ref, + int body_id: @stmt ref +); + +@stmt_for_or_range_based_for = @stmt_for + | @stmt_range_based_for; + +for_initialization( + unique int for_stmt: @stmt_for_or_range_based_for ref, + int init_id: @stmt ref +); + +for_condition( + unique int for_stmt: @stmt_for ref, + int condition_id: @expr ref +); + +for_update( + unique int for_stmt: @stmt_for ref, + int update_id: @expr ref +); + +for_body( + unique int for_stmt: @stmt_for ref, + int body_id: @stmt ref +); + +@stmtparent = @stmt | @expr_stmt ; +stmtparents( + unique int id: @stmt ref, + int index: int ref, + int parent: @stmtparent ref +); + +ishandler(unique int block: @stmt_block ref); + +@cfgnode = @stmt | @expr | @function | @initialiser ; + +stmt_decl_bind( + int stmt: @stmt_decl ref, + int num: int ref, + int decl: @declaration ref +); + +stmt_decl_entry_bind( + int stmt: @stmt_decl ref, + int num: int ref, + int decl_entry: @element ref +); + +@parameterized_element = @function | @stmt_block | @requires_expr; + +blockscope( + unique int block: @stmt_block ref, + int enclosing: @parameterized_element ref +); + +@jump = @stmt_goto | @stmt_break | @stmt_continue; + +@jumporlabel = @jump | @stmt_label | @literal; + +jumpinfo( + unique int id: @jumporlabel ref, + string str: string ref, + int target: @stmt ref +); + +preprocdirects( + unique int id: @preprocdirect, + int kind: int ref, + int location: @location_default ref +); +case @preprocdirect.kind of + 0 = @ppd_if +| 1 = @ppd_ifdef +| 2 = @ppd_ifndef +| 3 = @ppd_elif +| 4 = @ppd_else +| 5 = @ppd_endif +| 6 = @ppd_plain_include +| 7 = @ppd_define +| 8 = @ppd_undef +| 9 = @ppd_line +| 10 = @ppd_error +| 11 = @ppd_pragma +| 12 = @ppd_objc_import +| 13 = @ppd_include_next +| 18 = @ppd_warning +; + +@ppd_include = @ppd_plain_include | @ppd_objc_import | @ppd_include_next; + +@ppd_branch = @ppd_if | @ppd_ifdef | @ppd_ifndef | @ppd_elif; + +preprocpair( + int begin : @ppd_branch ref, + int elseelifend : @preprocdirect ref +); + +preproctrue(int branch : @ppd_branch ref); +preprocfalse(int branch : @ppd_branch ref); + +preproctext( + unique int id: @preprocdirect ref, + string head: string ref, + string body: string ref +); + +includes( + unique int id: @ppd_include ref, + int included: @file ref +); + +link_targets( + int id: @link_target, + int binary: @file ref +); + +link_parent( + int element : @element ref, + int link_target : @link_target ref +); + +/* XML Files */ + +xmlEncoding(unique int id: @file ref, string encoding: string ref); + +xmlDTDs( + unique int id: @xmldtd, + string root: string ref, + string publicId: string ref, + string systemId: string ref, + int fileid: @file ref +); + +xmlElements( + unique int id: @xmlelement, + string name: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int fileid: @file ref +); + +xmlAttrs( + unique int id: @xmlattribute, + int elementid: @xmlelement ref, + string name: string ref, + string value: string ref, + int idx: int ref, + int fileid: @file ref +); + +xmlNs( + int id: @xmlnamespace, + string prefixName: string ref, + string URI: string ref, + int fileid: @file ref +); + +xmlHasNs( + int elementId: @xmlnamespaceable ref, + int nsId: @xmlnamespace ref, + int fileid: @file ref +); + +xmlComments( + unique int id: @xmlcomment, + string text: string ref, + int parentid: @xmlparent ref, + int fileid: @file ref +); + +xmlChars( + unique int id: @xmlcharacters, + string text: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int isCDATA: int ref, + int fileid: @file ref +); + +@xmlparent = @file | @xmlelement; +@xmlnamespaceable = @xmlelement | @xmlattribute; + +xmllocations( + int xmlElement: @xmllocatable ref, + int location: @location_default ref +); + +@xmllocatable = @xmlcharacters + | @xmlelement + | @xmlcomment + | @xmlattribute + | @xmldtd + | @file + | @xmlnamespace; diff --git a/cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/upgrade.properties b/cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/upgrade.properties new file mode 100644 index 00000000000..08e1dc42eb2 --- /dev/null +++ b/cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/upgrade.properties @@ -0,0 +1,2 @@ +description: Implement compilation_build_mode/2 +compatibility: backwards From 8050b8246b8e2b0a95ba60c390001e278fa57c05 Mon Sep 17 00:00:00 2001 From: Calum Grant Date: Tue, 19 Nov 2024 13:57:03 +0000 Subject: [PATCH 31/47] C++: Update stats --- cpp/ql/lib/semmlecode.cpp.dbscheme.stats | 1096 ++++++++++------------ 1 file changed, 474 insertions(+), 622 deletions(-) diff --git a/cpp/ql/lib/semmlecode.cpp.dbscheme.stats b/cpp/ql/lib/semmlecode.cpp.dbscheme.stats index 7f0d99272e7..f37e932ca54 100644 --- a/cpp/ql/lib/semmlecode.cpp.dbscheme.stats +++ b/cpp/ql/lib/semmlecode.cpp.dbscheme.stats @@ -42,7 +42,7 @@ @macro_expansion - 33257760 + 33257556 @other_macro_reference @@ -78,7 +78,7 @@ @using_enum_declaration - 1 + 0 @static_assert @@ -98,7 +98,7 @@ @localvariable - 576945 + 576944 @enumconstant @@ -362,7 +362,7 @@ @block - 10 + 0 @decltype @@ -406,7 +406,7 @@ @msattribute - 3 + 0 @alignas @@ -422,11 +422,11 @@ @attribute_arg_empty - 1 + 0 @attribute_arg_constant - 1 + 0 @attribute_arg_type @@ -434,7 +434,7 @@ @attribute_arg_expr - 3 + 0 @derivation @@ -482,7 +482,7 @@ @parexpr - 3587463 + 3587464 @arithnegexpr @@ -766,39 +766,39 @@ @jmulexpr - 1 + 0 @jdivexpr - 1 + 0 @fjaddexpr - 1 + 0 @jfaddexpr - 1 + 0 @fjsubexpr - 1 + 0 @jfsubexpr - 1 + 0 @minexpr - 1 + 0 @maxexpr - 1 + 0 @virtfunptrexpr - 1 + 0 @thisaccess @@ -834,43 +834,43 @@ @hasassignexpr - 2 + 0 @hascopyexpr - 2 + 0 @hasnothrowassign - 3 + 0 @hasnothrowconstr - 3 + 0 @hasnothrowcopy - 5 + 0 @hastrivialassign - 2 + 0 @hastrivialconstr - 3 + 0 @hastrivialcopy - 2 + 0 @hasuserdestr - 3 + 0 @hasvirtualdestr - 3 + 0 @isabstractexpr @@ -902,15 +902,15 @@ @ispolyexpr - 3 + 0 @isunionexpr - 5 + 0 @intaddrexpr - 1 + 0 @hastrivialdestructor @@ -930,7 +930,7 @@ @foldexpr - 4 + 0 @ctordirectinit @@ -962,7 +962,7 @@ @static_cast - 215648 + 215647 @reinterpret_cast @@ -994,11 +994,11 @@ @isdestructibleexpr - 4 + 0 @isnothrowdestructibleexpr - 5 + 0 @istriviallydestructibleexpr @@ -1006,7 +1006,7 @@ @istriviallyassignableexpr - 3 + 0 @isnothrowassignableexpr @@ -1018,7 +1018,7 @@ @isstandardlayoutexpr - 2 + 0 @istriviallycopyableexpr @@ -1026,19 +1026,19 @@ @isliteraltypeexpr - 2 + 0 @hastrivialmoveconstructorexpr - 3 + 0 @hastrivialmoveassignexpr - 3 + 0 @hasnothrowmoveassignexpr - 4 + 0 @isconstructibleexpr @@ -1050,35 +1050,35 @@ @hasfinalizerexpr - 1 + 0 @isdelegateexpr - 1 + 0 @isinterfaceclassexpr - 1 + 0 @isrefarrayexpr - 1 + 0 @isrefclassexpr - 1 + 0 @issealedexpr - 1 + 0 @issimplevalueclassexpr - 1 + 0 @isvalueclassexpr - 1 + 0 @isfinalexpr @@ -1090,7 +1090,7 @@ @builtinshufflevector - 1 + 0 @builtinchooseexpr @@ -1102,43 +1102,43 @@ @vec_fill - 1 + 0 @builtinconvertvector - 1 + 0 @builtincomplex - 4 + 0 @spaceshipexpr - 1 + 0 @co_await - 12 + 0 @co_yield - 4 + 0 @isassignable - 3 + 0 @isaggregate - 2 + 0 @hasuniqueobjectrepresentations - 2 + 0 @builtinbitcast - 1 + 0 @builtinshuffle @@ -1150,111 +1150,111 @@ @issame - 2 + 0 @isfunction - 2 + 0 @islayoutcompatible - 2 + 0 @ispointerinterconvertiblebaseof - 2 + 0 @isarray - 2 + 0 @arrayrank - 2 + 0 @arrayextent - 3 + 0 @isarithmetic - 2 + 0 @iscompletetype - 2 + 0 @iscompound - 2 + 0 @isconst - 2 + 0 @isfloatingpoint - 2 + 0 @isfundamental - 2 + 0 @isintegral - 2 + 0 @islvaluereference - 2 + 0 @ismemberfunctionpointer - 2 + 0 @ismemberobjectpointer - 2 + 0 @ismemberpointer - 3 + 0 @isobject - 2 + 0 @ispointer - 2 + 0 @isreference - 2 + 0 @isrvaluereference - 2 + 0 @isscalar - 2 + 0 @issigned - 2 + 0 @isunsigned - 2 + 0 @isvoid - 2 + 0 @isvolatile - 2 + 0 @reuseexpr @@ -1262,115 +1262,115 @@ @istriviallycopyassignable - 2 + 0 @isassignablenopreconditioncheck - 3 + 0 @referencebindstotemporary - 2 + 0 @issameas - 2 + 0 @builtinhasattribute - 2 + 0 @ispointerinterconvertiblewithclass - 2 + 0 @builtinispointerinterconvertiblewithclass - 2 + 0 @iscorrespondingmember - 2 + 0 @builtiniscorrespondingmember - 2 + 0 @isboundedarray - 2 + 0 @isunboundedarray - 2 + 0 @isreferenceable - 2 + 0 @isnothrowconvertible - 2 + 0 @referenceconstructsfromtemporary - 2 + 0 @referenceconvertsfromtemporary - 2 + 0 @isconvertible - 2 + 0 @isvalidwinrttype - 1 + 0 @iswinclass - 1 + 0 @iswininterface - 1 + 0 @istriviallyequalitycomparable - 2 + 0 @isscopedenum - 2 + 0 @istriviallyrelocatable - 2 + 0 @datasizeof - 10 + 0 @c11_generic - 8 + 0 @requires_expr - 8 + 0 @nested_requirement - 1 + 0 @compound_requirement - 2 + 0 @concept_id - 2 + 0 @lambdacapture @@ -1426,7 +1426,7 @@ @stmt_decl - 593121 + 593118 @stmt_empty @@ -1474,7 +1474,7 @@ @stmt_co_return - 5 + 0 @ppd_if @@ -1530,11 +1530,11 @@ @ppd_objc_import - 2 + 0 @ppd_warning - 1 + 0 @link_target @@ -1900,6 +1900,48 @@ + + compilation_build_mode + 0 + + + id + 0 + + + mode + 0 + + + + + id + mode + + + 12 + + + 1 + 2 + 17 + + + + + + + mode + id + + + 12 + + + + + + compilation_compiling_files 11546 @@ -2164,7 +2206,7 @@ seconds - 8429 + 9468 @@ -2242,18 +2284,23 @@ 12 + + 2 + 3 + 39 + 3 4 - 639 + 479 4 5 - 359 + 479 - 6 + 5 7 119 @@ -2265,27 +2312,27 @@ 10 11 - 119 - - - 11 - 15 159 - 16 + 11 + 17 + 159 + + + 17 19 159 19 - 24 + 44 159 - 40 - 89 - 119 + 54 + 100 + 79 @@ -2353,43 +2400,43 @@ 3 4 - 1438 + 1398 4 5 - 319 + 359 5 6 - 199 + 159 6 7 - 439 + 519 7 8 - 159 + 79 8 - 10 + 9 + 239 + + + 9 + 21 279 - 10 - 26 + 24 + 86 279 - - 28 - 81 - 199 - @@ -2439,13 +2486,13 @@ 79 - 125 - 126 + 141 + 142 39 - 128 - 129 + 145 + 146 39 @@ -2462,27 +2509,27 @@ 1 2 - 3635 + 4234 2 3 - 1917 + 2357 3 4 - 1558 + 1797 4 6 - 719 + 838 6 48 - 599 + 239 @@ -2498,37 +2545,32 @@ 1 2 - 3595 + 4274 2 3 - 1438 + 1757 3 4 - 1358 + 1158 4 5 - 639 + 1158 5 - 6 - 479 + 7 + 799 - 6 - 8 - 679 - - - 8 - 73 - 239 + 7 + 74 + 319 @@ -2544,12 +2586,12 @@ 1 2 - 6512 + 7271 2 3 - 1917 + 2197 @@ -2893,7 +2935,7 @@ cpu_seconds - 7507 + 7382 elapsed_seconds @@ -2943,16 +2985,16 @@ 1 2 - 6242 + 5881 2 3 - 835 + 1072 3 - 15 + 12 428 @@ -2969,12 +3011,12 @@ 1 2 - 6976 + 6694 2 3 - 530 + 688 @@ -2987,24 +3029,14 @@ 12 - - 1 - 2 - 11 - 2 3 - 11 + 33 - 3 - 4 - 11 - - - 6 - 7 + 7 + 8 11 @@ -3013,8 +3045,8 @@ 11 - 11 - 12 + 10 + 11 11 @@ -3023,28 +3055,28 @@ 11 - 49 - 50 + 50 + 51 11 - 154 - 155 + 163 + 164 11 - 160 - 161 + 165 + 166 11 - 204 - 205 + 194 + 195 11 - 248 - 249 + 243 + 244 11 @@ -3058,24 +3090,14 @@ 12 - - 1 - 2 - 11 - 2 3 - 11 + 33 - 3 - 4 - 11 - - - 6 - 7 + 7 + 8 11 @@ -3084,8 +3106,8 @@ 11 - 11 - 12 + 10 + 11 11 @@ -3094,28 +3116,28 @@ 11 - 47 - 48 + 48 + 49 11 - 118 - 119 + 120 + 121 11 - 128 - 129 + 137 + 138 11 - 149 - 150 + 146 + 147 11 - 222 - 223 + 216 + 217 11 @@ -11816,7 +11838,7 @@ fileannotations - 5129436 + 5129404 id @@ -12392,15 +12414,15 @@ inmacroexpansion - 109779080 + 109779103 id - 18027694 + 18027697 inv - 2700160 + 2700159 @@ -12414,12 +12436,12 @@ 1 3 - 1582361 + 1582360 3 5 - 1077793 + 1077794 5 @@ -12429,17 +12451,17 @@ 6 7 - 4819903 + 4819904 7 8 - 6385932 + 6385934 8 9 - 2605242 + 2605243 9 @@ -12460,12 +12482,12 @@ 1 2 - 378424 + 378422 2 3 - 544104 + 544105 3 @@ -12500,7 +12522,7 @@ 11 337 - 224847 + 224845 339 @@ -12520,15 +12542,15 @@ affectedbymacroexpansion - 35689251 + 35689257 id - 5156949 + 5156948 inv - 2784762 + 2784761 @@ -12542,7 +12564,7 @@ 1 2 - 2816079 + 2816078 2 @@ -12588,7 +12610,7 @@ 1 4 - 229116 + 229115 4 @@ -12603,12 +12625,12 @@ 9 12 - 251119 + 251120 12 13 - 333984 + 333985 13 @@ -12628,7 +12650,7 @@ 16 17 - 276608 + 276609 17 @@ -12658,19 +12680,19 @@ macroinvocations - 33491008 + 33490802 id - 33491008 + 33490802 macro_id - 79484 + 79483 location - 760387 + 760382 kind @@ -12688,7 +12710,7 @@ 1 2 - 33491008 + 33490802 @@ -12704,7 +12726,7 @@ 1 2 - 33491008 + 33490802 @@ -12720,7 +12742,7 @@ 1 2 - 33491008 + 33490802 @@ -12802,7 +12824,7 @@ 1 2 - 42468 + 42467 2 @@ -12848,7 +12870,7 @@ 1 2 - 73749 + 73748 2 @@ -12869,22 +12891,22 @@ 1 2 - 281225 + 281223 2 3 - 169658 + 169657 3 4 - 70735 + 70734 4 5 - 60327 + 60326 5 @@ -12920,7 +12942,7 @@ 1 2 - 714216 + 714211 2 @@ -12941,7 +12963,7 @@ 1 2 - 760387 + 760382 @@ -13014,15 +13036,15 @@ macroparent - 29950722 + 29950538 id - 29950722 + 29950538 parent_id - 23286998 + 23286856 @@ -13036,7 +13058,7 @@ 1 2 - 29950722 + 29950538 @@ -13052,17 +13074,17 @@ 1 2 - 17992792 + 17992681 2 3 - 4459550 + 4459523 3 88 - 834655 + 834650 @@ -13150,11 +13172,11 @@ macro_argument_unexpanded - 84549437 + 84548918 invocation - 26214757 + 26214596 argument_index @@ -13162,7 +13184,7 @@ text - 318308 + 318306 @@ -13176,22 +13198,22 @@ 1 2 - 7432464 + 7432418 2 3 - 10674027 + 10673962 3 4 - 6139327 + 6139289 4 67 - 1968937 + 1968925 @@ -13207,22 +13229,22 @@ 1 2 - 7502624 + 7502578 2 3 - 10820578 + 10820511 3 4 - 5972999 + 5972962 4 67 - 1918556 + 1918544 @@ -13290,12 +13312,12 @@ 1 2 - 35074 + 35073 2 3 - 61264 + 61263 3 @@ -13305,12 +13327,12 @@ 4 5 - 45087 + 45086 5 7 - 23932 + 23931 7 @@ -13356,7 +13378,7 @@ 1 2 - 230200 + 230198 2 @@ -13366,7 +13388,7 @@ 3 9 - 10284 + 10283 @@ -13376,11 +13398,11 @@ macro_argument_expanded - 84549437 + 84548918 invocation - 26214757 + 26214596 argument_index @@ -13388,7 +13410,7 @@ text - 192902 + 192900 @@ -13402,22 +13424,22 @@ 1 2 - 7432464 + 7432418 2 3 - 10674027 + 10673962 3 4 - 6139327 + 6139289 4 67 - 1968937 + 1968925 @@ -13433,22 +13455,22 @@ 1 2 - 10688793 + 10688727 2 3 - 9201862 + 9201805 3 4 - 5208277 + 5208245 4 9 - 1115824 + 1115817 @@ -13587,7 +13609,7 @@ 1 2 - 97625 + 97624 2 @@ -13919,15 +13941,15 @@ coroutine - 6 + 0 function - 6 + 0 traits - 3 + 0 @@ -13941,7 +13963,7 @@ 1 2 - 6 + 17 @@ -13953,23 +13975,7 @@ 12 - - - 1 - 2 - 1 - - - 2 - 3 - 1 - - - 3 - 4 - 1 - - + @@ -13977,19 +13983,19 @@ coroutine_placeholder_variable - 18 + 0 placeholder_variable - 18 + 0 kind - 3 + 0 function - 6 + 0 @@ -14003,7 +14009,7 @@ 1 2 - 18 + 17 @@ -14019,7 +14025,7 @@ 1 2 - 18 + 17 @@ -14031,13 +14037,7 @@ 12 - - - 6 - 7 - 3 - - + @@ -14047,13 +14047,7 @@ 12 - - - 6 - 7 - 3 - - + @@ -14063,13 +14057,7 @@ 12 - - - 3 - 4 - 6 - - + @@ -14079,13 +14067,7 @@ 12 - - - 3 - 4 - 6 - - + @@ -14093,15 +14075,15 @@ coroutine_new - 6 + 0 function - 6 + 0 new - 1 + 0 @@ -14115,7 +14097,7 @@ 1 2 - 6 + 17 @@ -14127,13 +14109,7 @@ 12 - - - 6 - 7 - 1 - - + @@ -14141,15 +14117,15 @@ coroutine_delete - 6 + 0 function - 6 + 0 delete - 1 + 0 @@ -14163,7 +14139,7 @@ 1 2 - 6 + 17 @@ -14175,13 +14151,7 @@ 12 - - - 6 - 7 - 1 - - + @@ -15023,19 +14993,19 @@ fun_decl_throws - 7 + 0 fun_decl - 7 + 0 index - 1 + 0 type_id - 2 + 0 @@ -15045,13 +15015,7 @@ 12 - - - 1 - 2 - 7 - - + @@ -15061,13 +15025,7 @@ 12 - - - 1 - 2 - 7 - - + @@ -15077,13 +15035,7 @@ 12 - - - 7 - 8 - 1 - - + @@ -15093,13 +15045,7 @@ 12 - - - 2 - 3 - 1 - - + @@ -15109,18 +15055,7 @@ 12 - - - 1 - 2 - 1 - - - 6 - 7 - 1 - - + @@ -15130,13 +15065,7 @@ 12 - - - 1 - 2 - 2 - - + @@ -16260,11 +16189,11 @@ is_structured_binding - 18 + 0 id - 18 + 0 @@ -17076,7 +17005,7 @@ using_container - 466800 + 466798 parent @@ -17084,7 +17013,7 @@ child - 295990 + 295989 @@ -17154,12 +17083,12 @@ 1 2 - 218313 + 218311 2 3 - 51725 + 51724 3 @@ -18713,11 +18642,11 @@ localvariables - 576945 + 576944 id - 576945 + 576944 type_id @@ -18739,7 +18668,7 @@ 1 2 - 576945 + 576944 @@ -18755,7 +18684,7 @@ 1 2 - 576945 + 576944 @@ -18776,7 +18705,7 @@ 2 3 - 5366 + 5362 3 @@ -18786,7 +18715,7 @@ 4 7 - 3376 + 3380 7 @@ -18812,7 +18741,7 @@ 1 2 - 26912 + 26908 2 @@ -18822,7 +18751,7 @@ 3 5 - 2914 + 2918 5 @@ -21442,15 +21371,15 @@ typedefbase - 1686109 + 1686099 id - 1686109 + 1686099 type_id - 793485 + 793481 @@ -21464,7 +21393,7 @@ 1 2 - 1686109 + 1686099 @@ -21480,12 +21409,12 @@ 1 2 - 617404 + 617400 2 3 - 83254 + 83253 3 @@ -22428,11 +22357,11 @@ is_pod_class - 534713 + 534710 id - 534713 + 534710 @@ -22560,11 +22489,11 @@ class_template_argument - 2882750 + 2882732 type_id - 1315511 + 1315503 index @@ -22572,7 +22501,7 @@ arg_type - 840390 + 840385 @@ -22586,22 +22515,22 @@ 1 2 - 540956 + 540953 2 3 - 399237 + 399235 3 4 - 231396 + 231395 4 7 - 120315 + 120314 7 @@ -22622,17 +22551,17 @@ 1 2 - 567609 + 567605 2 3 - 410481 + 410478 3 4 - 244841 + 244840 4 @@ -22745,17 +22674,17 @@ 1 2 - 523346 + 523343 2 3 - 174343 + 174342 3 4 - 51341 + 51340 4 @@ -22781,7 +22710,7 @@ 1 2 - 746490 + 746486 2 @@ -25019,7 +24948,7 @@ funspecifiers - 10305080 + 10304614 func_id @@ -25046,12 +24975,12 @@ 2 3 - 640536 + 641003 3 4 - 985549 + 985082 4 @@ -25160,8 +25089,8 @@ 466 - 6435 - 6436 + 6434 + 6435 466 @@ -26478,15 +26407,15 @@ attribute_arg_expr - 3 + 0 arg - 3 + 0 expr - 3 + 0 @@ -26500,7 +26429,7 @@ 1 2 - 3 + 17 @@ -26512,13 +26441,7 @@ 12 - - - 1 - 2 - 3 - - + @@ -26526,15 +26449,15 @@ attribute_arg_name - 6 + 0 arg - 6 + 0 name - 5 + 0 @@ -26548,7 +26471,7 @@ 1 2 - 6 + 17 @@ -26560,18 +26483,7 @@ 12 - - - 1 - 2 - 4 - - - 2 - 3 - 1 - - + @@ -27215,11 +27127,11 @@ enclosingfunction - 118328 + 118327 child - 118328 + 118327 parent @@ -27237,7 +27149,7 @@ 1 2 - 118328 + 118327 @@ -27268,7 +27180,7 @@ 4 45 - 4888 + 4887 @@ -28793,15 +28705,15 @@ exprconv - 7032991 + 7032993 converted - 7032991 + 7032993 conversion - 7032991 + 7032993 @@ -28815,7 +28727,7 @@ 1 2 - 7032991 + 7032993 @@ -28831,7 +28743,7 @@ 1 2 - 7032991 + 7032993 @@ -30261,7 +30173,7 @@ fun - 511342 + 511304 @@ -30296,12 +30208,12 @@ 1 2 - 315088 + 315012 2 3 - 77893 + 77931 3 @@ -32081,15 +31993,15 @@ expr_types - 18451442 + 18451396 id - 18319781 + 18319782 typeid - 1214623 + 1214616 value_category @@ -32107,12 +32019,12 @@ 1 2 - 18188121 + 18188167 2 3 - 131660 + 131614 @@ -32128,7 +32040,7 @@ 1 2 - 18319781 + 18319782 @@ -32144,17 +32056,17 @@ 1 2 - 438567 + 438565 2 3 - 249334 + 249332 3 4 - 102840 + 102839 4 @@ -32164,12 +32076,12 @@ 5 8 - 109275 + 109274 8 14 - 96496 + 96495 14 @@ -32179,7 +32091,7 @@ 41 125325 - 44579 + 44578 @@ -32195,7 +32107,7 @@ 1 2 - 1050237 + 1050230 2 @@ -32229,8 +32141,8 @@ 11 - 1239479 - 1239480 + 1239489 + 1239490 11 @@ -32267,11 +32179,11 @@ compound_requirement_is_noexcept - 1 + 0 expr - 1 + 0 @@ -33658,15 +33570,15 @@ code_block - 15 + 0 block - 15 + 0 routine - 15 + 0 @@ -33680,7 +33592,7 @@ 1 2 - 15 + 17 @@ -33696,7 +33608,7 @@ 1 2 - 15 + 17 @@ -34585,19 +34497,19 @@ fold - 4 + 0 expr - 4 + 0 operator - 4 + 0 is_left_fold - 2 + 0 @@ -34607,13 +34519,7 @@ 12 - - - 1 - 2 - 4 - - + @@ -34623,13 +34529,7 @@ 12 - - - 1 - 2 - 4 - - + @@ -34639,13 +34539,7 @@ 12 - - - 1 - 2 - 4 - - + @@ -34655,13 +34549,7 @@ 12 - - - 1 - 2 - 4 - - + @@ -34671,13 +34559,7 @@ 12 - - - 2 - 3 - 2 - - + @@ -34687,13 +34569,7 @@ 12 - - - 2 - 3 - 2 - - + @@ -35017,15 +34893,15 @@ type_vla - 1 + 0 type_id - 1 + 0 decl - 1 + 0 @@ -35035,13 +34911,7 @@ 12 - - - 1 - 2 - 1 - - + @@ -35051,13 +34921,7 @@ 12 - - - 1 - 2 - 1 - - + @@ -35257,15 +35121,15 @@ constexpr_if_initialization - 3 + 0 constexpr_if_stmt - 3 + 0 init_id - 3 + 0 @@ -35279,7 +35143,7 @@ 1 2 - 3 + 17 @@ -35291,13 +35155,7 @@ 12 - - - 1 - 2 - 3 - - + @@ -35497,15 +35355,15 @@ switch_initialization - 8 + 0 switch_stmt - 8 + 0 init_id - 8 + 0 @@ -35519,7 +35377,7 @@ 1 2 - 8 + 17 @@ -35531,13 +35389,7 @@ 12 - - - 1 - 2 - 8 - - + @@ -36318,11 +36170,11 @@ stmt_decl_bind - 580842 + 580841 stmt - 541060 + 541059 num @@ -36330,7 +36182,7 @@ decl - 580738 + 580737 @@ -36589,7 +36441,7 @@ 1 2 - 580738 + 580737 @@ -36599,11 +36451,11 @@ stmt_decl_entry_bind - 580842 + 580841 stmt - 541060 + 541059 num @@ -36611,7 +36463,7 @@ decl_entry - 580784 + 580783 @@ -36849,7 +36701,7 @@ 1 2 - 580763 + 580762 3 @@ -36870,7 +36722,7 @@ 1 2 - 580784 + 580783 From d3e44028ea5aa69b7ece8a2f11fa91e86440f676 Mon Sep 17 00:00:00 2001 From: Calum Grant Date: Tue, 19 Nov 2024 14:17:36 +0000 Subject: [PATCH 32/47] C++: Fix upgrade.properties --- .../f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties b/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties index 08e1dc42eb2..53cac4c4fec 100644 --- a/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties +++ b/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties @@ -1,2 +1,3 @@ description: Implement compilation_build_mode/2 compatibility: backwards +compilation_build_mode.rel: delete From 38fa3c10d620bde39a8e555ecdec768fda44d020 Mon Sep 17 00:00:00 2001 From: Calum Grant <42069085+calumgrant@users.noreply.github.com> Date: Tue, 19 Nov 2024 14:30:20 +0000 Subject: [PATCH 33/47] Update cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com> --- .../f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties b/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties index 53cac4c4fec..cf362f384da 100644 --- a/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties +++ b/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties @@ -1,3 +1,3 @@ description: Implement compilation_build_mode/2 -compatibility: backwards +compatibility: full compilation_build_mode.rel: delete From 0836c3d6a51a98a9fac999fe63c434106971c2d7 Mon Sep 17 00:00:00 2001 From: Calum Grant Date: Tue, 19 Nov 2024 14:42:23 +0000 Subject: [PATCH 34/47] C++: Update stats --- cpp/ql/lib/semmlecode.cpp.dbscheme.stats | 3321 ++++++++++++---------- 1 file changed, 1766 insertions(+), 1555 deletions(-) diff --git a/cpp/ql/lib/semmlecode.cpp.dbscheme.stats b/cpp/ql/lib/semmlecode.cpp.dbscheme.stats index f37e932ca54..758aba34608 100644 --- a/cpp/ql/lib/semmlecode.cpp.dbscheme.stats +++ b/cpp/ql/lib/semmlecode.cpp.dbscheme.stats @@ -18,7 +18,7 @@ @location_default - 29764890 + 29746763 @location_stmt @@ -34,35 +34,35 @@ @file - 123251 + 123176 @folder - 16340 + 16330 @macro_expansion - 33257556 + 33257760 @other_macro_reference - 859029 + 858505 @function - 4179363 + 4176817 @fun_decl - 4543516 + 4541216 @var_decl - 8039391 + 8034962 @type_decl - 3283451 + 3281452 @namespace_decl @@ -70,15 +70,15 @@ @using_declaration - 363219 + 362998 @using_directive - 6536 + 6532 @using_enum_declaration - 0 + 1 @static_assert @@ -86,7 +86,7 @@ @parameter - 6190611 + 6186841 @membervariable @@ -98,7 +98,7 @@ @localvariable - 576944 + 576952 @enumconstant @@ -330,15 +330,15 @@ @pointer - 568173 + 567827 @type_with_specifiers - 852026 + 851507 @array - 110179 + 110112 @routineptr @@ -346,7 +346,7 @@ @reference - 1276405 + 1275627 @gnu_vector @@ -358,23 +358,23 @@ @rvalue_reference - 333340 + 333137 @block - 0 + 10 @decltype - 27078 + 27061 @usertype - 5234008 + 5230820 @mangledname - 6061757 + 6058065 @type_mention @@ -386,15 +386,15 @@ @ptrtomember - 37815 + 37792 @specifier - 24743 + 24728 @gnuattribute - 553700 + 553363 @stdattribute @@ -406,27 +406,27 @@ @msattribute - 0 + 3 @alignas - 4668 + 4665 @attribute_arg_token - 25210 + 25195 @attribute_arg_constant_expr - 318400 + 318207 @attribute_arg_empty - 0 + 1 @attribute_arg_constant - 0 + 1 @attribute_arg_type @@ -434,7 +434,7 @@ @attribute_arg_expr - 0 + 3 @derivation @@ -450,7 +450,7 @@ @namespace - 12138 + 12131 @specialnamequalifyingelement @@ -582,11 +582,11 @@ @gtexpr - 104110 + 104047 @ltexpr - 101776 + 101714 @geexpr @@ -634,7 +634,7 @@ @assignorexpr - 23627 + 23628 @assignxorexpr @@ -662,11 +662,11 @@ @subscriptexpr - 364477 + 364481 @callexpr - 316533 + 316340 @vastartexpr @@ -678,7 +678,7 @@ @vaendexpr - 2801 + 2799 @vacopyexpr @@ -766,39 +766,39 @@ @jmulexpr - 0 + 1 @jdivexpr - 0 + 1 @fjaddexpr - 0 + 1 @jfaddexpr - 0 + 1 @fjsubexpr - 0 + 1 @jfsubexpr - 0 + 1 @minexpr - 0 + 1 @maxexpr - 0 + 1 @virtfunptrexpr - 0 + 1 @thisaccess @@ -830,47 +830,47 @@ @sizeof_pack - 5602 + 5598 @hasassignexpr - 0 + 2 @hascopyexpr - 0 + 2 @hasnothrowassign - 0 + 3 @hasnothrowconstr - 0 + 3 @hasnothrowcopy - 0 + 5 @hastrivialassign - 0 + 2 @hastrivialconstr - 0 + 3 @hastrivialcopy - 0 + 2 @hasuserdestr - 0 + 3 @hasvirtualdestr - 0 + 3 @isabstractexpr @@ -902,15 +902,15 @@ @ispolyexpr - 0 + 3 @isunionexpr - 0 + 5 @intaddrexpr - 0 + 1 @hastrivialdestructor @@ -930,7 +930,7 @@ @foldexpr - 0 + 4 @ctordirectinit @@ -962,7 +962,7 @@ @static_cast - 215647 + 215648 @reinterpret_cast @@ -978,7 +978,7 @@ @lambdaexpr - 21475 + 21462 @param_ref @@ -994,11 +994,11 @@ @isdestructibleexpr - 0 + 4 @isnothrowdestructibleexpr - 0 + 5 @istriviallydestructibleexpr @@ -1006,7 +1006,7 @@ @istriviallyassignableexpr - 0 + 3 @isnothrowassignableexpr @@ -1018,27 +1018,27 @@ @isstandardlayoutexpr - 0 + 2 @istriviallycopyableexpr - 3734 + 3732 @isliteraltypeexpr - 0 + 2 @hastrivialmoveconstructorexpr - 0 + 3 @hastrivialmoveassignexpr - 0 + 3 @hasnothrowmoveassignexpr - 0 + 4 @isconstructibleexpr @@ -1050,35 +1050,35 @@ @hasfinalizerexpr - 0 + 1 @isdelegateexpr - 0 + 1 @isinterfaceclassexpr - 0 + 1 @isrefarrayexpr - 0 + 1 @isrefclassexpr - 0 + 1 @issealedexpr - 0 + 1 @issimplevalueclassexpr - 0 + 1 @isvalueclassexpr - 0 + 1 @isfinalexpr @@ -1090,7 +1090,7 @@ @builtinshufflevector - 0 + 1 @builtinchooseexpr @@ -1102,43 +1102,43 @@ @vec_fill - 0 + 1 @builtinconvertvector - 0 + 1 @builtincomplex - 0 + 4 @spaceshipexpr - 0 + 1 @co_await - 0 + 12 @co_yield - 0 + 4 @isassignable - 0 + 3 @isaggregate - 0 + 2 @hasuniqueobjectrepresentations - 0 + 2 @builtinbitcast - 0 + 1 @builtinshuffle @@ -1150,111 +1150,111 @@ @issame - 0 + 2 @isfunction - 0 + 2 @islayoutcompatible - 0 + 2 @ispointerinterconvertiblebaseof - 0 + 2 @isarray - 0 + 2 @arrayrank - 0 + 2 @arrayextent - 0 + 3 @isarithmetic - 0 + 2 @iscompletetype - 0 + 2 @iscompound - 0 + 2 @isconst - 0 + 2 @isfloatingpoint - 0 + 2 @isfundamental - 0 + 2 @isintegral - 0 + 2 @islvaluereference - 0 + 2 @ismemberfunctionpointer - 0 + 2 @ismemberobjectpointer - 0 + 2 @ismemberpointer - 0 + 3 @isobject - 0 + 2 @ispointer - 0 + 2 @isreference - 0 + 2 @isrvaluereference - 0 + 2 @isscalar - 0 + 2 @issigned - 0 + 2 @isunsigned - 0 + 2 @isvoid - 0 + 2 @isvolatile - 0 + 2 @reuseexpr @@ -1262,119 +1262,119 @@ @istriviallycopyassignable - 0 + 2 @isassignablenopreconditioncheck - 0 + 3 @referencebindstotemporary - 0 + 2 @issameas - 0 + 2 @builtinhasattribute - 0 + 2 @ispointerinterconvertiblewithclass - 0 + 2 @builtinispointerinterconvertiblewithclass - 0 + 2 @iscorrespondingmember - 0 + 2 @builtiniscorrespondingmember - 0 + 2 @isboundedarray - 0 + 2 @isunboundedarray - 0 + 2 @isreferenceable - 0 + 2 @isnothrowconvertible - 0 + 2 @referenceconstructsfromtemporary - 0 + 2 @referenceconvertsfromtemporary - 0 + 2 @isconvertible - 0 + 2 @isvalidwinrttype - 0 + 1 @iswinclass - 0 + 1 @iswininterface - 0 + 1 @istriviallyequalitycomparable - 0 + 2 @isscopedenum - 0 + 2 @istriviallyrelocatable - 0 + 2 @datasizeof - 0 + 10 @c11_generic - 0 + 8 @requires_expr - 0 + 8 @nested_requirement - 0 + 1 @compound_requirement - 0 + 2 @concept_id - 0 + 2 @lambdacapture - 28011 + 27994 @stmt_expr @@ -1398,11 +1398,11 @@ @stmt_return - 1280140 + 1279827 @stmt_block - 1419265 + 1418867 @stmt_end_test_while @@ -1426,11 +1426,11 @@ @stmt_decl - 593118 + 593121 @stmt_empty - 192682 + 192685 @stmt_continue @@ -1462,7 +1462,7 @@ @stmt_range_based_for - 8403 + 8398 @stmt_handler @@ -1474,35 +1474,35 @@ @stmt_co_return - 0 + 5 @ppd_if - 667148 + 666741 @ppd_ifdef - 263311 + 263150 @ppd_ifndef - 266579 + 266416 @ppd_elif - 25210 + 25195 @ppd_else - 209154 + 209027 @ppd_endif - 1197038 + 1196309 @ppd_plain_include - 311398 + 311208 @ppd_define @@ -1510,15 +1510,15 @@ @ppd_undef - 258642 + 258484 @ppd_include_next - 1867 + 1866 @ppd_line - 27520 + 27521 @ppd_error @@ -1530,11 +1530,11 @@ @ppd_objc_import - 0 + 2 @ppd_warning - 0 + 1 @link_target @@ -1902,15 +1902,15 @@ compilation_build_mode - 0 + 9742 id - 0 + 9742 mode - 0 + 11 @@ -1924,7 +1924,7 @@ 1 2 - 17 + 9742 @@ -1936,7 +1936,13 @@ 12 - + + + 863 + 864 + 11 + + @@ -2206,7 +2212,7 @@ seconds - 9468 + 8030 @@ -2284,20 +2290,15 @@ 12 - - 2 - 3 - 39 - 3 4 - 479 + 799 4 5 - 479 + 199 5 @@ -2306,32 +2307,37 @@ 8 + 9 + 79 + + + 9 10 - 159 + 119 10 - 11 + 12 159 - 11 - 17 - 159 + 12 + 16 + 119 17 - 19 + 20 159 - 19 - 44 + 21 + 42 159 - 54 - 100 + 55 + 90 79 @@ -2400,27 +2406,27 @@ 3 4 - 1398 + 1438 4 5 - 359 + 319 5 6 - 159 + 199 6 7 - 519 + 399 7 8 - 79 + 159 8 @@ -2429,12 +2435,12 @@ 9 - 21 + 24 279 - 24 - 86 + 25 + 85 279 @@ -2486,13 +2492,13 @@ 79 - 141 - 142 + 124 + 125 39 - 145 - 146 + 128 + 129 39 @@ -2509,27 +2515,37 @@ 1 2 - 4234 + 3755 2 3 - 2357 + 1398 3 4 - 1797 + 998 4 + 5 + 759 + + + 5 6 - 838 + 439 6 - 48 - 239 + 25 + 639 + + + 46 + 47 + 39 @@ -2545,31 +2561,36 @@ 1 2 - 4274 + 3515 2 3 - 1757 + 1278 3 4 - 1158 + 599 4 5 - 1158 + 878 5 - 7 - 799 + 6 + 759 - 7 - 74 + 6 + 8 + 679 + + + 8 + 76 319 @@ -2586,12 +2607,12 @@ 1 2 - 7271 + 5753 2 3 - 2197 + 2277 @@ -2935,7 +2956,7 @@ cpu_seconds - 7382 + 7292 elapsed_seconds @@ -2985,17 +3006,17 @@ 1 2 - 5881 + 5937 2 3 - 1072 + 846 3 - 12 - 428 + 16 + 507 @@ -3011,12 +3032,12 @@ 1 2 - 6694 + 6682 2 3 - 688 + 609 @@ -3029,10 +3050,20 @@ 12 + + 1 + 2 + 11 + 2 3 - 33 + 11 + + + 3 + 4 + 11 7 @@ -3040,23 +3071,23 @@ 11 - 9 - 10 + 8 + 9 11 - 10 - 11 + 12 + 13 11 - 16 - 17 + 13 + 14 11 - 50 - 51 + 51 + 52 11 @@ -3065,18 +3096,18 @@ 11 - 165 - 166 + 167 + 168 11 - 194 - 195 + 187 + 188 11 - 243 - 244 + 249 + 250 11 @@ -3090,10 +3121,20 @@ 12 + + 1 + 2 + 11 + 2 3 - 33 + 11 + + + 3 + 4 + 11 7 @@ -3101,23 +3142,23 @@ 11 - 9 - 10 + 8 + 9 11 - 10 - 11 + 12 + 13 11 - 16 - 17 + 13 + 14 11 - 48 - 49 + 49 + 50 11 @@ -3126,18 +3167,18 @@ 11 - 137 - 138 + 123 + 124 11 - 146 - 147 + 138 + 139 11 - 216 - 217 + 224 + 225 11 @@ -4910,31 +4951,31 @@ locations_default - 29764890 + 29746763 id - 29764890 + 29746763 container - 123251 + 123176 startLine - 2095283 + 2094007 startColumn - 36882 + 36859 endLine - 2099485 + 2098207 endColumn - 48086 + 48057 @@ -4948,7 +4989,7 @@ 1 2 - 29764890 + 29746763 @@ -4964,7 +5005,7 @@ 1 2 - 29764890 + 29746763 @@ -4980,7 +5021,7 @@ 1 2 - 29764890 + 29746763 @@ -4996,7 +5037,7 @@ 1 2 - 29764890 + 29746763 @@ -5012,7 +5053,7 @@ 1 2 - 29764890 + 29746763 @@ -5028,67 +5069,67 @@ 1 11 - 9804 + 9798 11 18 - 10270 + 10264 18 30 - 9337 + 9331 30 42 - 9804 + 9798 43 61 - 9804 + 9798 61 79 - 9337 + 9331 80 106 - 9804 + 9798 108 149 - 9337 + 9331 149 199 - 9337 + 9331 206 291 - 9337 + 9331 304 469 - 9337 + 9331 482 850 - 9337 + 9331 936 2380 - 8403 + 8398 @@ -5104,67 +5145,67 @@ 1 8 - 9337 + 9331 8 13 - 9337 + 9331 13 20 - 9804 + 9798 20 32 - 9337 + 9331 32 43 - 9804 + 9798 44 61 - 9337 + 9331 62 72 - 9337 + 9331 73 93 - 9337 + 9331 97 128 - 9337 + 9331 128 180 - 9337 + 9331 180 267 - 9337 + 9331 277 414 - 9337 + 9331 439 1465 - 9337 + 9331 1557 @@ -5185,67 +5226,67 @@ 1 4 - 8870 + 8865 4 5 - 7936 + 7931 5 6 - 7469 + 7465 6 8 - 11204 + 11197 8 10 - 9337 + 9331 10 15 - 10737 + 10731 15 23 - 9804 + 9798 23 28 - 11204 + 11197 28 34 - 9804 + 9798 34 44 - 9337 + 9331 44 55 - 9337 + 9331 55 66 - 9804 + 9798 66 77 - 8403 + 8398 @@ -5261,67 +5302,67 @@ 1 8 - 9337 + 9331 8 13 - 9337 + 9331 13 20 - 9804 + 9798 20 32 - 9337 + 9331 32 43 - 9804 + 9798 43 60 - 9337 + 9331 61 71 - 9337 + 9331 72 93 - 9337 + 9331 94 127 - 9337 + 9331 128 179 - 9337 + 9331 180 268 - 9337 + 9331 278 413 - 9337 + 9331 437 1465 - 9337 + 9331 1554 @@ -5342,67 +5383,67 @@ 1 9 - 9804 + 9798 9 13 - 9337 + 9331 13 18 - 9337 + 9331 18 26 - 10270 + 10264 27 33 - 9337 + 9331 33 39 - 9337 + 9331 39 47 - 10270 + 10264 47 53 - 9337 + 9331 53 60 - 10270 + 10264 60 66 - 9337 + 9331 66 74 - 9804 + 9798 74 78 - 9804 + 9798 78 90 - 7002 + 6998 @@ -5418,52 +5459,52 @@ 1 2 - 583112 + 582757 2 3 - 314199 + 314007 3 4 - 195615 + 195496 4 6 - 162001 + 161903 6 10 - 183010 + 182899 10 16 - 162935 + 162836 16 25 - 169004 + 168901 25 46 - 161067 + 160969 46 169 - 157333 + 157237 169 265 - 7002 + 6998 @@ -5479,42 +5520,42 @@ 1 2 - 871167 + 870636 2 3 - 273582 + 273415 3 5 - 193748 + 193630 5 8 - 173673 + 173567 8 13 - 188146 + 188031 13 20 - 161067 + 160969 20 51 - 159667 + 159570 51 265 - 74231 + 74186 @@ -5530,47 +5571,47 @@ 1 2 - 612058 + 611685 2 3 - 313265 + 313074 3 4 - 198417 + 198296 4 6 - 183010 + 182899 6 9 - 173206 + 173100 9 13 - 163402 + 163302 13 19 - 174606 + 174500 19 29 - 164802 + 164702 29 52 - 112514 + 112445 @@ -5586,22 +5627,22 @@ 1 2 - 1531779 + 1530846 2 3 - 348747 + 348534 3 5 - 162001 + 161903 5 16 - 52755 + 52723 @@ -5617,47 +5658,47 @@ 1 2 - 587781 + 587423 2 3 - 316066 + 315874 3 4 - 197483 + 197363 4 6 - 168537 + 168435 6 9 - 158266 + 158170 9 14 - 170872 + 170768 14 21 - 175073 + 174967 21 32 - 162468 + 162369 32 63 - 157799 + 157703 64 @@ -5678,67 +5719,67 @@ 1 31 - 2801 + 2799 42 85 - 2801 + 2799 86 128 - 2801 + 2799 129 229 - 2801 + 2799 247 286 - 2801 + 2799 291 360 - 2801 + 2799 373 457 - 2801 + 2799 473 565 - 2801 + 2799 566 619 - 2801 + 2799 619 689 - 2801 + 2799 696 807 - 2801 + 2799 819 1563 - 2801 + 2799 1634 5631 - 2801 + 2799 15295 @@ -5759,67 +5800,67 @@ 1 18 - 2801 + 2799 23 35 - 3268 + 3266 38 43 - 2801 + 2799 44 61 - 2801 + 2799 65 73 - 2801 + 2799 73 84 - 3268 + 3266 84 96 - 2801 + 2799 96 101 - 3268 + 3266 101 105 - 3268 + 3266 107 112 - 2801 + 2799 112 126 - 2801 + 2799 137 170 - 2801 + 2799 195 265 - 1400 + 1399 @@ -5835,67 +5876,67 @@ 1 19 - 2801 + 2799 30 72 - 2801 + 2799 83 122 - 2801 + 2799 122 205 - 2801 + 2799 214 261 - 2801 + 2799 265 322 - 2801 + 2799 322 379 - 2801 + 2799 404 430 - 2801 + 2799 453 474 - 2801 + 2799 478 505 - 2801 + 2799 511 583 - 2801 + 2799 585 836 - 2801 + 2799 1104 2196 - 2801 + 2799 2387 @@ -5916,67 +5957,67 @@ 1 19 - 2801 + 2799 30 72 - 2801 + 2799 83 122 - 2801 + 2799 122 205 - 2801 + 2799 214 261 - 2801 + 2799 265 322 - 2801 + 2799 322 380 - 2801 + 2799 404 430 - 2801 + 2799 453 474 - 2801 + 2799 477 504 - 2801 + 2799 514 582 - 2801 + 2799 585 835 - 2801 + 2799 1109 2203 - 2801 + 2799 2382 @@ -5997,67 +6038,67 @@ 1 7 - 2801 + 2799 7 11 - 3268 + 3266 11 16 - 3268 + 3266 16 22 - 2801 + 2799 22 24 - 3268 + 3266 24 28 - 2801 + 2799 29 34 - 3268 + 3266 34 41 - 3268 + 3266 41 46 - 2801 + 2799 47 49 - 1867 + 1866 49 54 - 2801 + 2799 54 74 - 2801 + 2799 75 86 - 1867 + 1866 @@ -6073,52 +6114,52 @@ 1 2 - 593383 + 593022 2 3 - 306262 + 306076 3 4 - 198417 + 198296 4 6 - 159667 + 159570 6 10 - 182543 + 182432 10 16 - 162001 + 161903 16 25 - 171338 + 171234 25 46 - 158733 + 158636 46 161 - 158266 + 158170 162 265 - 8870 + 8865 @@ -6134,47 +6175,47 @@ 1 2 - 886574 + 886034 2 3 - 260043 + 259884 3 4 - 125119 + 125043 4 6 - 140992 + 140906 6 10 - 184877 + 184765 10 15 - 168537 + 168435 15 26 - 163402 + 163302 26 120 - 158266 + 158170 121 265 - 11671 + 11664 @@ -6190,22 +6231,22 @@ 1 2 - 1529445 + 1528513 2 3 - 341744 + 341536 3 5 - 170872 + 170768 5 10 - 57424 + 57389 @@ -6221,47 +6262,47 @@ 1 2 - 623262 + 622883 2 3 - 303461 + 303276 3 4 - 201685 + 201562 4 6 - 183944 + 183832 6 9 - 169938 + 169834 9 13 - 166670 + 166568 13 19 - 175073 + 174967 19 29 - 161067 + 160969 29 52 - 114381 + 114311 @@ -6277,52 +6318,52 @@ 1 2 - 599919 + 599554 2 3 - 306262 + 306076 3 4 - 197016 + 196896 4 6 - 169004 + 168901 6 9 - 156399 + 156304 9 14 - 169004 + 168901 14 21 - 177875 + 177766 21 32 - 162001 + 161903 32 60 - 158266 + 158170 60 65 - 3734 + 3732 @@ -6338,67 +6379,67 @@ 1 2 - 5135 + 5132 2 8 - 3734 + 3732 9 186 - 3734 + 3732 193 288 - 3734 + 3732 294 495 - 3734 + 3732 503 555 - 3734 + 3732 561 633 - 3734 + 3732 640 758 - 3734 + 3732 758 869 - 3734 + 3732 875 1074 - 3734 + 3732 1074 1281 - 3734 + 3732 1289 1590 - 3734 + 3732 1685 2418 - 1867 + 1866 @@ -6414,62 +6455,62 @@ 1 2 - 5602 + 5598 2 5 - 3734 + 3732 5 65 - 3734 + 3732 70 100 - 3734 + 3732 100 111 - 3734 + 3732 112 122 - 4201 + 4199 122 140 - 3734 + 3732 143 153 - 3734 + 3732 153 161 - 4201 + 4199 161 173 - 4201 + 4199 173 178 - 3734 + 3732 188 265 - 3734 + 3732 @@ -6485,62 +6526,62 @@ 1 2 - 5602 + 5598 2 8 - 3734 + 3732 9 105 - 3734 + 3732 155 241 - 3734 + 3732 253 336 - 3734 + 3732 340 426 - 3734 + 3732 434 488 - 3734 + 3732 489 572 - 3734 + 3732 573 623 - 3734 + 3732 626 696 - 4201 + 4199 701 813 - 3734 + 3732 818 1095 - 3734 + 3732 1172 @@ -6561,67 +6602,67 @@ 1 2 - 6069 + 6065 2 4 - 3734 + 3732 4 8 - 4201 + 4199 8 15 - 3734 + 3732 15 23 - 3734 + 3732 23 29 - 3734 + 3732 29 35 - 4201 + 4199 35 39 - 3268 + 3266 39 42 - 3268 + 3266 42 44 - 3268 + 3266 44 46 - 3734 + 3732 46 49 - 3734 + 3732 49 53 - 1400 + 1399 @@ -6637,67 +6678,67 @@ 1 2 - 5602 + 5598 2 8 - 3734 + 3732 9 156 - 3734 + 3732 159 240 - 3734 + 3732 251 335 - 3734 + 3732 342 430 - 3734 + 3732 432 490 - 3734 + 3732 490 573 - 3734 + 3732 574 622 - 3734 + 3732 626 698 - 3734 + 3732 700 798 - 3734 + 3732 811 987 - 3734 + 3732 1096 1180 - 1400 + 1399 @@ -10621,23 +10662,23 @@ numlines - 1383783 + 1382941 element_id - 1376780 + 1375942 num_lines - 101776 + 101714 num_code - 84969 + 84917 num_comment - 59758 + 59722 @@ -10651,12 +10692,12 @@ 1 2 - 1369777 + 1368943 2 3 - 7002 + 6998 @@ -10672,12 +10713,12 @@ 1 2 - 1370711 + 1369876 2 3 - 6069 + 6065 @@ -10693,7 +10734,7 @@ 1 2 - 1376780 + 1375942 @@ -10709,27 +10750,27 @@ 1 2 - 68162 + 68120 2 3 - 12138 + 12131 3 4 - 7469 + 7465 4 21 - 7936 + 7931 29 921 - 6069 + 6065 @@ -10745,27 +10786,27 @@ 1 2 - 70496 + 70453 2 3 - 12138 + 12131 3 4 - 8403 + 8398 4 6 - 9337 + 9331 6 7 - 1400 + 1399 @@ -10781,22 +10822,22 @@ 1 2 - 69562 + 69520 2 3 - 14939 + 14930 3 4 - 10737 + 10731 4 7 - 6536 + 6532 @@ -10812,27 +10853,27 @@ 1 2 - 52755 + 52723 2 3 - 14472 + 14463 3 5 - 6536 + 6532 5 42 - 6536 + 6532 44 922 - 4668 + 4665 @@ -10848,27 +10889,27 @@ 1 2 - 52755 + 52723 2 3 - 16807 + 16796 3 5 - 6069 + 6065 5 8 - 6536 + 6532 8 12 - 2801 + 2799 @@ -10884,27 +10925,27 @@ 1 2 - 53222 + 53190 2 3 - 15873 + 15863 3 5 - 7469 + 7465 5 7 - 5135 + 5132 7 10 - 3268 + 3266 @@ -10920,32 +10961,32 @@ 1 2 - 34547 + 34526 2 3 - 9337 + 9331 3 4 - 4201 + 4199 4 6 - 4668 + 4665 6 11 - 5135 + 5132 17 2596 - 1867 + 1866 @@ -10961,32 +11002,32 @@ 1 2 - 34547 + 34526 2 3 - 9337 + 9331 3 4 - 4201 + 4199 4 6 - 4668 + 4665 6 8 - 4668 + 4665 10 38 - 2334 + 2332 @@ -11002,32 +11043,32 @@ 1 2 - 34547 + 34526 2 3 - 9337 + 9331 3 4 - 4201 + 4199 4 6 - 4668 + 4665 6 10 - 4668 + 4665 10 37 - 2334 + 2332 @@ -11669,15 +11710,15 @@ files - 123251 + 123176 id - 123251 + 123176 name - 123251 + 123176 @@ -11691,7 +11732,7 @@ 1 2 - 123251 + 123176 @@ -11707,7 +11748,7 @@ 1 2 - 123251 + 123176 @@ -11717,15 +11758,15 @@ folders - 16340 + 16330 id - 16340 + 16330 name - 16340 + 16330 @@ -11739,7 +11780,7 @@ 1 2 - 16340 + 16330 @@ -11755,7 +11796,7 @@ 1 2 - 16340 + 16330 @@ -11765,15 +11806,15 @@ containerparent - 138658 + 138574 parent - 16340 + 16330 child - 138658 + 138574 @@ -11787,32 +11828,32 @@ 1 2 - 7469 + 7465 2 3 - 3268 + 3266 3 4 - 1400 + 1399 4 12 - 1400 + 1399 23 28 - 1400 + 1399 40 67 - 1400 + 1399 @@ -11828,7 +11869,7 @@ 1 2 - 138658 + 138574 @@ -11838,7 +11879,7 @@ fileannotations - 5129404 + 5129436 id @@ -12680,19 +12721,19 @@ macroinvocations - 33490802 + 33491008 id - 33490802 + 33491008 macro_id - 79483 + 79484 location - 760382 + 760387 kind @@ -12710,7 +12751,7 @@ 1 2 - 33490802 + 33491008 @@ -12726,7 +12767,7 @@ 1 2 - 33490802 + 33491008 @@ -12742,7 +12783,7 @@ 1 2 - 33490802 + 33491008 @@ -12824,7 +12865,7 @@ 1 2 - 42467 + 42468 2 @@ -12870,7 +12911,7 @@ 1 2 - 73748 + 73749 2 @@ -12891,22 +12932,22 @@ 1 2 - 281223 + 281225 2 3 - 169657 + 169658 3 4 - 70734 + 70735 4 5 - 60326 + 60327 5 @@ -12942,7 +12983,7 @@ 1 2 - 714211 + 714216 2 @@ -12963,7 +13004,7 @@ 1 2 - 760382 + 760387 @@ -13036,15 +13077,15 @@ macroparent - 29950538 + 29950722 id - 29950538 + 29950722 parent_id - 23286856 + 23286998 @@ -13058,7 +13099,7 @@ 1 2 - 29950538 + 29950722 @@ -13074,17 +13115,17 @@ 1 2 - 17992681 + 17992792 2 3 - 4459523 + 4459550 3 88 - 834650 + 834655 @@ -13172,11 +13213,11 @@ macro_argument_unexpanded - 84548918 + 84549437 invocation - 26214596 + 26214757 argument_index @@ -13184,7 +13225,7 @@ text - 318306 + 318308 @@ -13198,22 +13239,22 @@ 1 2 - 7432418 + 7432464 2 3 - 10673962 + 10674027 3 4 - 6139289 + 6139327 4 67 - 1968925 + 1968937 @@ -13229,22 +13270,22 @@ 1 2 - 7502578 + 7502624 2 3 - 10820511 + 10820578 3 4 - 5972962 + 5972999 4 67 - 1918544 + 1918556 @@ -13312,12 +13353,12 @@ 1 2 - 35073 + 35074 2 3 - 61263 + 61264 3 @@ -13327,12 +13368,12 @@ 4 5 - 45086 + 45087 5 7 - 23931 + 23932 7 @@ -13378,7 +13419,7 @@ 1 2 - 230198 + 230200 2 @@ -13388,7 +13429,7 @@ 3 9 - 10283 + 10284 @@ -13398,11 +13439,11 @@ macro_argument_expanded - 84548918 + 84549437 invocation - 26214596 + 26214757 argument_index @@ -13410,7 +13451,7 @@ text - 192900 + 192902 @@ -13424,22 +13465,22 @@ 1 2 - 7432418 + 7432464 2 3 - 10673962 + 10674027 3 4 - 6139289 + 6139327 4 67 - 1968925 + 1968937 @@ -13455,22 +13496,22 @@ 1 2 - 10688727 + 10688793 2 3 - 9201805 + 9201862 3 4 - 5208245 + 5208277 4 9 - 1115817 + 1115824 @@ -13609,7 +13650,7 @@ 1 2 - 97624 + 97625 2 @@ -13629,19 +13670,19 @@ functions - 4179363 + 4176817 id - 4179363 + 4176817 name - 1895466 + 1894311 kind - 3268 + 3266 @@ -13655,7 +13696,7 @@ 1 2 - 4179363 + 4176817 @@ -13671,7 +13712,7 @@ 1 2 - 4179363 + 4176817 @@ -13687,22 +13728,22 @@ 1 2 - 1498165 + 1497253 2 3 - 153131 + 153038 3 5 - 142860 + 142773 5 952 - 101309 + 101247 @@ -13718,7 +13759,7 @@ 1 2 - 1894999 + 1893845 2 @@ -13820,15 +13861,15 @@ function_entry_point - 1151752 + 1151517 id - 1141948 + 1141719 entry_point - 1151752 + 1151517 @@ -13842,12 +13883,12 @@ 1 2 - 1132144 + 1131921 2 3 - 9804 + 9798 @@ -13863,7 +13904,7 @@ 1 2 - 1151752 + 1151517 @@ -13873,15 +13914,15 @@ function_return_type - 4184498 + 4181950 id - 4179363 + 4176817 return_type - 817945 + 817446 @@ -13895,12 +13936,12 @@ 1 2 - 4174227 + 4171685 2 3 - 5135 + 5132 @@ -13916,22 +13957,22 @@ 1 2 - 506080 + 505771 2 3 - 211489 + 211360 3 7 - 66294 + 66254 7 2231 - 34081 + 34060 @@ -13941,15 +13982,15 @@ coroutine - 0 + 6 function - 0 + 6 traits - 0 + 3 @@ -13963,7 +14004,7 @@ 1 2 - 17 + 6 @@ -13975,7 +14016,23 @@ 12 - + + + 1 + 2 + 1 + + + 2 + 3 + 1 + + + 3 + 4 + 1 + + @@ -13983,19 +14040,19 @@ coroutine_placeholder_variable - 0 + 18 placeholder_variable - 0 + 18 kind - 0 + 3 function - 0 + 6 @@ -14009,7 +14066,7 @@ 1 2 - 17 + 18 @@ -14025,7 +14082,7 @@ 1 2 - 17 + 18 @@ -14037,7 +14094,13 @@ 12 - + + + 6 + 7 + 3 + + @@ -14047,7 +14110,13 @@ 12 - + + + 6 + 7 + 3 + + @@ -14057,7 +14126,13 @@ 12 - + + + 3 + 4 + 6 + + @@ -14067,7 +14142,13 @@ 12 - + + + 3 + 4 + 6 + + @@ -14075,15 +14156,15 @@ coroutine_new - 0 + 6 function - 0 + 6 new - 0 + 1 @@ -14097,7 +14178,7 @@ 1 2 - 17 + 6 @@ -14109,7 +14190,13 @@ 12 - + + + 6 + 7 + 1 + + @@ -14117,15 +14204,15 @@ coroutine_delete - 0 + 6 function - 0 + 6 delete - 0 + 1 @@ -14139,7 +14226,7 @@ 1 2 - 17 + 6 @@ -14151,7 +14238,13 @@ 12 - + + + 6 + 7 + 1 + + @@ -14170,33 +14263,33 @@ function_deleted - 96173 + 96115 id - 96173 + 96115 function_defaulted - 73764 + 73719 id - 73764 + 73719 function_prototyped - 4087391 + 4084901 id - 4087391 + 4084901 @@ -14349,27 +14442,27 @@ fun_decls - 4548652 + 4546348 id - 4543516 + 4541216 function - 4035569 + 4033111 type_id - 816544 + 816047 name - 1797891 + 1796796 location - 3370755 + 3368702 @@ -14383,7 +14476,7 @@ 1 2 - 4543516 + 4541216 @@ -14399,12 +14492,12 @@ 1 2 - 4538381 + 4536084 2 3 - 5135 + 5132 @@ -14420,7 +14513,7 @@ 1 2 - 4543516 + 4541216 @@ -14436,7 +14529,7 @@ 1 2 - 4543516 + 4541216 @@ -14452,17 +14545,17 @@ 1 2 - 3606521 + 3603858 2 3 - 356216 + 356466 3 7 - 72830 + 72786 @@ -14478,12 +14571,12 @@ 1 2 - 3995885 + 3993452 2 3 - 39683 + 39659 @@ -14499,7 +14592,7 @@ 1 2 - 4035569 + 4033111 @@ -14515,17 +14608,17 @@ 1 2 - 3663012 + 3660781 2 3 - 311864 + 311674 3 6 - 60692 + 60655 @@ -14541,22 +14634,22 @@ 1 2 - 431381 + 431119 2 3 - 274048 + 273882 3 6 - 63493 + 63454 6 - 2476 - 47620 + 2477 + 47591 @@ -14572,22 +14665,22 @@ 1 2 - 515417 + 515103 2 3 - 203085 + 202961 3 7 - 63026 + 62988 7 2192 - 35014 + 34993 @@ -14603,17 +14696,17 @@ 1 2 - 690024 + 689604 2 4 - 67228 + 67187 4 773 - 59291 + 59255 @@ -14629,22 +14722,22 @@ 1 2 - 595251 + 594888 2 3 - 121384 + 121310 3 7 - 63493 + 63454 7 1959 - 36415 + 36393 @@ -14660,27 +14753,27 @@ 1 2 - 1228318 + 1227570 2 3 - 267045 + 266883 3 4 - 77966 + 77918 4 7 - 146128 + 146039 7 986 - 78433 + 78385 @@ -14696,22 +14789,22 @@ 1 2 - 1407593 + 1406736 2 3 - 152197 + 152104 3 5 - 136791 + 136707 5 936 - 101309 + 101247 @@ -14727,17 +14820,17 @@ 1 2 - 1579399 + 1578437 2 4 - 134923 + 134841 4 562 - 83568 + 83517 @@ -14753,27 +14846,27 @@ 1 2 - 1236254 + 1235502 2 3 - 293190 + 293011 3 4 - 78899 + 78851 4 8 - 137257 + 137174 8 542 - 52288 + 52256 @@ -14789,17 +14882,17 @@ 1 2 - 2966451 + 2964644 2 4 - 277783 + 277614 4 55 - 126520 + 126442 @@ -14815,17 +14908,17 @@ 1 2 - 3033679 + 3031832 2 7 - 244169 + 244020 7 55 - 92905 + 92849 @@ -14841,12 +14934,12 @@ 1 2 - 3207353 + 3205399 2 18 - 163402 + 163302 @@ -14862,12 +14955,12 @@ 1 2 - 3232563 + 3230595 2 13 - 138191 + 138107 @@ -14877,22 +14970,22 @@ fun_def - 1888930 + 1888246 id - 1888930 + 1888246 fun_specialized - 26144 + 26128 id - 26144 + 26128 @@ -14910,15 +15003,15 @@ fun_decl_specifiers - 2906692 + 2904922 id - 1689579 + 1688550 name - 2801 + 2799 @@ -14932,17 +15025,17 @@ 1 2 - 491140 + 490841 2 3 - 1179764 + 1179045 3 4 - 18674 + 18663 @@ -14993,19 +15086,19 @@ fun_decl_throws - 0 + 7 fun_decl - 0 + 7 index - 0 + 1 type_id - 0 + 2 @@ -15015,7 +15108,13 @@ 12 - + + + 1 + 2 + 7 + + @@ -15025,7 +15124,13 @@ 12 - + + + 1 + 2 + 7 + + @@ -15035,7 +15140,13 @@ 12 - + + + 7 + 8 + 1 + + @@ -15045,7 +15156,13 @@ 12 - + + + 2 + 3 + 1 + + @@ -15055,7 +15172,18 @@ 12 - + + + 1 + 2 + 1 + + + 6 + 7 + 1 + + @@ -15065,7 +15193,13 @@ 12 - + + + 1 + 2 + 2 + + @@ -15073,11 +15207,11 @@ fun_decl_empty_throws - 1472021 + 1471124 fun_decl - 1472021 + 1471124 @@ -15137,11 +15271,11 @@ fun_decl_empty_noexcept - 863230 + 863171 fun_decl - 863230 + 863171 @@ -15246,19 +15380,19 @@ param_decl_bind - 6995017 + 6991224 id - 6995017 + 6991224 index - 7936 + 7931 fun_decl - 3835284 + 3833415 @@ -15272,7 +15406,7 @@ 1 2 - 6995017 + 6991224 @@ -15288,7 +15422,7 @@ 1 2 - 6995017 + 6991224 @@ -15367,8 +15501,8 @@ 466 - 8215 - 8216 + 8216 + 8217 466 @@ -15448,8 +15582,8 @@ 466 - 8215 - 8216 + 8216 + 8217 466 @@ -15466,27 +15600,27 @@ 1 2 - 1973899 + 1973163 2 3 - 1061647 + 1061001 3 4 - 502812 + 502505 4 8 - 290856 + 290678 8 18 - 6069 + 6065 @@ -15502,27 +15636,27 @@ 1 2 - 1973899 + 1973163 2 3 - 1061647 + 1061001 3 4 - 502812 + 502505 4 8 - 290856 + 290678 8 18 - 6069 + 6065 @@ -15532,27 +15666,27 @@ var_decls - 8110354 + 8105882 id - 8039391 + 8034962 variable - 7027231 + 7022951 type_id - 2043462 + 2042217 name - 667614 + 667208 location - 5311974 + 5308739 @@ -15566,7 +15700,7 @@ 1 2 - 8039391 + 8034962 @@ -15582,12 +15716,12 @@ 1 2 - 7971229 + 7966841 2 3 - 68162 + 68120 @@ -15603,7 +15737,7 @@ 1 2 - 8039391 + 8034962 @@ -15619,12 +15753,12 @@ 1 2 - 8036590 + 8032162 2 3 - 2801 + 2799 @@ -15640,17 +15774,17 @@ 1 2 - 6175205 + 6170977 2 3 - 698427 + 698469 3 7 - 153598 + 153504 @@ -15666,12 +15800,12 @@ 1 2 - 6855892 + 6851717 2 4 - 171338 + 171234 @@ -15687,12 +15821,12 @@ 1 2 - 6911916 + 6907706 2 3 - 115315 + 115245 @@ -15708,17 +15842,17 @@ 1 2 - 6481934 + 6477987 2 3 - 542962 + 542631 3 4 - 2334 + 2332 @@ -15734,27 +15868,27 @@ 1 2 - 1165758 + 1165048 2 3 - 477134 + 476377 3 4 - 94773 + 95182 4 7 - 184877 + 184765 7 762 - 120917 + 120844 @@ -15770,22 +15904,22 @@ 1 2 - 1299281 + 1298490 2 3 - 452390 + 452115 3 6 - 155932 + 155837 6 724 - 135857 + 135774 @@ -15801,17 +15935,17 @@ 1 2 - 1539249 + 1538311 2 3 - 383295 + 383061 3 128 - 120917 + 120844 @@ -15827,22 +15961,22 @@ 1 2 - 1365576 + 1364744 2 3 - 404303 + 404057 3 7 - 173206 + 173100 7 592 - 100375 + 100314 @@ -15858,37 +15992,37 @@ 1 2 - 341277 + 341069 2 3 - 86836 + 86783 3 4 - 48553 + 48524 4 6 - 51821 + 51790 6 12 - 52288 + 52256 12 33 - 50421 + 50390 34 - 2384 - 36415 + 2385 + 36393 @@ -15904,37 +16038,37 @@ 1 2 - 368822 + 368597 2 3 - 77966 + 77918 3 4 - 45285 + 45258 4 6 - 49487 + 49457 6 14 - 53222 + 53190 14 56 - 50888 + 50857 56 2301 - 21942 + 21929 @@ -15950,27 +16084,27 @@ 1 2 - 457059 + 456781 2 3 - 93839 + 93782 3 5 - 46686 + 46657 5 19 - 50888 + 50857 19 1182 - 19141 + 19129 @@ -15986,32 +16120,32 @@ 1 2 - 379093 + 378862 2 3 - 90571 + 90516 3 5 - 59758 + 59722 5 9 - 51354 + 51323 9 21 - 50421 + 50390 21 1010 - 36415 + 36393 @@ -16027,17 +16161,17 @@ 1 2 - 4496363 + 4493625 2 3 - 531757 + 531433 3 - 896 - 283853 + 897 + 283680 @@ -16053,17 +16187,17 @@ 1 2 - 4885727 + 4882752 2 17 - 415508 + 415255 17 892 - 10737 + 10731 @@ -16079,12 +16213,12 @@ 1 2 - 4961826 + 4958804 2 759 - 350147 + 349934 @@ -16100,12 +16234,12 @@ 1 2 - 5302637 + 5299407 2 6 - 9337 + 9331 @@ -16115,26 +16249,26 @@ var_def - 3994952 + 3992985 id - 3994952 + 3992985 var_decl_specifiers - 378626 + 378395 id - 378626 + 378395 name - 1867 + 1866 @@ -16148,7 +16282,7 @@ 1 2 - 378626 + 378395 @@ -16189,30 +16323,30 @@ is_structured_binding - 0 + 18 id - 0 + 18 type_decls - 3283451 + 3281452 id - 3283451 + 3281452 type_id - 3233030 + 3231061 location - 3166269 + 3164340 @@ -16226,7 +16360,7 @@ 1 2 - 3283451 + 3281452 @@ -16242,7 +16376,7 @@ 1 2 - 3283451 + 3281452 @@ -16258,12 +16392,12 @@ 1 2 - 3191479 + 3189536 2 5 - 41550 + 41525 @@ -16279,12 +16413,12 @@ 1 2 - 3191479 + 3189536 2 5 - 41550 + 41525 @@ -16300,12 +16434,12 @@ 1 2 - 3113980 + 3112083 2 20 - 52288 + 52256 @@ -16321,12 +16455,12 @@ 1 2 - 3113980 + 3112083 2 20 - 52288 + 52256 @@ -16336,22 +16470,22 @@ type_def - 2641981 + 2640372 id - 2641981 + 2640372 type_decl_top - 743713 + 743260 type_decl - 743713 + 743260 @@ -16724,19 +16858,19 @@ usings - 369755 + 369530 id - 369755 + 369530 element_id - 315599 + 315407 location - 247904 + 247753 kind @@ -16754,7 +16888,7 @@ 1 2 - 369755 + 369530 @@ -16770,7 +16904,7 @@ 1 2 - 369755 + 369530 @@ -16786,7 +16920,7 @@ 1 2 - 369755 + 369530 @@ -16802,17 +16936,17 @@ 1 2 - 263311 + 263150 2 3 - 50888 + 50857 3 5 - 1400 + 1399 @@ -16828,17 +16962,17 @@ 1 2 - 263311 + 263150 2 3 - 50888 + 50857 3 5 - 1400 + 1399 @@ -16854,7 +16988,7 @@ 1 2 - 315599 + 315407 @@ -16870,22 +17004,22 @@ 1 2 - 202618 + 202495 2 4 - 10737 + 10731 4 5 - 31279 + 31260 5 11 - 3268 + 3266 @@ -16901,22 +17035,22 @@ 1 2 - 202618 + 202495 2 4 - 10737 + 10731 4 5 - 31279 + 31260 5 11 - 3268 + 3266 @@ -16932,7 +17066,7 @@ 1 2 - 247904 + 247753 @@ -17005,7 +17139,7 @@ using_container - 466798 + 466800 parent @@ -17013,7 +17147,7 @@ child - 295989 + 295990 @@ -17083,12 +17217,12 @@ 1 2 - 218311 + 218313 2 3 - 51724 + 51725 3 @@ -17716,23 +17850,23 @@ params - 6354480 + 6350610 id - 6190611 + 6186841 function - 3491673 + 3489546 index - 7936 + 7931 type_id - 1846445 + 1845321 @@ -17746,7 +17880,7 @@ 1 2 - 6190611 + 6186841 @@ -17762,7 +17896,7 @@ 1 2 - 6190611 + 6186841 @@ -17778,12 +17912,12 @@ 1 2 - 6066892 + 6063198 2 4 - 123718 + 123643 @@ -17799,22 +17933,22 @@ 1 2 - 1867454 + 1866317 2 3 - 952868 + 952288 3 4 - 429981 + 429719 4 18 - 241368 + 241221 @@ -17830,22 +17964,22 @@ 1 2 - 1867454 + 1866317 2 3 - 952868 + 952288 3 4 - 429981 + 429719 4 18 - 241368 + 241221 @@ -17861,22 +17995,22 @@ 1 2 - 2165780 + 2164461 2 3 - 826815 + 826311 3 4 - 346412 + 346201 4 12 - 152664 + 152571 @@ -18074,7 +18208,7 @@ 6 7 - 1400 + 1399 7 @@ -18130,22 +18264,22 @@ 1 2 - 1183966 + 1183245 2 3 - 406171 + 405923 3 7 - 154064 + 153971 7 518 - 102243 + 102180 @@ -18161,22 +18295,22 @@ 1 2 - 1404792 + 1403937 2 3 - 212422 + 212293 3 7 - 147528 + 147439 7 502 - 81701 + 81651 @@ -18192,17 +18326,17 @@ 1 2 - 1420199 + 1419334 2 3 - 347346 + 347135 3 13 - 78899 + 78851 @@ -18212,11 +18346,11 @@ overrides - 125725 + 125735 new - 122752 + 122762 old @@ -18234,7 +18368,7 @@ 1 2 - 119788 + 119797 2 @@ -18642,11 +18776,11 @@ localvariables - 576944 + 576952 id - 576944 + 576952 type_id @@ -18654,7 +18788,7 @@ name - 90547 + 90549 @@ -18668,7 +18802,7 @@ 1 2 - 576944 + 576952 @@ -18684,7 +18818,7 @@ 1 2 - 576944 + 576952 @@ -18705,7 +18839,7 @@ 2 3 - 5362 + 5366 3 @@ -18715,7 +18849,7 @@ 4 7 - 3380 + 3376 7 @@ -18741,7 +18875,7 @@ 1 2 - 26908 + 26913 2 @@ -18751,7 +18885,7 @@ 3 5 - 2918 + 2914 5 @@ -18777,12 +18911,12 @@ 1 2 - 57031 + 57032 2 3 - 14284 + 14285 3 @@ -18813,7 +18947,7 @@ 1 2 - 76491 + 76492 2 @@ -18823,7 +18957,7 @@ 3 1486 - 6644 + 6645 @@ -19851,31 +19985,31 @@ builtintypes - 26144 + 26128 id - 26144 + 26128 name - 26144 + 26128 kind - 26144 + 26128 size - 3268 + 3266 sign - 1400 + 1399 alignment - 2334 + 2332 @@ -19889,7 +20023,7 @@ 1 2 - 26144 + 26128 @@ -19905,7 +20039,7 @@ 1 2 - 26144 + 26128 @@ -19921,7 +20055,7 @@ 1 2 - 26144 + 26128 @@ -19937,7 +20071,7 @@ 1 2 - 26144 + 26128 @@ -19953,7 +20087,7 @@ 1 2 - 26144 + 26128 @@ -19969,7 +20103,7 @@ 1 2 - 26144 + 26128 @@ -19985,7 +20119,7 @@ 1 2 - 26144 + 26128 @@ -20001,7 +20135,7 @@ 1 2 - 26144 + 26128 @@ -20017,7 +20151,7 @@ 1 2 - 26144 + 26128 @@ -20033,7 +20167,7 @@ 1 2 - 26144 + 26128 @@ -20049,7 +20183,7 @@ 1 2 - 26144 + 26128 @@ -20065,7 +20199,7 @@ 1 2 - 26144 + 26128 @@ -20081,7 +20215,7 @@ 1 2 - 26144 + 26128 @@ -20097,7 +20231,7 @@ 1 2 - 26144 + 26128 @@ -20113,7 +20247,7 @@ 1 2 - 26144 + 26128 @@ -20272,7 +20406,7 @@ 3 4 - 2334 + 2332 @@ -20288,12 +20422,12 @@ 1 2 - 1867 + 1866 2 3 - 1400 + 1399 @@ -20408,7 +20542,7 @@ 5 6 - 1400 + 1399 @@ -20532,7 +20666,7 @@ 2 3 - 2334 + 2332 @@ -20548,7 +20682,7 @@ 3 4 - 2334 + 2332 @@ -20558,23 +20692,23 @@ derivedtypes - 3669548 + 3667313 id - 3669548 + 3667313 name - 1552788 + 1551842 kind - 2801 + 2799 type_id - 2362796 + 2361357 @@ -20588,7 +20722,7 @@ 1 2 - 3669548 + 3667313 @@ -20604,7 +20738,7 @@ 1 2 - 3669548 + 3667313 @@ -20620,7 +20754,7 @@ 1 2 - 3669548 + 3667313 @@ -20636,17 +20770,17 @@ 1 2 - 1324025 + 1323218 2 4 - 120450 + 120377 4 1153 - 108312 + 108246 @@ -20662,7 +20796,7 @@ 1 2 - 1551854 + 1550909 2 @@ -20683,17 +20817,17 @@ 1 2 - 1324025 + 1323218 2 4 - 120450 + 120377 4 1135 - 108312 + 108246 @@ -20832,22 +20966,22 @@ 1 2 - 1515439 + 1514516 2 3 - 546230 + 545897 3 4 - 218492 + 218359 4 72 - 82634 + 82584 @@ -20863,22 +20997,22 @@ 1 2 - 1526644 + 1525714 2 3 - 538760 + 538432 3 4 - 215690 + 215559 4 72 - 81701 + 81651 @@ -20894,22 +21028,22 @@ 1 2 - 1519641 + 1518715 2 3 - 549965 + 549630 3 4 - 217558 + 217425 4 6 - 75631 + 75585 @@ -20919,11 +21053,11 @@ pointerishsize - 2707342 + 2705693 id - 2707342 + 2705693 size @@ -20945,7 +21079,7 @@ 1 2 - 2707342 + 2705693 @@ -20961,7 +21095,7 @@ 1 2 - 2707342 + 2705693 @@ -21035,23 +21169,23 @@ arraysizes - 88237 + 88183 id - 88237 + 88183 num_elements - 31746 + 31727 bytesize - 33147 + 33127 alignment - 1867 + 1866 @@ -21065,7 +21199,7 @@ 1 2 - 88237 + 88183 @@ -21081,7 +21215,7 @@ 1 2 - 88237 + 88183 @@ -21097,7 +21231,7 @@ 1 2 - 88237 + 88183 @@ -21113,22 +21247,22 @@ 1 2 - 1867 + 1866 2 3 - 23810 + 23795 3 5 - 2801 + 2799 5 13 - 2801 + 2799 13 @@ -21149,17 +21283,17 @@ 1 2 - 26611 + 26595 2 3 - 2334 + 2332 3 7 - 2801 + 2799 @@ -21175,17 +21309,17 @@ 1 2 - 26611 + 26595 2 3 - 2801 + 2799 3 5 - 2334 + 2332 @@ -21201,27 +21335,27 @@ 1 2 - 1867 + 1866 2 3 - 23810 + 23795 3 4 - 3268 + 3266 4 6 - 2334 + 2332 7 16 - 1867 + 1866 @@ -21237,17 +21371,17 @@ 1 2 - 27544 + 27528 2 3 - 3734 + 3732 3 5 - 1867 + 1866 @@ -21263,12 +21397,12 @@ 1 2 - 27544 + 27528 2 3 - 4668 + 4665 4 @@ -21371,15 +21505,15 @@ typedefbase - 1686099 + 1686109 id - 1686099 + 1686109 type_id - 793481 + 793485 @@ -21393,7 +21527,7 @@ 1 2 - 1686099 + 1686109 @@ -21409,12 +21543,12 @@ 1 2 - 617400 + 617404 2 3 - 83253 + 83254 3 @@ -21720,19 +21854,19 @@ usertypes - 5234008 + 5230820 id - 5234008 + 5230820 name - 1352503 + 1351680 kind - 5135 + 5132 @@ -21746,7 +21880,7 @@ 1 2 - 5234008 + 5230820 @@ -21762,7 +21896,7 @@ 1 2 - 5234008 + 5230820 @@ -21778,27 +21912,27 @@ 1 2 - 983681 + 983082 2 3 - 153598 + 153504 3 7 - 104577 + 104513 7 61 - 101776 + 101714 65 874 - 8870 + 8865 @@ -21814,17 +21948,17 @@ 1 2 - 1211977 + 1211239 2 3 - 125586 + 125509 3 7 - 14939 + 14930 @@ -21966,19 +22100,19 @@ usertypesize - 1706386 + 1705347 id - 1706386 + 1705347 size - 13539 + 13530 alignment - 2334 + 2332 @@ -21992,7 +22126,7 @@ 1 2 - 1706386 + 1705347 @@ -22008,7 +22142,7 @@ 1 2 - 1706386 + 1705347 @@ -22024,12 +22158,12 @@ 1 2 - 3268 + 3266 2 3 - 4201 + 4199 3 @@ -22080,12 +22214,12 @@ 1 2 - 10270 + 10264 2 3 - 2801 + 2799 3 @@ -22236,15 +22370,15 @@ mangled_name - 9019338 + 9013845 id - 9019338 + 9013845 mangled_name - 6061757 + 6058065 is_complete @@ -22262,7 +22396,7 @@ 1 2 - 9019338 + 9013845 @@ -22278,7 +22412,7 @@ 1 2 - 9019338 + 9013845 @@ -22294,12 +22428,12 @@ 1 2 - 5789108 + 5785583 2 874 - 272648 + 272482 @@ -22315,7 +22449,7 @@ 1 2 - 6061757 + 6058065 @@ -22357,59 +22491,59 @@ is_pod_class - 534710 + 534713 id - 534710 + 534713 is_standard_layout_class - 1253995 + 1253232 id - 1253995 + 1253232 is_complete - 1645694 + 1644692 id - 1645694 + 1644692 is_class_template - 398234 + 397992 id - 398234 + 397992 class_instantiation - 1089659 + 1088996 to - 1089659 + 1088996 from - 168537 + 168435 @@ -22423,7 +22557,7 @@ 1 2 - 1089659 + 1088996 @@ -22439,47 +22573,47 @@ 1 2 - 59758 + 59722 2 3 - 29412 + 29394 3 4 - 15873 + 15863 4 5 - 13072 + 13064 5 6 - 9804 + 9798 6 10 - 12605 + 12597 10 16 - 13072 + 13064 16 70 - 13539 + 13530 70 84 - 1400 + 1399 @@ -22489,11 +22623,11 @@ class_template_argument - 2882732 + 2882750 type_id - 1315503 + 1315511 index @@ -22501,7 +22635,7 @@ arg_type - 840385 + 840390 @@ -22515,22 +22649,22 @@ 1 2 - 540953 + 540956 2 3 - 399235 + 399237 3 4 - 231395 + 231396 4 7 - 120314 + 120315 7 @@ -22551,17 +22685,17 @@ 1 2 - 567605 + 567609 2 3 - 410478 + 410481 3 4 - 244840 + 244841 4 @@ -22674,17 +22808,17 @@ 1 2 - 523343 + 523346 2 3 - 174342 + 174343 3 4 - 51340 + 51341 4 @@ -22710,7 +22844,7 @@ 1 2 - 746486 + 746490 2 @@ -22730,19 +22864,19 @@ class_template_argument_value - 495342 + 495040 type_id - 304861 + 304676 index - 1867 + 1866 arg_value - 495342 + 495040 @@ -22756,17 +22890,17 @@ 1 2 - 249772 + 249619 2 3 - 53222 + 53190 3 4 - 1867 + 1866 @@ -22782,22 +22916,22 @@ 1 2 - 189546 + 189431 2 3 - 81234 + 81184 3 4 - 12138 + 12131 4 9 - 21942 + 21929 @@ -22875,7 +23009,7 @@ 1 2 - 495342 + 495040 @@ -22891,7 +23025,7 @@ 1 2 - 495342 + 495040 @@ -22901,15 +23035,15 @@ is_proxy_class_for - 62092 + 62055 id - 62092 + 62055 templ_param_id - 62092 + 62055 @@ -22923,7 +23057,7 @@ 1 2 - 62092 + 62055 @@ -22939,7 +23073,7 @@ 1 2 - 62092 + 62055 @@ -23245,11 +23379,11 @@ is_function_template - 1402925 + 1402070 id - 1402925 + 1402070 @@ -24380,19 +24514,19 @@ routinetypeargs - 983214 + 982616 routine - 423445 + 423187 index - 7936 + 7931 type_id - 226895 + 226757 @@ -24406,27 +24540,27 @@ 1 2 - 152664 + 152571 2 3 - 133989 + 133908 3 4 - 63493 + 63454 4 5 - 45752 + 45724 5 18 - 27544 + 27528 @@ -24442,27 +24576,27 @@ 1 2 - 182543 + 182432 2 3 - 133522 + 133441 3 4 - 58824 + 58788 4 5 - 33614 + 33593 5 11 - 14939 + 14930 @@ -24503,7 +24637,7 @@ 10 11 - 1400 + 1399 13 @@ -24564,7 +24698,7 @@ 4 5 - 1400 + 1399 5 @@ -24620,27 +24754,27 @@ 1 2 - 146595 + 146505 2 3 - 30812 + 30794 3 5 - 16807 + 16796 5 12 - 18207 + 18196 12 110 - 14472 + 14463 @@ -24656,22 +24790,22 @@ 1 2 - 172739 + 172634 2 3 - 30812 + 30794 3 6 - 18674 + 18663 6 14 - 4668 + 4665 @@ -24681,19 +24815,19 @@ ptrtomembers - 37815 + 37792 id - 37815 + 37792 type_id - 37815 + 37792 class_id - 15406 + 15397 @@ -24707,7 +24841,7 @@ 1 2 - 37815 + 37792 @@ -24723,7 +24857,7 @@ 1 2 - 37815 + 37792 @@ -24739,7 +24873,7 @@ 1 2 - 37815 + 37792 @@ -24755,7 +24889,7 @@ 1 2 - 37815 + 37792 @@ -24771,12 +24905,12 @@ 1 2 - 13539 + 13530 8 9 - 1400 + 1399 28 @@ -24797,12 +24931,12 @@ 1 2 - 13539 + 13530 8 9 - 1400 + 1399 28 @@ -24817,15 +24951,15 @@ specifiers - 24743 + 24728 id - 24743 + 24728 str - 24743 + 24728 @@ -24839,7 +24973,7 @@ 1 2 - 24743 + 24728 @@ -24855,7 +24989,7 @@ 1 2 - 24743 + 24728 @@ -24865,15 +24999,15 @@ typespecifiers - 1132144 + 1131454 type_id - 1113936 + 1113258 spec_id - 3734 + 3732 @@ -24887,12 +25021,12 @@ 1 2 - 1095728 + 1095061 2 3 - 18207 + 18196 @@ -24948,15 +25082,15 @@ funspecifiers - 10304614 + 10298338 func_id - 4068249 + 4065772 spec_id - 8403 + 8398 @@ -24970,27 +25104,27 @@ 1 2 - 1357639 + 1356812 2 3 - 641003 + 640613 3 4 - 985082 + 984482 4 5 - 780129 + 779654 5 8 - 304395 + 304209 @@ -25101,15 +25235,15 @@ varspecifiers - 2246080 + 2244713 var_id - 1225050 + 1224304 spec_id - 3734 + 3732 @@ -25123,22 +25257,22 @@ 1 2 - 730174 + 729730 2 3 - 202618 + 202495 3 4 - 58357 + 58322 4 5 - 233898 + 233756 @@ -25247,19 +25381,19 @@ attributes - 561636 + 561294 id - 561636 + 561294 kind - 1400 + 1399 name - 11204 + 11197 name_space @@ -25267,7 +25401,7 @@ location - 481336 + 481043 @@ -25281,7 +25415,7 @@ 1 2 - 561636 + 561294 @@ -25297,7 +25431,7 @@ 1 2 - 561636 + 561294 @@ -25313,7 +25447,7 @@ 1 2 - 561636 + 561294 @@ -25329,7 +25463,7 @@ 1 2 - 561636 + 561294 @@ -25520,7 +25654,7 @@ 1 2 - 10270 + 10264 2 @@ -25541,7 +25675,7 @@ 1 2 - 11204 + 11197 @@ -25712,17 +25846,17 @@ 1 2 - 431848 + 431585 2 3 - 20075 + 20062 3 7 - 29412 + 29394 @@ -25738,7 +25872,7 @@ 1 2 - 481336 + 481043 @@ -25754,17 +25888,17 @@ 1 2 - 433249 + 432985 2 3 - 19608 + 19596 3 4 - 28478 + 28461 @@ -25780,7 +25914,7 @@ 1 2 - 481336 + 481043 @@ -25790,27 +25924,27 @@ attribute_args - 344078 + 343868 id - 344078 + 343868 kind - 1400 + 1399 attribute - 262844 + 262684 index - 1400 + 1399 location - 327738 + 327538 @@ -25824,7 +25958,7 @@ 1 2 - 344078 + 343868 @@ -25840,7 +25974,7 @@ 1 2 - 344078 + 343868 @@ -25856,7 +25990,7 @@ 1 2 - 344078 + 343868 @@ -25872,7 +26006,7 @@ 1 2 - 344078 + 343868 @@ -25987,17 +26121,17 @@ 1 2 - 197483 + 197363 2 3 - 49487 + 49457 3 4 - 15873 + 15863 @@ -26013,12 +26147,12 @@ 1 2 - 252573 + 252419 2 3 - 10270 + 10264 @@ -26034,17 +26168,17 @@ 1 2 - 197483 + 197363 2 3 - 49487 + 49457 3 4 - 15873 + 15863 @@ -26060,17 +26194,17 @@ 1 2 - 197483 + 197363 2 3 - 49487 + 49457 3 4 - 15873 + 15863 @@ -26185,12 +26319,12 @@ 1 2 - 313732 + 313541 2 7 - 14005 + 13997 @@ -26206,12 +26340,12 @@ 1 2 - 315132 + 314941 2 3 - 12605 + 12597 @@ -26227,12 +26361,12 @@ 1 2 - 313732 + 313541 2 7 - 14005 + 13997 @@ -26248,7 +26382,7 @@ 1 2 - 327738 + 327538 @@ -26258,15 +26392,15 @@ attribute_arg_value - 25210 + 25195 arg - 25210 + 25195 value - 15873 + 15863 @@ -26280,7 +26414,7 @@ 1 2 - 25210 + 25195 @@ -26296,12 +26430,12 @@ 1 2 - 14472 + 14463 2 16 - 1400 + 1399 @@ -26359,15 +26493,15 @@ attribute_arg_constant - 318400 + 318207 arg - 318400 + 318207 constant - 318400 + 318207 @@ -26381,7 +26515,7 @@ 1 2 - 318400 + 318207 @@ -26397,7 +26531,7 @@ 1 2 - 318400 + 318207 @@ -26407,15 +26541,15 @@ attribute_arg_expr - 0 + 3 arg - 0 + 3 expr - 0 + 3 @@ -26429,7 +26563,7 @@ 1 2 - 17 + 3 @@ -26441,7 +26575,13 @@ 12 - + + + 1 + 2 + 3 + + @@ -26449,15 +26589,15 @@ attribute_arg_name - 0 + 6 arg - 0 + 6 name - 0 + 5 @@ -26471,7 +26611,7 @@ 1 2 - 17 + 6 @@ -26483,7 +26623,18 @@ 12 - + + + 1 + 2 + 4 + + + 2 + 3 + 1 + + @@ -26559,15 +26710,15 @@ funcattributes - 630265 + 629882 func_id - 443520 + 443250 spec_id - 524754 + 524435 @@ -26581,17 +26732,17 @@ 1 2 - 338476 + 338269 2 3 - 64427 + 64387 3 6 - 39683 + 39659 6 @@ -26612,12 +26763,12 @@ 1 2 - 506080 + 505771 2 17 - 18674 + 18663 @@ -26753,15 +26904,15 @@ unspecifiedtype - 9488069 + 9482291 type_id - 9488069 + 9482291 unspecified_type_id - 6490338 + 6486385 @@ -26775,7 +26926,7 @@ 1 2 - 9488069 + 9482291 @@ -26791,17 +26942,17 @@ 1 2 - 4558923 + 4556146 2 3 - 1715723 + 1714678 3 145 - 215690 + 215559 @@ -26811,19 +26962,19 @@ member - 3881037 + 3878673 parent - 545763 + 545431 index - 92905 + 92849 child - 3809607 + 3807287 @@ -26837,47 +26988,47 @@ 1 2 - 129788 + 129709 2 3 - 64894 + 64854 3 4 - 73297 + 73252 4 5 - 75165 + 75119 5 6 - 40617 + 40592 6 8 - 46686 + 46657 8 14 - 45752 + 45724 14 30 - 41550 + 41525 30 200 - 28011 + 27994 @@ -26893,52 +27044,52 @@ 1 2 - 129788 + 129709 2 3 - 64894 + 64854 3 4 - 73297 + 73252 4 5 - 76098 + 76052 5 6 - 39683 + 39659 6 7 - 24276 + 24262 7 9 - 42017 + 41992 9 17 - 43885 + 43858 17 41 - 41550 + 41525 41 200 - 10270 + 10264 @@ -26954,62 +27105,62 @@ 1 2 - 26144 + 26128 2 3 - 7002 + 6998 3 4 - 3734 + 3732 4 5 - 7936 + 7931 5 6 - 5602 + 5598 6 7 - 5602 + 5598 7 9 - 7469 + 7465 9 16 - 7002 + 6998 16 52 - 7002 + 6998 52 107 - 7002 + 6998 108 577 - 7002 + 6998 737 1162 - 1400 + 1399 @@ -27025,62 +27176,62 @@ 1 2 - 26144 + 26128 2 3 - 7002 + 6998 3 4 - 3734 + 3732 4 5 - 7936 + 7931 5 6 - 5602 + 5598 6 7 - 5602 + 5598 7 9 - 7469 + 7465 9 16 - 7002 + 6998 16 52 - 7002 + 6998 52 107 - 7002 + 6998 108 577 - 7002 + 6998 738 1163 - 1400 + 1399 @@ -27096,7 +27247,7 @@ 1 2 - 3809607 + 3807287 @@ -27112,12 +27263,12 @@ 1 2 - 3738177 + 3735900 2 3 - 71430 + 71386 @@ -27127,11 +27278,11 @@ enclosingfunction - 118327 + 118328 child - 118327 + 118328 parent @@ -27149,7 +27300,7 @@ 1 2 - 118327 + 118328 @@ -27180,7 +27331,7 @@ 4 45 - 4887 + 4888 @@ -28647,15 +28798,15 @@ commentbinding - 3091104 + 3089221 id - 2445431 + 2443942 element - 3014538 + 3012702 @@ -28669,12 +28820,12 @@ 1 2 - 2368399 + 2366956 2 97 - 77032 + 76985 @@ -28690,12 +28841,12 @@ 1 2 - 2937972 + 2936183 2 3 - 76565 + 76519 @@ -29100,15 +29251,15 @@ namespaces - 12138 + 12131 id - 12138 + 12131 name - 9804 + 9798 @@ -29122,7 +29273,7 @@ 1 2 - 12138 + 12131 @@ -29138,7 +29289,7 @@ 1 2 - 8403 + 8398 2 @@ -29158,26 +29309,26 @@ namespace_inline - 1400 + 1399 id - 1400 + 1399 namespacembrs - 2388007 + 2386553 parentid - 10270 + 10264 memberid - 2388007 + 2386553 @@ -29191,7 +29342,7 @@ 1 2 - 1867 + 1866 2 @@ -29252,7 +29403,7 @@ 1 2 - 2388007 + 2386553 @@ -29748,7 +29899,7 @@ qualifyingelement - 97518 + 97537 location @@ -29862,7 +30013,7 @@ 1 2 - 58401 + 58420 2 @@ -29898,7 +30049,7 @@ 1 2 - 58401 + 58420 2 @@ -29934,7 +30085,7 @@ 1 2 - 63815 + 63834 2 @@ -30047,12 +30198,12 @@ 1 2 - 137073 + 137054 2 3 - 55684 + 55703 3 @@ -30173,7 +30324,7 @@ fun - 511304 + 511342 @@ -30208,12 +30359,12 @@ 1 2 - 315012 + 315088 2 3 - 77931 + 77893 3 @@ -31993,15 +32144,15 @@ expr_types - 18451396 + 18451397 id - 18319782 + 18319781 typeid - 1214616 + 1214623 value_category @@ -32019,12 +32170,12 @@ 1 2 - 18188167 + 18188166 2 3 - 131614 + 131615 @@ -32040,7 +32191,7 @@ 1 2 - 18319782 + 18319781 @@ -32056,42 +32207,42 @@ 1 2 - 438565 + 438567 2 3 - 249332 + 249345 3 4 - 102839 + 102817 4 5 - 81865 + 81877 5 8 - 109274 + 109275 8 14 - 96495 + 96496 14 41 - 91664 + 91653 41 125325 - 44578 + 44590 @@ -32107,7 +32258,7 @@ 1 2 - 1050230 + 1050237 2 @@ -32141,8 +32292,8 @@ 11 - 1239489 - 1239490 + 1239479 + 1239480 11 @@ -32179,11 +32330,11 @@ compound_requirement_is_noexcept - 0 + 1 expr - 0 + 1 @@ -33570,15 +33721,15 @@ code_block - 0 + 15 block - 0 + 15 routine - 0 + 15 @@ -33592,7 +33743,7 @@ 1 2 - 17 + 15 @@ -33608,7 +33759,7 @@ 1 2 - 17 + 15 @@ -33618,11 +33769,11 @@ lambdas - 21475 + 21462 expr - 21475 + 21462 default_capture @@ -33644,7 +33795,7 @@ 1 2 - 21475 + 21462 @@ -33660,7 +33811,7 @@ 1 2 - 21475 + 21462 @@ -33734,15 +33885,15 @@ lambda_capture - 28011 + 27994 id - 28011 + 27994 lambda - 20541 + 20529 index @@ -33750,7 +33901,7 @@ field - 28011 + 27994 captured_by_reference @@ -33762,7 +33913,7 @@ location - 2801 + 2799 @@ -33776,7 +33927,7 @@ 1 2 - 28011 + 27994 @@ -33792,7 +33943,7 @@ 1 2 - 28011 + 27994 @@ -33808,7 +33959,7 @@ 1 2 - 28011 + 27994 @@ -33824,7 +33975,7 @@ 1 2 - 28011 + 27994 @@ -33840,7 +33991,7 @@ 1 2 - 28011 + 27994 @@ -33856,7 +34007,7 @@ 1 2 - 28011 + 27994 @@ -33872,12 +34023,12 @@ 1 2 - 13072 + 13064 2 3 - 7469 + 7465 @@ -33893,12 +34044,12 @@ 1 2 - 13072 + 13064 2 3 - 7469 + 7465 @@ -33914,12 +34065,12 @@ 1 2 - 13072 + 13064 2 3 - 7469 + 7465 @@ -33935,7 +34086,7 @@ 1 2 - 20541 + 20529 @@ -33951,7 +34102,7 @@ 1 2 - 20541 + 20529 @@ -33967,12 +34118,12 @@ 1 2 - 13072 + 13064 2 3 - 7469 + 7465 @@ -34104,7 +34255,7 @@ 1 2 - 28011 + 27994 @@ -34120,7 +34271,7 @@ 1 2 - 28011 + 27994 @@ -34136,7 +34287,7 @@ 1 2 - 28011 + 27994 @@ -34152,7 +34303,7 @@ 1 2 - 28011 + 27994 @@ -34168,7 +34319,7 @@ 1 2 - 28011 + 27994 @@ -34184,7 +34335,7 @@ 1 2 - 28011 + 27994 @@ -34392,7 +34543,7 @@ 8 9 - 1867 + 1866 14 @@ -34413,7 +34564,7 @@ 8 9 - 1867 + 1866 14 @@ -34434,7 +34585,7 @@ 1 2 - 2801 + 2799 @@ -34450,7 +34601,7 @@ 8 9 - 1867 + 1866 14 @@ -34471,7 +34622,7 @@ 1 2 - 2801 + 2799 @@ -34487,7 +34638,7 @@ 1 2 - 2801 + 2799 @@ -34497,19 +34648,19 @@ fold - 0 + 4 expr - 0 + 4 operator - 0 + 4 is_left_fold - 0 + 2 @@ -34519,7 +34670,13 @@ 12 - + + + 1 + 2 + 4 + + @@ -34529,7 +34686,13 @@ 12 - + + + 1 + 2 + 4 + + @@ -34539,7 +34702,13 @@ 12 - + + + 1 + 2 + 4 + + @@ -34549,7 +34718,13 @@ 12 - + + + 1 + 2 + 4 + + @@ -34559,7 +34734,13 @@ 12 - + + + 2 + 3 + 2 + + @@ -34569,7 +34750,13 @@ 12 - + + + 2 + 3 + 2 + + @@ -34893,15 +35080,15 @@ type_vla - 0 + 1 type_id - 0 + 1 decl - 0 + 1 @@ -34911,7 +35098,13 @@ 12 - + + + 1 + 2 + 1 + + @@ -34921,7 +35114,13 @@ 12 - + + + 1 + 2 + 1 + + @@ -35121,15 +35320,15 @@ constexpr_if_initialization - 0 + 3 constexpr_if_stmt - 0 + 3 init_id - 0 + 3 @@ -35143,7 +35342,7 @@ 1 2 - 17 + 3 @@ -35155,7 +35354,13 @@ 12 - + + + 1 + 2 + 3 + + @@ -35355,15 +35560,15 @@ switch_initialization - 0 + 8 switch_stmt - 0 + 8 init_id - 0 + 8 @@ -35377,7 +35582,7 @@ 1 2 - 17 + 8 @@ -35389,7 +35594,13 @@ 12 - + + + 1 + 2 + 8 + + @@ -36170,11 +36381,11 @@ stmt_decl_bind - 580841 + 580849 stmt - 541059 + 541066 num @@ -36182,7 +36393,7 @@ decl - 580737 + 580745 @@ -36196,7 +36407,7 @@ 1 2 - 520371 + 520377 2 @@ -36217,7 +36428,7 @@ 1 2 - 520371 + 520377 2 @@ -36420,7 +36631,7 @@ 1 2 - 580700 + 580707 2 @@ -36441,7 +36652,7 @@ 1 2 - 580737 + 580745 @@ -36451,11 +36662,11 @@ stmt_decl_entry_bind - 580841 + 580849 stmt - 541059 + 541066 num @@ -36463,7 +36674,7 @@ decl_entry - 580783 + 580791 @@ -36477,7 +36688,7 @@ 1 2 - 520371 + 520377 2 @@ -36498,7 +36709,7 @@ 1 2 - 520371 + 520377 2 @@ -36701,7 +36912,7 @@ 1 2 - 580762 + 580770 3 @@ -36722,7 +36933,7 @@ 1 2 - 580783 + 580791 @@ -36732,15 +36943,15 @@ blockscope - 1410861 + 1410469 block - 1410861 + 1410469 enclosing - 1295546 + 1295224 @@ -36754,7 +36965,7 @@ 1 2 - 1410861 + 1410469 @@ -36770,12 +36981,12 @@ 1 2 - 1230185 + 1229903 2 13 - 65360 + 65321 @@ -36971,19 +37182,19 @@ preprocdirects - 4190567 + 4188015 id - 4190567 + 4188015 kind - 5135 + 5132 location - 4149950 + 4147423 @@ -36997,7 +37208,7 @@ 1 2 - 4190567 + 4188015 @@ -37013,7 +37224,7 @@ 1 2 - 4190567 + 4188015 @@ -37161,7 +37372,7 @@ 1 2 - 4149483 + 4146956 88 @@ -37182,7 +37393,7 @@ 1 2 - 4149950 + 4147423 @@ -37192,15 +37403,15 @@ preprocpair - 1431403 + 1430532 begin - 1197038 + 1196309 elseelifend - 1431403 + 1430532 @@ -37214,17 +37425,17 @@ 1 2 - 978546 + 977950 2 3 - 208221 + 208094 3 11 - 10270 + 10264 @@ -37240,7 +37451,7 @@ 1 2 - 1431403 + 1430532 @@ -37250,22 +37461,22 @@ preproctrue - 767056 + 766589 branch - 767056 + 766589 preprocfalse - 331473 + 331271 branch - 331473 + 331271 @@ -37418,15 +37629,15 @@ includes - 313265 + 313074 id - 313265 + 313074 included - 117182 + 117111 @@ -37440,7 +37651,7 @@ 1 2 - 313265 + 313074 @@ -37456,32 +37667,32 @@ 1 2 - 61159 + 61121 2 3 - 21942 + 21929 3 4 - 12605 + 12597 4 6 - 10270 + 10264 6 14 - 8870 + 8865 14 47 - 2334 + 2332 From 636c047c415af7b43e4577bb675ed72fd2bc0796 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 21 Nov 2024 13:53:49 +0000 Subject: [PATCH 35/47] Rust: Use final class. --- rust/ql/lib/codeql/rust/Concepts.qll | 32 ++++------------------------ 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/rust/ql/lib/codeql/rust/Concepts.qll b/rust/ql/lib/codeql/rust/Concepts.qll index 62cd24467d1..402c720ab6f 100644 --- a/rust/ql/lib/codeql/rust/Concepts.qll +++ b/rust/ql/lib/codeql/rust/Concepts.qll @@ -13,21 +13,7 @@ private import codeql.threatmodels.ThreatModels * Extend this class to refine existing API models. If you want to model new APIs, * extend `ThreatModelSource::Range` instead. */ -class ThreatModelSource extends DataFlow::Node instanceof ThreatModelSource::Range { - /** - * Gets a string that represents the source kind with respect to threat modeling. - * - * See - * - https://github.com/github/codeql/blob/main/docs/codeql/reusables/threat-model-description.rst - * - https://github.com/github/codeql/blob/main/shared/threat-models/ext/threat-model-grouping.model.yml - */ - string getThreatModel() { result = super.getThreatModel() } - - /** - * Gets a string that describes the type of this threat-model source. - */ - string getSourceType() { result = super.getSourceType() } -} +final class ThreatModelSource = ThreatModelSource::Range; /** * Provides a class for modeling new sources for specific threat-models. @@ -67,12 +53,7 @@ class ActiveThreatModelSource extends ThreatModelSource { * Extend this class to refine existing API models. If you want to model new APIs, * extend `SqlConstruction::Range` instead. */ -class SqlConstruction extends DataFlow::Node instanceof SqlConstruction::Range { - /** - * Gets the argument that specifies the SQL statements to be constructed. - */ - DataFlow::Node getSql() { result = super.getSql() } -} +final class SqlConstruction = SqlConstruction::Range; /** * Provides a class for modeling new SQL execution APIs. @@ -98,12 +79,7 @@ module SqlConstruction { * Extend this class to refine existing API models. If you want to model new APIs, * extend `SqlExecution::Range` instead. */ -class SqlExecution extends DataFlow::Node instanceof SqlExecution::Range { - /** - * Gets the argument that specifies the SQL statements to be executed. - */ - DataFlow::Node getSql() { result = super.getSql() } -} +final class SqlExecution = SqlExecution::Range; /** * Provides a class for modeling new SQL execution APIs. @@ -123,7 +99,7 @@ module SqlExecution { /** * A data-flow node that performs SQL sanitization. */ -class SqlSanitization extends DataFlow::Node instanceof SqlSanitization::Range { } +final class SqlSanitization = SqlSanitization::Range; /** * Provides a class for modeling new SQL sanitization APIs. From bb70bfce4354f7e53c153b239513f6f36c7fd144 Mon Sep 17 00:00:00 2001 From: Simon Friis Vindum Date: Thu, 21 Nov 2024 13:11:40 +0100 Subject: [PATCH 36/47] Rust: Tweak global data flow test and add inline flow test --- .../dataflow/global/inline-flow.expected | 6 ++++ .../dataflow/global/inline-flow.ql | 12 +++++++ .../library-tests/dataflow/global/main.rs | 22 ++++++++---- .../dataflow/global/viableCallable.expected | 35 ++++++++++--------- 4 files changed, 52 insertions(+), 23 deletions(-) create mode 100644 rust/ql/test/library-tests/dataflow/global/inline-flow.expected create mode 100644 rust/ql/test/library-tests/dataflow/global/inline-flow.ql diff --git a/rust/ql/test/library-tests/dataflow/global/inline-flow.expected b/rust/ql/test/library-tests/dataflow/global/inline-flow.expected new file mode 100644 index 00000000000..4e4a41dfc62 --- /dev/null +++ b/rust/ql/test/library-tests/dataflow/global/inline-flow.expected @@ -0,0 +1,6 @@ +models +edges +nodes +subpaths +testFailures +#select diff --git a/rust/ql/test/library-tests/dataflow/global/inline-flow.ql b/rust/ql/test/library-tests/dataflow/global/inline-flow.ql new file mode 100644 index 00000000000..ad553fe548d --- /dev/null +++ b/rust/ql/test/library-tests/dataflow/global/inline-flow.ql @@ -0,0 +1,12 @@ +/** + * @kind path-problem + */ + +import rust +import utils.InlineFlowTest +import DefaultFlowTest +import ValueFlow::PathGraph + +from ValueFlow::PathNode source, ValueFlow::PathNode sink +where ValueFlow::flowPath(source, sink) +select sink, source, sink, "$@", source, source.toString() diff --git a/rust/ql/test/library-tests/dataflow/global/main.rs b/rust/ql/test/library-tests/dataflow/global/main.rs index eb3a5985692..730ddd3cf4a 100644 --- a/rust/ql/test/library-tests/dataflow/global/main.rs +++ b/rust/ql/test/library-tests/dataflow/global/main.rs @@ -15,11 +15,11 @@ fn get_data(n: i64) -> i64 { fn data_out_of_call() { let a = get_data(7); - sink(a); // $ hasValueFlow=n + sink(a); // $ MISSING: hasValueFlow=n } fn data_in(n: i64) { - sink(n + 7); // $ hasValueFlow + sink(n); // $ MISSING: hasValueFlow=3 } fn data_in_to_call() { @@ -34,7 +34,15 @@ fn pass_through(i: i64) -> i64 { fn data_through_call() { let a = source(1); let b = pass_through(a); - sink(b); // $ hasValueFlow=1 + sink(b); // $ MISSING: hasValueFlow=1 +} + +fn block_expression_as_argument() { + let a = pass_through({ + println!("Hello"); + source(14) + }); + sink(a); // $ MISSING: hasValueFlow=14 } // ----------------------------------------------------------------------------- @@ -46,7 +54,7 @@ struct MyFlag { impl MyFlag { fn data_in(&self, n: i64) { - sink(n); // $ hasValueFlow=1 + sink(n); // $ MISSING: hasValueFlow=1 } fn get_data(&self) -> i64 { if self.flag { @@ -67,7 +75,7 @@ impl MyFlag { fn data_out_of_method() { let mn = MyFlag { flag: true }; let a = mn.get_data(); - sink(a); + sink(a); // $ MISSING: hasValueFlow=2 } fn data_in_to_method_call() { @@ -79,8 +87,8 @@ fn data_in_to_method_call() { fn data_through_method() { let mn = MyFlag { flag: true }; let a = source(4); - mn.data_through(a); - sink(a); // $ hasValueFlow=4 + let b = mn.data_through(a); + sink(b); // $ MISSING: hasValueFlow=4 } fn main() { diff --git a/rust/ql/test/library-tests/dataflow/global/viableCallable.expected b/rust/ql/test/library-tests/dataflow/global/viableCallable.expected index 6a15bb25249..3a1db5acf22 100644 --- a/rust/ql/test/library-tests/dataflow/global/viableCallable.expected +++ b/rust/ql/test/library-tests/dataflow/global/viableCallable.expected @@ -1,24 +1,27 @@ | main.rs:13:5:13:13 | CallExpr | main.rs:1:1:3:1 | source | | main.rs:17:13:17:23 | CallExpr | main.rs:12:1:14:1 | get_data | | main.rs:18:5:18:11 | CallExpr | main.rs:5:1:7:1 | sink | -| main.rs:22:5:22:15 | CallExpr | main.rs:5:1:7:1 | sink | +| main.rs:22:5:22:11 | CallExpr | main.rs:5:1:7:1 | sink | | main.rs:26:13:26:21 | CallExpr | main.rs:1:1:3:1 | source | | main.rs:27:5:27:14 | CallExpr | main.rs:21:1:23:1 | data_in | | main.rs:35:13:35:21 | CallExpr | main.rs:1:1:3:1 | source | | main.rs:36:13:36:27 | CallExpr | main.rs:30:1:32:1 | pass_through | | main.rs:37:5:37:11 | CallExpr | main.rs:5:1:7:1 | sink | -| main.rs:49:9:49:15 | CallExpr | main.rs:5:1:7:1 | sink | -| main.rs:55:13:55:21 | CallExpr | main.rs:1:1:3:1 | source | -| main.rs:69:13:69:25 | ... .get_data(...) | main.rs:51:5:57:5 | get_data | -| main.rs:70:5:70:11 | CallExpr | main.rs:5:1:7:1 | sink | -| main.rs:75:13:75:21 | CallExpr | main.rs:1:1:3:1 | source | -| main.rs:76:5:76:17 | ... .data_in(...) | main.rs:48:5:50:5 | data_in | -| main.rs:81:13:81:21 | CallExpr | main.rs:1:1:3:1 | source | -| main.rs:82:5:82:22 | ... .data_through(...) | main.rs:58:5:64:5 | data_through | -| main.rs:83:5:83:11 | CallExpr | main.rs:5:1:7:1 | sink | -| main.rs:87:5:87:22 | CallExpr | main.rs:16:1:19:1 | data_out_of_call | -| main.rs:88:5:88:21 | CallExpr | main.rs:25:1:28:1 | data_in_to_call | -| main.rs:89:5:89:23 | CallExpr | main.rs:34:1:38:1 | data_through_call | -| main.rs:91:5:91:24 | CallExpr | main.rs:67:1:71:1 | data_out_of_method | -| main.rs:92:5:92:28 | CallExpr | main.rs:73:1:77:1 | data_in_to_method_call | -| main.rs:93:5:93:25 | CallExpr | main.rs:79:1:84:1 | data_through_method | +| main.rs:41:13:44:6 | CallExpr | main.rs:30:1:32:1 | pass_through | +| main.rs:43:9:43:18 | CallExpr | main.rs:1:1:3:1 | source | +| main.rs:45:5:45:11 | CallExpr | main.rs:5:1:7:1 | sink | +| main.rs:57:9:57:15 | CallExpr | main.rs:5:1:7:1 | sink | +| main.rs:63:13:63:21 | CallExpr | main.rs:1:1:3:1 | source | +| main.rs:77:13:77:25 | ... .get_data(...) | main.rs:59:5:65:5 | get_data | +| main.rs:78:5:78:11 | CallExpr | main.rs:5:1:7:1 | sink | +| main.rs:83:13:83:21 | CallExpr | main.rs:1:1:3:1 | source | +| main.rs:84:5:84:17 | ... .data_in(...) | main.rs:56:5:58:5 | data_in | +| main.rs:89:13:89:21 | CallExpr | main.rs:1:1:3:1 | source | +| main.rs:90:13:90:30 | ... .data_through(...) | main.rs:66:5:72:5 | data_through | +| main.rs:91:5:91:11 | CallExpr | main.rs:5:1:7:1 | sink | +| main.rs:95:5:95:22 | CallExpr | main.rs:16:1:19:1 | data_out_of_call | +| main.rs:96:5:96:21 | CallExpr | main.rs:25:1:28:1 | data_in_to_call | +| main.rs:97:5:97:23 | CallExpr | main.rs:34:1:38:1 | data_through_call | +| main.rs:99:5:99:24 | CallExpr | main.rs:75:1:79:1 | data_out_of_method | +| main.rs:100:5:100:28 | CallExpr | main.rs:81:1:85:1 | data_in_to_method_call | +| main.rs:101:5:101:25 | CallExpr | main.rs:87:1:92:1 | data_through_method | From 49e002843e78f7c0d4e9da70aeeeb378447add50 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 21 Nov 2024 13:57:45 +0000 Subject: [PATCH 37/47] Rust: Restore some documentation. --- rust/ql/lib/codeql/rust/Concepts.qll | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust/ql/lib/codeql/rust/Concepts.qll b/rust/ql/lib/codeql/rust/Concepts.qll index 402c720ab6f..5befe006bc6 100644 --- a/rust/ql/lib/codeql/rust/Concepts.qll +++ b/rust/ql/lib/codeql/rust/Concepts.qll @@ -25,6 +25,10 @@ module ThreatModelSource { abstract class Range extends DataFlow::Node { /** * Gets a string that represents the source kind with respect to threat modeling. + * + * See + * - https://github.com/github/codeql/blob/main/docs/codeql/reusables/threat-model-description.rst + * - https://github.com/github/codeql/blob/main/shared/threat-models/ext/threat-model-grouping.model.yml */ abstract string getThreatModel(); From fffeac6a1384358335992191baf33228436da6e2 Mon Sep 17 00:00:00 2001 From: Simon Friis Vindum Date: Thu, 21 Nov 2024 15:11:25 +0100 Subject: [PATCH 38/47] Rust: Extend data flow library instantiation for global data flow --- .../lib/codeql/rust/controlflow/CfgNodes.qll | 2 + .../rust/dataflow/internal/DataFlowImpl.qll | 164 +++++++++++++----- .../CONSISTENCY/DataFlowConsistency.expected | 4 +- .../dataflow/barrier/inline-flow.expected | 13 ++ .../library-tests/dataflow/barrier/main.rs | 4 +- .../dataflow/global/inline-flow.expected | 69 ++++++++ .../library-tests/dataflow/global/main.rs | 12 +- .../dataflow/local/DataFlowStep.expected | 6 + 8 files changed, 219 insertions(+), 55 deletions(-) diff --git a/rust/ql/lib/codeql/rust/controlflow/CfgNodes.qll b/rust/ql/lib/codeql/rust/controlflow/CfgNodes.qll index b60a6b857b2..3ee3a3eeb61 100644 --- a/rust/ql/lib/codeql/rust/controlflow/CfgNodes.qll +++ b/rust/ql/lib/codeql/rust/controlflow/CfgNodes.qll @@ -13,6 +13,8 @@ class AstCfgNode = CfgImpl::AstCfgNode; class ExitCfgNode = CfgImpl::ExitNode; +class AnnotatedExitCfgNode = CfgImpl::AnnotatedExitNode; + /** * An assignment expression, for example * diff --git a/rust/ql/lib/codeql/rust/dataflow/internal/DataFlowImpl.qll b/rust/ql/lib/codeql/rust/dataflow/internal/DataFlowImpl.qll index 210f12825cf..35ab9ade7b2 100644 --- a/rust/ql/lib/codeql/rust/dataflow/internal/DataFlowImpl.qll +++ b/rust/ql/lib/codeql/rust/dataflow/internal/DataFlowImpl.qll @@ -43,22 +43,59 @@ final class DataFlowCallable extends TDataFlowCallable { } final class DataFlowCall extends TDataFlowCall { + private CallExprBaseCfgNode call; + + DataFlowCall() { this = TCall(call) } + /** Gets the underlying call in the CFG, if any. */ - CallExprCfgNode asCallExprCfgNode() { this = TNormalCall(result) } + CallExprCfgNode asCallExprCfgNode() { result = call } - MethodCallExprCfgNode asMethodCallExprCfgNode() { this = TMethodCall(result) } + MethodCallExprCfgNode asMethodCallExprCfgNode() { result = call } - CallExprBaseCfgNode asExprCfgNode() { - result = this.asCallExprCfgNode() or result = this.asMethodCallExprCfgNode() - } + CallExprBaseCfgNode asCallBaseExprCfgNode() { result = call } DataFlowCallable getEnclosingCallable() { - result = TCfgScope(this.asExprCfgNode().getExpr().getEnclosingCfgScope()) + result = TCfgScope(call.getExpr().getEnclosingCfgScope()) } - string toString() { result = this.asExprCfgNode().toString() } + string toString() { result = this.asCallBaseExprCfgNode().toString() } - Location getLocation() { result = this.asExprCfgNode().getLocation() } + Location getLocation() { result = this.asCallBaseExprCfgNode().getLocation() } +} + +/** + * The position of a parameter or an argument in a function or call. + * + * As there is a 1-to-1 correspondence between parameter positions and + * arguments positions in Rust we use the same type for both. + */ +final class ParameterPosition extends TParameterPosition { + /** Gets the underlying integer position, if any. */ + int getPosition() { this = TPositionalParameterPosition(result) } + + /** Holds if this position represents the `self` position. */ + predicate isSelf() { this = TSelfParameterPosition() } + + /** Gets a textual representation of this position. */ + string toString() { + result = this.getPosition().toString() + or + result = "self" and this.isSelf() + } + + AstNode getParameterIn(ParamList ps) { + result = ps.getParam(this.getPosition()) + or + result = ps.getSelfParam() and this.isSelf() + } +} + +/** Holds if `arg` is an argument of `call` at the position `pos`. */ +private predicate isArgumentForCall(ExprCfgNode arg, CallExprBaseCfgNode call, ParameterPosition pos) { + arg = call.getArgument(pos.getPosition()) + or + // The self argument in a method call. + arg = call.(MethodCallExprCfgNode).getReceiver() and pos.isSelf() } module Node { @@ -93,11 +130,6 @@ module Node { * Gets this node's underlying SSA definition, if any. */ Ssa::Definition asDefinition() { none() } - - /** - * Gets the parameter that corresponds to this node, if any. - */ - Param asParameter() { none() } } /** A node type that is not implemented. */ @@ -111,7 +143,7 @@ module Node { override Location getLocation() { none() } } - /** A data flow node that corresponds to a CFG node for an AST node. */ + /** A data flow node that corresponds directly to a CFG node for an AST node. */ abstract class AstCfgFlowNode extends Node { AstCfgNode n; @@ -145,24 +177,37 @@ module Node { PatNode() { this = TPatNode(n) } - /** Gets the `Pat` in the AST that this node corresponds to. */ - Pat getPat() { result = n.getPat() } + /** Gets the `PatCfgNode` in the CFG that this node corresponds to. */ + PatCfgNode getPat() { result = n } } + abstract class ParameterNode extends AstCfgFlowNode { } + /** * The value of a parameter at function entry, viewed as a node in a data * flow graph. */ - final class ParameterNode extends AstCfgFlowNode, TParameterNode { + final class NormalParameterNode extends ParameterNode, TParameterNode { override ParamCfgNode n; - ParameterNode() { this = TParameterNode(n) } + NormalParameterNode() { this = TParameterNode(n) } /** Gets the parameter in the CFG that this node corresponds to. */ ParamCfgNode getParameter() { result = n } } - final class ArgumentNode = NaNode; + final class SelfParameterNode extends ParameterNode, TSelfParameterNode { + override SelfParamCfgNode n; + + SelfParameterNode() { this = TSelfParameterNode(n) } + + /** Gets the self parameter in the AST that this node corresponds to. */ + SelfParamCfgNode getSelfParameter() { result = n } + } + + final class ArgumentNode extends ExprNode { + ArgumentNode() { isArgumentForCall(n, _, _) } + } /** An SSA node. */ class SsaNode extends Node, TSsaNode { @@ -185,7 +230,10 @@ module Node { /** A data flow node that represents a value returned by a callable. */ final class ReturnNode extends ExprNode { - ReturnNode() { this.getCfgNode().getASuccessor() instanceof ExitCfgNode } + ReturnNode() { + this.getCfgNode().getASuccessor() instanceof ExitCfgNode or + this.getCfgNode().getASuccessor() instanceof AnnotatedExitCfgNode + } ReturnKind getKind() { any() } } @@ -197,10 +245,10 @@ module Node { } final private class ExprOutNode extends ExprNode, OutNode { - ExprOutNode() { this.asExpr() instanceof CallExprCfgNode } + ExprOutNode() { this.asExpr() instanceof CallExprBaseCfgNode } /** Gets the underlying call CFG node that includes this out node. */ - override DataFlowCall getCall() { result.asExprCfgNode() = this.getCfgNode() } + override DataFlowCall getCall() { result.asCallBaseExprCfgNode() = this.getCfgNode() } } /** @@ -214,9 +262,19 @@ module Node { * Nodes corresponding to AST elements, for example `ExprNode`, usually refer * to the value before the update. */ - final class PostUpdateNode extends Node::NaNode { + final class PostUpdateNode extends Node, TArgumentPostUpdateNode { + private ExprCfgNode n; + + PostUpdateNode() { this = TArgumentPostUpdateNode(n) } + /** Gets the node before the state update. */ - Node getPreUpdateNode() { none() } + Node getPreUpdateNode() { result = TExprNode(n) } + + final override CfgScope getCfgScope() { result = n.getAstNode().getEnclosingCfgScope() } + + final override Location getLocation() { result = n.getAstNode().getLocation() } + + final override string toString() { result = n.getAstNode().toString() } } final class CastNode = NaNode; @@ -226,25 +284,27 @@ final class Node = Node::Node; /** Provides logic related to SSA. */ module SsaFlow { - private module Impl = SsaImpl::DataFlowIntegration; + private module SsaFlow = SsaImpl::DataFlowIntegration; - private Node::ParameterNode toParameterNode(ParamCfgNode p) { result.getParameter() = p } + private Node::ParameterNode toParameterNode(ParamCfgNode p) { + result.(Node::NormalParameterNode).getParameter() = p + } /** Converts a control flow node into an SSA control flow node. */ - Impl::Node asNode(Node n) { + SsaFlow::Node asNode(Node n) { n = TSsaNode(result) or - result.(Impl::ExprNode).getExpr() = n.asExpr() + result.(SsaFlow::ExprNode).getExpr() = n.asExpr() or - n = toParameterNode(result.(Impl::ParameterNode).getParameter()) + n = toParameterNode(result.(SsaFlow::ParameterNode).getParameter()) } predicate localFlowStep(SsaImpl::DefinitionExt def, Node nodeFrom, Node nodeTo, boolean isUseStep) { - Impl::localFlowStep(def, asNode(nodeFrom), asNode(nodeTo), isUseStep) + SsaFlow::localFlowStep(def, asNode(nodeFrom), asNode(nodeTo), isUseStep) } predicate localMustFlowStep(SsaImpl::DefinitionExt def, Node nodeFrom, Node nodeTo) { - Impl::localMustFlowStep(def, asNode(nodeFrom), asNode(nodeTo)) + SsaFlow::localMustFlowStep(def, asNode(nodeFrom), asNode(nodeTo)) } } @@ -276,6 +336,8 @@ module LocalFlow { nodeFrom.(Node::AstCfgFlowNode).getCfgNode() = nodeTo.(Node::SsaNode).getDefinitionExt().(Ssa::WriteDefinition).getControlFlowNode() or + nodeFrom.(Node::NormalParameterNode).getParameter().getPat() = nodeTo.(Node::PatNode).getPat() + or SsaFlow::localFlowStep(_, nodeFrom, nodeTo, _) or exists(AssignmentExprCfgNode a | @@ -291,6 +353,8 @@ private class ReturnKindAlias = ReturnKind; private class DataFlowCallAlias = DataFlowCall; +private class ParameterPositionAlias = ParameterPosition; + module RustDataFlow implements InputSig { /** * An element, viewed as a node in a data flow graph. Either an expression @@ -310,9 +374,15 @@ module RustDataFlow implements InputSig { final class CastNode = Node::NaNode; - predicate isParameterNode(ParameterNode p, DataFlowCallable c, ParameterPosition pos) { none() } + /** Holds if `p` is a parameter of `c` at the position `pos`. */ + predicate isParameterNode(ParameterNode p, DataFlowCallable c, ParameterPosition pos) { + p.getCfgNode().getAstNode() = pos.getParameterIn(c.asCfgScope().(Function).getParamList()) + } - predicate isArgumentNode(ArgumentNode n, DataFlowCall call, ArgumentPosition pos) { none() } + /** Holds if `n` is an argument of `c` at the position `pos`. */ + predicate isArgumentNode(ArgumentNode n, DataFlowCall call, ArgumentPosition pos) { + isArgumentForCall(n.getCfgNode(), call.asCallBaseExprCfgNode(), pos) + } DataFlowCallable nodeGetEnclosingCallable(Node node) { result = node.getEnclosingCallable() } @@ -335,10 +405,9 @@ module RustDataFlow implements InputSig { DataFlowCallable viableCallable(DataFlowCall c) { exists(Function f, string name | result.asCfgScope() = f and name = f.getName().toString() | if f.getParamList().hasSelfParam() - then name = c.asMethodCallExprCfgNode().getMethodCallExpr().getNameRef().getText() + then name = c.asMethodCallExprCfgNode().getNameRef().getText() else - name = - c.asCallExprCfgNode().getCallExpr().getExpr().(PathExpr).getPath().getPart().toString() + name = c.asCallExprCfgNode().getExpr().getExpr().(PathExpr).getPath().getPart().toString() ) } @@ -377,19 +446,15 @@ module RustDataFlow implements InputSig { ContentApprox getContentApprox(Content c) { any() } - class ParameterPosition extends string { - ParameterPosition() { this = "pos" } - } + class ParameterPosition = ParameterPositionAlias; - class ArgumentPosition extends string { - ArgumentPosition() { this = "pos" } - } + class ArgumentPosition = ParameterPosition; /** * Holds if the parameter position `ppos` matches the argument position * `apos`. */ - predicate parameterMatch(ParameterPosition ppos, ArgumentPosition apos) { none() } + predicate parameterMatch(ParameterPosition ppos, ArgumentPosition apos) { ppos = apos } /** * Holds if there is a simple local flow step from `node1` to `node2`. These @@ -497,13 +562,13 @@ private module Cached { newtype TNode = TExprNode(ExprCfgNode n) or TParameterNode(ParamCfgNode p) or + TSelfParameterNode(SelfParamCfgNode p) or TPatNode(PatCfgNode p) or + TArgumentPostUpdateNode(ExprCfgNode e) { isArgumentForCall(e, _, _) } or TSsaNode(SsaImpl::DataFlowIntegration::SsaNode node) cached - newtype TDataFlowCall = - TNormalCall(CallExprCfgNode c) or - TMethodCall(MethodCallExprCfgNode c) + newtype TDataFlowCall = TCall(CallExprBaseCfgNode c) cached newtype TOptionalContentSet = @@ -521,6 +586,13 @@ private module Cached { predicate localFlowStepImpl(Node::Node nodeFrom, Node::Node nodeTo) { LocalFlow::localFlowStepCommon(nodeFrom, nodeTo) } + + cached + newtype TParameterPosition = + TPositionalParameterPosition(int i) { + exists(any(ParamList l).getParam(i)) or exists(any(ArgList l).getArg(i)) + } or + TSelfParameterPosition() } import Cached diff --git a/rust/ql/test/extractor-tests/generated/MacroItems/CONSISTENCY/DataFlowConsistency.expected b/rust/ql/test/extractor-tests/generated/MacroItems/CONSISTENCY/DataFlowConsistency.expected index 02210855a69..1a9588efd03 100644 --- a/rust/ql/test/extractor-tests/generated/MacroItems/CONSISTENCY/DataFlowConsistency.expected +++ b/rust/ql/test/extractor-tests/generated/MacroItems/CONSISTENCY/DataFlowConsistency.expected @@ -1,9 +1,11 @@ uniqueNodeLocation | file://:0:0:0:0 | ... .parent(...) | Node should have one location but has 0. | +| file://:0:0:0:0 | ... .parent(...) | Node should have one location but has 0. | | file://:0:0:0:0 | ... .unwrap(...) | Node should have one location but has 0. | | file://:0:0:0:0 | BlockExpr | Node should have one location but has 0. | | file://:0:0:0:0 | Param | Node should have one location but has 0. | | file://:0:0:0:0 | path | Node should have one location but has 0. | | file://:0:0:0:0 | path | Node should have one location but has 0. | +| file://:0:0:0:0 | path | Node should have one location but has 0. | missingLocation -| Nodes without location: 6 | +| Nodes without location: 8 | diff --git a/rust/ql/test/library-tests/dataflow/barrier/inline-flow.expected b/rust/ql/test/library-tests/dataflow/barrier/inline-flow.expected index a54c75d0c17..dd98dd9cee4 100644 --- a/rust/ql/test/library-tests/dataflow/barrier/inline-flow.expected +++ b/rust/ql/test/library-tests/dataflow/barrier/inline-flow.expected @@ -1,16 +1,29 @@ models edges +| main.rs:9:13:9:19 | Param : unit | main.rs:9:30:14:1 | BlockExpr : unit | provenance | | | main.rs:21:13:21:21 | CallExpr : unit | main.rs:22:10:22:10 | s | provenance | | +| main.rs:26:13:26:21 | CallExpr : unit | main.rs:27:22:27:22 | s : unit | provenance | | +| main.rs:27:13:27:23 | CallExpr : unit | main.rs:28:10:28:10 | s | provenance | | +| main.rs:27:22:27:22 | s : unit | main.rs:9:13:9:19 | Param : unit | provenance | | +| main.rs:27:22:27:22 | s : unit | main.rs:27:13:27:23 | CallExpr : unit | provenance | | | main.rs:32:13:32:21 | CallExpr : unit | main.rs:33:10:33:10 | s | provenance | | nodes +| main.rs:9:13:9:19 | Param : unit | semmle.label | Param : unit | +| main.rs:9:30:14:1 | BlockExpr : unit | semmle.label | BlockExpr : unit | | main.rs:17:10:17:18 | CallExpr | semmle.label | CallExpr | | main.rs:21:13:21:21 | CallExpr : unit | semmle.label | CallExpr : unit | | main.rs:22:10:22:10 | s | semmle.label | s | +| main.rs:26:13:26:21 | CallExpr : unit | semmle.label | CallExpr : unit | +| main.rs:27:13:27:23 | CallExpr : unit | semmle.label | CallExpr : unit | +| main.rs:27:22:27:22 | s : unit | semmle.label | s : unit | +| main.rs:28:10:28:10 | s | semmle.label | s | | main.rs:32:13:32:21 | CallExpr : unit | semmle.label | CallExpr : unit | | main.rs:33:10:33:10 | s | semmle.label | s | subpaths +| main.rs:27:22:27:22 | s : unit | main.rs:9:13:9:19 | Param : unit | main.rs:9:30:14:1 | BlockExpr : unit | main.rs:27:13:27:23 | CallExpr : unit | testFailures #select | main.rs:17:10:17:18 | CallExpr | main.rs:17:10:17:18 | CallExpr | main.rs:17:10:17:18 | CallExpr | $@ | main.rs:17:10:17:18 | CallExpr | CallExpr | | main.rs:22:10:22:10 | s | main.rs:21:13:21:21 | CallExpr : unit | main.rs:22:10:22:10 | s | $@ | main.rs:21:13:21:21 | CallExpr : unit | CallExpr : unit | +| main.rs:28:10:28:10 | s | main.rs:26:13:26:21 | CallExpr : unit | main.rs:28:10:28:10 | s | $@ | main.rs:26:13:26:21 | CallExpr : unit | CallExpr : unit | | main.rs:33:10:33:10 | s | main.rs:32:13:32:21 | CallExpr : unit | main.rs:33:10:33:10 | s | $@ | main.rs:32:13:32:21 | CallExpr : unit | CallExpr : unit | diff --git a/rust/ql/test/library-tests/dataflow/barrier/main.rs b/rust/ql/test/library-tests/dataflow/barrier/main.rs index 8a0a7bc2be6..14935f0f328 100644 --- a/rust/ql/test/library-tests/dataflow/barrier/main.rs +++ b/rust/ql/test/library-tests/dataflow/barrier/main.rs @@ -9,7 +9,7 @@ fn sink(s: &str) { fn sanitize(s: &str) -> &str { match s { "dangerous" => "", - s => s + s => s, } } @@ -25,7 +25,7 @@ fn through_variable() { fn with_barrier() { let s = source(1); let s = sanitize(s); - sink(s); + sink(s); // $ SPURIOUS: hasValueFlow=1 } fn main() { diff --git a/rust/ql/test/library-tests/dataflow/global/inline-flow.expected b/rust/ql/test/library-tests/dataflow/global/inline-flow.expected index 4e4a41dfc62..6054637c126 100644 --- a/rust/ql/test/library-tests/dataflow/global/inline-flow.expected +++ b/rust/ql/test/library-tests/dataflow/global/inline-flow.expected @@ -1,6 +1,75 @@ models edges +| main.rs:12:28:14:1 | BlockExpr : unit | main.rs:17:13:17:23 | CallExpr : unit | provenance | | +| main.rs:13:5:13:13 | CallExpr : unit | main.rs:12:28:14:1 | BlockExpr : unit | provenance | | +| main.rs:17:13:17:23 | CallExpr : unit | main.rs:18:10:18:10 | a | provenance | | +| main.rs:21:12:21:17 | Param : unit | main.rs:22:10:22:10 | n | provenance | | +| main.rs:26:13:26:21 | CallExpr : unit | main.rs:27:13:27:13 | a : unit | provenance | | +| main.rs:27:13:27:13 | a : unit | main.rs:21:12:21:17 | Param : unit | provenance | | +| main.rs:30:17:30:22 | Param : unit | main.rs:30:32:32:1 | BlockExpr : unit | provenance | | +| main.rs:35:13:35:21 | CallExpr : unit | main.rs:36:26:36:26 | a : unit | provenance | | +| main.rs:36:13:36:27 | CallExpr : unit | main.rs:37:10:37:10 | b | provenance | | +| main.rs:36:26:36:26 | a : unit | main.rs:30:17:30:22 | Param : unit | provenance | | +| main.rs:36:26:36:26 | a : unit | main.rs:36:13:36:27 | CallExpr : unit | provenance | | +| main.rs:41:13:44:6 | CallExpr : unit | main.rs:45:10:45:10 | a | provenance | | +| main.rs:41:26:44:5 | BlockExpr : unit | main.rs:30:17:30:22 | Param : unit | provenance | | +| main.rs:41:26:44:5 | BlockExpr : unit | main.rs:41:13:44:6 | CallExpr : unit | provenance | | +| main.rs:43:9:43:18 | CallExpr : unit | main.rs:41:26:44:5 | BlockExpr : unit | provenance | | +| main.rs:56:23:56:28 | Param : unit | main.rs:57:14:57:14 | n | provenance | | +| main.rs:59:31:65:5 | BlockExpr : unit | main.rs:77:13:77:25 | ... .get_data(...) : unit | provenance | | +| main.rs:63:13:63:21 | CallExpr : unit | main.rs:59:31:65:5 | BlockExpr : unit | provenance | | +| main.rs:66:28:66:33 | Param : unit | main.rs:66:43:72:5 | BlockExpr : unit | provenance | | +| main.rs:77:13:77:25 | ... .get_data(...) : unit | main.rs:78:10:78:10 | a | provenance | | +| main.rs:83:13:83:21 | CallExpr : unit | main.rs:84:16:84:16 | a : unit | provenance | | +| main.rs:84:16:84:16 | a : unit | main.rs:56:23:56:28 | Param : unit | provenance | | +| main.rs:89:13:89:21 | CallExpr : unit | main.rs:90:29:90:29 | a : unit | provenance | | +| main.rs:90:13:90:30 | ... .data_through(...) : unit | main.rs:91:10:91:10 | b | provenance | | +| main.rs:90:29:90:29 | a : unit | main.rs:66:28:66:33 | Param : unit | provenance | | +| main.rs:90:29:90:29 | a : unit | main.rs:90:13:90:30 | ... .data_through(...) : unit | provenance | | nodes +| main.rs:12:28:14:1 | BlockExpr : unit | semmle.label | BlockExpr : unit | +| main.rs:13:5:13:13 | CallExpr : unit | semmle.label | CallExpr : unit | +| main.rs:17:13:17:23 | CallExpr : unit | semmle.label | CallExpr : unit | +| main.rs:18:10:18:10 | a | semmle.label | a | +| main.rs:21:12:21:17 | Param : unit | semmle.label | Param : unit | +| main.rs:22:10:22:10 | n | semmle.label | n | +| main.rs:26:13:26:21 | CallExpr : unit | semmle.label | CallExpr : unit | +| main.rs:27:13:27:13 | a : unit | semmle.label | a : unit | +| main.rs:30:17:30:22 | Param : unit | semmle.label | Param : unit | +| main.rs:30:32:32:1 | BlockExpr : unit | semmle.label | BlockExpr : unit | +| main.rs:35:13:35:21 | CallExpr : unit | semmle.label | CallExpr : unit | +| main.rs:36:13:36:27 | CallExpr : unit | semmle.label | CallExpr : unit | +| main.rs:36:26:36:26 | a : unit | semmle.label | a : unit | +| main.rs:37:10:37:10 | b | semmle.label | b | +| main.rs:41:13:44:6 | CallExpr : unit | semmle.label | CallExpr : unit | +| main.rs:41:26:44:5 | BlockExpr : unit | semmle.label | BlockExpr : unit | +| main.rs:43:9:43:18 | CallExpr : unit | semmle.label | CallExpr : unit | +| main.rs:45:10:45:10 | a | semmle.label | a | +| main.rs:56:23:56:28 | Param : unit | semmle.label | Param : unit | +| main.rs:57:14:57:14 | n | semmle.label | n | +| main.rs:59:31:65:5 | BlockExpr : unit | semmle.label | BlockExpr : unit | +| main.rs:63:13:63:21 | CallExpr : unit | semmle.label | CallExpr : unit | +| main.rs:66:28:66:33 | Param : unit | semmle.label | Param : unit | +| main.rs:66:43:72:5 | BlockExpr : unit | semmle.label | BlockExpr : unit | +| main.rs:77:13:77:25 | ... .get_data(...) : unit | semmle.label | ... .get_data(...) : unit | +| main.rs:78:10:78:10 | a | semmle.label | a | +| main.rs:83:13:83:21 | CallExpr : unit | semmle.label | CallExpr : unit | +| main.rs:84:16:84:16 | a : unit | semmle.label | a : unit | +| main.rs:89:13:89:21 | CallExpr : unit | semmle.label | CallExpr : unit | +| main.rs:90:13:90:30 | ... .data_through(...) : unit | semmle.label | ... .data_through(...) : unit | +| main.rs:90:29:90:29 | a : unit | semmle.label | a : unit | +| main.rs:91:10:91:10 | b | semmle.label | b | subpaths +| main.rs:36:26:36:26 | a : unit | main.rs:30:17:30:22 | Param : unit | main.rs:30:32:32:1 | BlockExpr : unit | main.rs:36:13:36:27 | CallExpr : unit | +| main.rs:41:26:44:5 | BlockExpr : unit | main.rs:30:17:30:22 | Param : unit | main.rs:30:32:32:1 | BlockExpr : unit | main.rs:41:13:44:6 | CallExpr : unit | +| main.rs:90:29:90:29 | a : unit | main.rs:66:28:66:33 | Param : unit | main.rs:66:43:72:5 | BlockExpr : unit | main.rs:90:13:90:30 | ... .data_through(...) : unit | testFailures +| main.rs:45:10:45:10 | a | Fixed missing result: hasValueFlow=14 | #select +| main.rs:18:10:18:10 | a | main.rs:13:5:13:13 | CallExpr : unit | main.rs:18:10:18:10 | a | $@ | main.rs:13:5:13:13 | CallExpr : unit | CallExpr : unit | +| main.rs:22:10:22:10 | n | main.rs:26:13:26:21 | CallExpr : unit | main.rs:22:10:22:10 | n | $@ | main.rs:26:13:26:21 | CallExpr : unit | CallExpr : unit | +| main.rs:37:10:37:10 | b | main.rs:35:13:35:21 | CallExpr : unit | main.rs:37:10:37:10 | b | $@ | main.rs:35:13:35:21 | CallExpr : unit | CallExpr : unit | +| main.rs:45:10:45:10 | a | main.rs:43:9:43:18 | CallExpr : unit | main.rs:45:10:45:10 | a | $@ | main.rs:43:9:43:18 | CallExpr : unit | CallExpr : unit | +| main.rs:57:14:57:14 | n | main.rs:83:13:83:21 | CallExpr : unit | main.rs:57:14:57:14 | n | $@ | main.rs:83:13:83:21 | CallExpr : unit | CallExpr : unit | +| main.rs:78:10:78:10 | a | main.rs:63:13:63:21 | CallExpr : unit | main.rs:78:10:78:10 | a | $@ | main.rs:63:13:63:21 | CallExpr : unit | CallExpr : unit | +| main.rs:91:10:91:10 | b | main.rs:89:13:89:21 | CallExpr : unit | main.rs:91:10:91:10 | b | $@ | main.rs:89:13:89:21 | CallExpr : unit | CallExpr : unit | diff --git a/rust/ql/test/library-tests/dataflow/global/main.rs b/rust/ql/test/library-tests/dataflow/global/main.rs index 730ddd3cf4a..ebdb7b30d75 100644 --- a/rust/ql/test/library-tests/dataflow/global/main.rs +++ b/rust/ql/test/library-tests/dataflow/global/main.rs @@ -15,11 +15,11 @@ fn get_data(n: i64) -> i64 { fn data_out_of_call() { let a = get_data(7); - sink(a); // $ MISSING: hasValueFlow=n + sink(a); // $ hasValueFlow=n } fn data_in(n: i64) { - sink(n); // $ MISSING: hasValueFlow=3 + sink(n); // $ hasValueFlow=3 } fn data_in_to_call() { @@ -34,7 +34,7 @@ fn pass_through(i: i64) -> i64 { fn data_through_call() { let a = source(1); let b = pass_through(a); - sink(b); // $ MISSING: hasValueFlow=1 + sink(b); // $ hasValueFlow=1 } fn block_expression_as_argument() { @@ -54,7 +54,7 @@ struct MyFlag { impl MyFlag { fn data_in(&self, n: i64) { - sink(n); // $ MISSING: hasValueFlow=1 + sink(n); // $ hasValueFlow=1 } fn get_data(&self) -> i64 { if self.flag { @@ -75,7 +75,7 @@ impl MyFlag { fn data_out_of_method() { let mn = MyFlag { flag: true }; let a = mn.get_data(); - sink(a); // $ MISSING: hasValueFlow=2 + sink(a); // $ hasValueFlow=2 } fn data_in_to_method_call() { @@ -88,7 +88,7 @@ fn data_through_method() { let mn = MyFlag { flag: true }; let a = source(4); let b = mn.data_through(a); - sink(b); // $ MISSING: hasValueFlow=4 + sink(b); // $ hasValueFlow=4 } fn main() { diff --git a/rust/ql/test/library-tests/dataflow/local/DataFlowStep.expected b/rust/ql/test/library-tests/dataflow/local/DataFlowStep.expected index 1ccc9c219c3..86bc28d7940 100644 --- a/rust/ql/test/library-tests/dataflow/local/DataFlowStep.expected +++ b/rust/ql/test/library-tests/dataflow/local/DataFlowStep.expected @@ -1,13 +1,16 @@ | main.rs:3:11:3:11 | [SSA] i | main.rs:4:12:4:12 | i | | main.rs:3:11:3:11 | i | main.rs:3:11:3:11 | [SSA] i | +| main.rs:3:11:3:16 | Param | main.rs:3:11:3:11 | i | | main.rs:4:5:4:12 | ... + ... | main.rs:3:26:5:1 | BlockExpr | | main.rs:7:9:7:9 | [SSA] s | main.rs:8:20:8:20 | s | | main.rs:7:9:7:9 | s | main.rs:7:9:7:9 | [SSA] s | +| main.rs:7:9:7:14 | Param | main.rs:7:9:7:9 | s | | main.rs:19:9:19:9 | [SSA] s | main.rs:20:10:20:10 | s | | main.rs:19:9:19:9 | s | main.rs:19:9:19:9 | [SSA] s | | main.rs:19:13:19:21 | CallExpr | main.rs:19:9:19:9 | s | | main.rs:23:18:23:21 | [SSA] cond | main.rs:26:16:26:19 | cond | | main.rs:23:18:23:21 | cond | main.rs:23:18:23:21 | [SSA] cond | +| main.rs:23:18:23:27 | Param | main.rs:23:18:23:21 | cond | | main.rs:24:9:24:9 | [SSA] a | main.rs:26:23:26:23 | a | | main.rs:24:9:24:9 | a | main.rs:24:9:24:9 | [SSA] a | | main.rs:24:13:24:21 | CallExpr | main.rs:24:9:24:9 | a | @@ -23,6 +26,7 @@ | main.rs:26:34:26:34 | b | main.rs:26:32:26:36 | BlockExpr | | main.rs:30:21:30:21 | [SSA] m | main.rs:32:19:32:19 | m | | main.rs:30:21:30:21 | m | main.rs:30:21:30:21 | [SSA] m | +| main.rs:30:21:30:34 | Param | main.rs:30:21:30:21 | m | | main.rs:31:9:31:9 | [SSA] a | main.rs:33:20:33:20 | a | | main.rs:31:9:31:9 | a | main.rs:31:9:31:9 | [SSA] a | | main.rs:31:13:31:21 | CallExpr | main.rs:31:9:31:9 | a | @@ -91,6 +95,7 @@ | main.rs:118:5:118:5 | a | main.rs:116:31:119:1 | BlockExpr | | main.rs:121:22:121:22 | [SSA] b | main.rs:123:12:123:12 | b | | main.rs:121:22:121:22 | b | main.rs:121:22:121:22 | [SSA] b | +| main.rs:121:22:121:28 | Param | main.rs:121:22:121:22 | b | | main.rs:122:9:122:9 | [SSA] a | main.rs:128:5:128:5 | a | | main.rs:122:9:122:9 | a | main.rs:122:9:122:9 | [SSA] a | | main.rs:122:13:127:5 | BlockExpr | main.rs:122:9:122:9 | a | @@ -100,6 +105,7 @@ | main.rs:128:5:128:5 | a | main.rs:121:38:129:1 | BlockExpr | | main.rs:131:22:131:22 | [SSA] b | main.rs:133:12:133:12 | b | | main.rs:131:22:131:22 | b | main.rs:131:22:131:22 | [SSA] b | +| main.rs:131:22:131:28 | Param | main.rs:131:22:131:22 | b | | main.rs:132:9:132:9 | [SSA] a | main.rs:138:5:138:5 | a | | main.rs:132:9:132:9 | a | main.rs:132:9:132:9 | [SSA] a | | main.rs:132:13:137:5 | BlockExpr | main.rs:132:9:132:9 | a | From b7c7a9ee7c2d5303ecc52c242f05e43dc4dae6d1 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 21 Nov 2024 14:23:51 +0000 Subject: [PATCH 39/47] Rust: Accept consistency check failures. --- .../security/CWE-089/CONSISTENCY/DataFlowConsistency.expected | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust/ql/test/query-tests/security/CWE-089/CONSISTENCY/DataFlowConsistency.expected b/rust/ql/test/query-tests/security/CWE-089/CONSISTENCY/DataFlowConsistency.expected index d9a60435a6f..6e35019c1cb 100644 --- a/rust/ql/test/query-tests/security/CWE-089/CONSISTENCY/DataFlowConsistency.expected +++ b/rust/ql/test/query-tests/security/CWE-089/CONSISTENCY/DataFlowConsistency.expected @@ -1,3 +1,7 @@ +uniqueEnclosingCallable +| sqlx.rs:52:72:52:84 | remote_number | Node should have one enclosing callable but has 0. | +| sqlx.rs:56:74:56:86 | remote_string | Node should have one enclosing callable but has 0. | +| sqlx.rs:199:32:199:44 | enable_remote | Node should have one enclosing callable but has 0. | uniqueNodeToString | sqlx.rs:154:13:154:81 | (no string representation) | Node should have one toString but has 0. | | sqlx.rs:156:17:156:86 | (no string representation) | Node should have one toString but has 0. | From f8fff4b18c5c93da643e055a5965b8d570875199 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:06:32 +0000 Subject: [PATCH 40/47] Update rust/ql/src/queries/security/CWE-089/SqlInjection.ql Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com> --- rust/ql/src/queries/security/CWE-089/SqlInjection.ql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/ql/src/queries/security/CWE-089/SqlInjection.ql b/rust/ql/src/queries/security/CWE-089/SqlInjection.ql index cf1ea5534aa..ee2a3d14486 100644 --- a/rust/ql/src/queries/security/CWE-089/SqlInjection.ql +++ b/rust/ql/src/queries/security/CWE-089/SqlInjection.ql @@ -1,6 +1,6 @@ /** * @name Database query built from user-controlled sources - * @description Building a database query from user-controlled sources is vulnerable to insertion of malicious code by the user. + * @description Building a database query from user-controlled sources is vulnerable to insertion of malicious code by attackers. * @kind path-problem * @problem.severity error * @security-severity 8.8 From 01cddcc0428a5f4ae926e4dcd9e22592795ed719 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:54:47 +0000 Subject: [PATCH 41/47] Rust: Suggestions from docs review. --- rust/ql/src/queries/security/CWE-089/SqlInjection.qhelp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/ql/src/queries/security/CWE-089/SqlInjection.qhelp b/rust/ql/src/queries/security/CWE-089/SqlInjection.qhelp index bcf54fca582..0b56ac54d0d 100644 --- a/rust/ql/src/queries/security/CWE-089/SqlInjection.qhelp +++ b/rust/ql/src/queries/security/CWE-089/SqlInjection.qhelp @@ -5,7 +5,7 @@

    -If a database query (such as a SQL query) is built from user-provided data without sufficient sanitization, a user may be able to run malicious database queries. An attacker can craft the part of the query they control to change the overall meaning of the query. +If a database query (such as an SQL query) is built from user-provided data without sufficient sanitization, a user may be able to run malicious database queries. An attacker can craft the part of the query they control to change the overall meaning of the query.

    From e81c3483dbe2c93f210ecc33841fd06a2e064f9f Mon Sep 17 00:00:00 2001 From: Simon Friis Vindum Date: Fri, 22 Nov 2024 09:43:27 +0100 Subject: [PATCH 42/47] Rust: Apply suggestions from PR comments --- .../rust/dataflow/internal/DataFlowImpl.qll | 24 +++++++++---------- .../dataflow/global/inline-flow.expected | 1 - .../library-tests/dataflow/global/main.rs | 2 +- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/rust/ql/lib/codeql/rust/dataflow/internal/DataFlowImpl.qll b/rust/ql/lib/codeql/rust/dataflow/internal/DataFlowImpl.qll index 35ab9ade7b2..1ec8a42ee7e 100644 --- a/rust/ql/lib/codeql/rust/dataflow/internal/DataFlowImpl.qll +++ b/rust/ql/lib/codeql/rust/dataflow/internal/DataFlowImpl.qll @@ -187,10 +187,10 @@ module Node { * The value of a parameter at function entry, viewed as a node in a data * flow graph. */ - final class NormalParameterNode extends ParameterNode, TParameterNode { + final class PositionalParameterNode extends ParameterNode, TParameterNode { override ParamCfgNode n; - NormalParameterNode() { this = TParameterNode(n) } + PositionalParameterNode() { this = TParameterNode(n) } /** Gets the parameter in the CFG that this node corresponds to. */ ParamCfgNode getParameter() { result = n } @@ -230,10 +230,7 @@ module Node { /** A data flow node that represents a value returned by a callable. */ final class ReturnNode extends ExprNode { - ReturnNode() { - this.getCfgNode().getASuccessor() instanceof ExitCfgNode or - this.getCfgNode().getASuccessor() instanceof AnnotatedExitCfgNode - } + ReturnNode() { this.getCfgNode().getASuccessor() instanceof AnnotatedExitCfgNode } ReturnKind getKind() { any() } } @@ -270,11 +267,11 @@ module Node { /** Gets the node before the state update. */ Node getPreUpdateNode() { result = TExprNode(n) } - final override CfgScope getCfgScope() { result = n.getAstNode().getEnclosingCfgScope() } + final override CfgScope getCfgScope() { result = n.getScope() } - final override Location getLocation() { result = n.getAstNode().getLocation() } + final override Location getLocation() { result = n.getLocation() } - final override string toString() { result = n.getAstNode().toString() } + final override string toString() { result = n.toString() } } final class CastNode = NaNode; @@ -287,7 +284,7 @@ module SsaFlow { private module SsaFlow = SsaImpl::DataFlowIntegration; private Node::ParameterNode toParameterNode(ParamCfgNode p) { - result.(Node::NormalParameterNode).getParameter() = p + result.(Node::PositionalParameterNode).getParameter() = p } /** Converts a control flow node into an SSA control flow node. */ @@ -336,7 +333,8 @@ module LocalFlow { nodeFrom.(Node::AstCfgFlowNode).getCfgNode() = nodeTo.(Node::SsaNode).getDefinitionExt().(Ssa::WriteDefinition).getControlFlowNode() or - nodeFrom.(Node::NormalParameterNode).getParameter().getPat() = nodeTo.(Node::PatNode).getPat() + nodeFrom.(Node::PositionalParameterNode).getParameter().getPat() = + nodeTo.(Node::PatNode).getPat() or SsaFlow::localFlowStep(_, nodeFrom, nodeTo, _) or @@ -376,7 +374,7 @@ module RustDataFlow implements InputSig { /** Holds if `p` is a parameter of `c` at the position `pos`. */ predicate isParameterNode(ParameterNode p, DataFlowCallable c, ParameterPosition pos) { - p.getCfgNode().getAstNode() = pos.getParameterIn(c.asCfgScope().(Function).getParamList()) + p.getCfgNode().getAstNode() = pos.getParameterIn(c.asCfgScope().(Callable).getParamList()) } /** Holds if `n` is an argument of `c` at the position `pos`. */ @@ -590,7 +588,7 @@ private module Cached { cached newtype TParameterPosition = TPositionalParameterPosition(int i) { - exists(any(ParamList l).getParam(i)) or exists(any(ArgList l).getArg(i)) + i in [0 .. max([any(ParamList l).getNumberOfParams(), any(ArgList l).getNumberOfArgs()]) - 1] } or TSelfParameterPosition() } diff --git a/rust/ql/test/library-tests/dataflow/global/inline-flow.expected b/rust/ql/test/library-tests/dataflow/global/inline-flow.expected index 6054637c126..8c1d90ee45a 100644 --- a/rust/ql/test/library-tests/dataflow/global/inline-flow.expected +++ b/rust/ql/test/library-tests/dataflow/global/inline-flow.expected @@ -64,7 +64,6 @@ subpaths | main.rs:41:26:44:5 | BlockExpr : unit | main.rs:30:17:30:22 | Param : unit | main.rs:30:32:32:1 | BlockExpr : unit | main.rs:41:13:44:6 | CallExpr : unit | | main.rs:90:29:90:29 | a : unit | main.rs:66:28:66:33 | Param : unit | main.rs:66:43:72:5 | BlockExpr : unit | main.rs:90:13:90:30 | ... .data_through(...) : unit | testFailures -| main.rs:45:10:45:10 | a | Fixed missing result: hasValueFlow=14 | #select | main.rs:18:10:18:10 | a | main.rs:13:5:13:13 | CallExpr : unit | main.rs:18:10:18:10 | a | $@ | main.rs:13:5:13:13 | CallExpr : unit | CallExpr : unit | | main.rs:22:10:22:10 | n | main.rs:26:13:26:21 | CallExpr : unit | main.rs:22:10:22:10 | n | $@ | main.rs:26:13:26:21 | CallExpr : unit | CallExpr : unit | diff --git a/rust/ql/test/library-tests/dataflow/global/main.rs b/rust/ql/test/library-tests/dataflow/global/main.rs index ebdb7b30d75..77c37a945b8 100644 --- a/rust/ql/test/library-tests/dataflow/global/main.rs +++ b/rust/ql/test/library-tests/dataflow/global/main.rs @@ -42,7 +42,7 @@ fn block_expression_as_argument() { println!("Hello"); source(14) }); - sink(a); // $ MISSING: hasValueFlow=14 + sink(a); // $ hasValueFlow=14 } // ----------------------------------------------------------------------------- From e49a5be62f4cd70a4c9e3564f06299364139282b Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Fri, 22 Nov 2024 12:16:12 +0100 Subject: [PATCH 43/47] Rust: fix parent/child relationship for format entities --- rust/ql/.generated.list | 32 +++++++++++-------- rust/ql/.gitattributes | 12 +++++-- .../internal/generated/CfgNodes.qll | 21 +++++++++++- rust/ql/lib/codeql/rust/elements/Format.qll | 1 + .../codeql/rust/elements/FormatArgsExpr.qll | 7 +++- .../codeql/rust/elements/FormatArgument.qll | 1 + .../elements/internal/FormatArgsExprImpl.qll | 14 ++++---- .../elements/internal/FormatArgumentImpl.qll | 2 ++ .../rust/elements/internal/FormatImpl.qll | 2 ++ .../elements/internal/generated/Format.qll | 11 +++++++ .../internal/generated/FormatArgsExpr.qll | 22 ++++++++++++- .../internal/generated/FormatArgument.qll | 11 +++++++ .../internal/generated/ParentChild.qll | 16 ++++++++-- .../rust/elements/internal/generated/Raw.qll | 6 +++- .../generated/.generated_tests.list | 6 ++-- .../extractor-tests/generated/.gitattributes | 4 ++- .../generated/FormatArgsExpr/Format.expected | 9 ++++++ .../generated/FormatArgsExpr/Format.ql | 12 +++++++ .../FormatArgsExpr/FormatArgsArg.expected | 8 +++++ .../FormatArgsArg.ql | 0 .../FormatArgsArg_getExpr.expected | 8 +++++ .../FormatArgsArg_getExpr.ql | 0 .../FormatArgsArg_getName.expected | 2 ++ .../FormatArgsArg_getName.ql | 0 .../FormatArgsExpr/FormatArgsExpr.expected | 7 ++++ .../FormatArgsExpr/FormatArgsExpr.ql | 9 ++++-- .../FormatArgsExpr_getArg.expected | 8 +++++ .../FormatArgsExpr_getFormat.expected | 9 ++++++ .../FormatArgsExpr_getFormat.ql | 7 ++++ .../FormatArgsExpr_getTemplate.expected | 7 ++++ .../FormatArgsExpr_getVariable.expected | 5 +++ .../FormatArgsExpr/FormatArgument.expected | 10 ++++++ .../FormatArgsExpr/FormatArgument.ql | 11 +++++++ .../FormatArgument_getVariable.expected | 5 +++ .../FormatArgument_getVariable.ql | 7 ++++ .../FormatTemplateVariableAccess.expected | 5 +++ .../FormatTemplateVariableAccess.ql | 7 ++++ .../Format_getArgument.expected | 10 ++++++ .../FormatArgsExpr/Format_getArgument.ql | 7 ++++ .../generated/FormatArgsExpr/gen_format.rs | 6 ++++ .../gen_format_args_arg.rs | 0 .../FormatArgsExpr/gen_format_args_expr.rs | 6 +++- .../FormatArgsExpr/gen_format_argument.rs | 8 +++++ rust/schema/annotations.py | 17 +++++++--- 44 files changed, 317 insertions(+), 41 deletions(-) create mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsExpr/Format.expected create mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsExpr/Format.ql create mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg.expected rename rust/ql/test/extractor-tests/generated/{FormatArgsArg => FormatArgsExpr}/FormatArgsArg.ql (100%) create mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg_getExpr.expected rename rust/ql/test/extractor-tests/generated/{FormatArgsArg => FormatArgsExpr}/FormatArgsArg_getExpr.ql (100%) create mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg_getName.expected rename rust/ql/test/extractor-tests/generated/{FormatArgsArg => FormatArgsExpr}/FormatArgsArg_getName.ql (100%) create mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getFormat.expected create mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getFormat.ql create mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getVariable.expected create mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgument.expected create mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgument.ql create mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgument_getVariable.expected create mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgument_getVariable.ql create mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess.expected create mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess.ql create mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsExpr/Format_getArgument.expected create mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsExpr/Format_getArgument.ql create mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsExpr/gen_format.rs rename rust/ql/test/extractor-tests/generated/{FormatArgsArg => FormatArgsExpr}/gen_format_args_arg.rs (100%) create mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsExpr/gen_format_argument.rs diff --git a/rust/ql/.generated.list b/rust/ql/.generated.list index e3fe15f3e5b..1d4dabf2871 100644 --- a/rust/ql/.generated.list +++ b/rust/ql/.generated.list @@ -1,4 +1,4 @@ -lib/codeql/rust/controlflow/internal/generated/CfgNodes.qll e7bcae1016e1853d46d9c91dc5f9b81e81d207fdf91fdaa6eadb3bf185879674 541d386db1f0b662d0cbe1aface1bc6e4b1bc484d1230b95523f35ca63c08875 +lib/codeql/rust/controlflow/internal/generated/CfgNodes.qll a2d9717410e73aca512cad3af633700158ddd80b1c07dfd6ebe0f84723b4ac5b 3cfd6ae768958db3a4d633b4d781a8f4be80eb7a0d2ee871773584128e4551fd lib/codeql/rust/elements/Abi.qll 4c973d28b6d628f5959d1f1cc793704572fd0acaae9a97dfce82ff9d73f73476 250f68350180af080f904cd34cb2af481c5c688dc93edf7365fd0ae99855e893 lib/codeql/rust/elements/ArgList.qll 661f5100f5d3ef8351452d9058b663a2a5c720eea8cf11bedd628969741486a2 28e424aac01a90fb58cd6f9f83c7e4cf379eea39e636bc0ba07efc818be71c71 lib/codeql/rust/elements/ArrayExpr.qll a3e6e122632f4011644ec31b37f88b32fe3f2b7e388e7e878a6883309937049f 12ccb5873d95c433da5606fd371d182ef2f71b78d0c53c2d6dec10fa45852bdc @@ -41,10 +41,10 @@ lib/codeql/rust/elements/FieldList.qll bd243adc4696c60f636055a1c2da28039fe202847 lib/codeql/rust/elements/FnPtrType.qll c4a90dc660cf620972dc23b95494f5caf9f050eabd4bdb52fdc061f8797ba9a1 f8defc91582fa503607664668f9e2e6c2cd8b320c7c449610f21e52e332a129f lib/codeql/rust/elements/ForExpr.qll 312804d53dd9236a2f2a15c9d6ec348b46e139a54eb5893e7e12487725df7444 fa5e20099b1179033bc209bad3548e3d1d4019c7fe0e455cec8ca1a9d48692ab lib/codeql/rust/elements/ForType.qll 0036bed8749358c356d78c4a0eef40d73e2796284293cde5604ae70ddd6d0470 4edcaf8f7c67d42ebe3ebb1be6a7643758717d4fe88f5f648b6a1c5ff4ee4de7 -lib/codeql/rust/elements/Format.qll 506172d176f4b965f428585c032464f4abe07a0e47c574f8e011d8641ec45370 653e81bf233b8729649064de64f4a7a8533f8864ac6d2ea913f347088c924c60 +lib/codeql/rust/elements/Format.qll 51222fa2d2e85d496ab093d74d3bc606ede3ce48f926106e059dc8478e657203 b4da6be38413c86f2e9d82004624abab16e23ef238197a5c85246009cce276d5 lib/codeql/rust/elements/FormatArgsArg.qll 5bc9b4cd1bac7131165836e93838c45452a08ea6011741cbddace3cbf9c69440 f825140e98dc9800d5c045402186793c7b21511448e2f6bf6402d1e06305219c -lib/codeql/rust/elements/FormatArgsExpr.qll f2ffad5a1105b29a8437c8ed6cf918cfcf4d65ac164bbf1be0585c3b673ca749 3ba20dc312a0a994bb43b37b2db72cbd4e06061b97918fa0e84ce355070ffbeb -lib/codeql/rust/elements/FormatArgument.qll bdd93e1da78637f19beee6f953d3a45512100e925d90cb5ad08a097f412009b8 2a0ae7eb885615e380f925c0d130a1b795bf3c395486550a1f1c9c82848f8d77 +lib/codeql/rust/elements/FormatArgsExpr.qll 8127cbe4082f7acc3d8a05298c2c9bea302519b8a6cd2d158a83c516d18fc487 88cf9b3bedd69a1150968f9a465c904bbb6805da0e0b90cfd1fc0dab1f6d9319 +lib/codeql/rust/elements/FormatArgument.qll f6fe17ee1481c353dd42edae8b5fa79aeb99dff25b4842ec9a6f267b1837d1e3 5aed19c2daf2383b89ad7fd527375641cff26ddee7afddb89bc0d18d520f4034 lib/codeql/rust/elements/FormatTemplateVariableAccess.qll ff3218a1dda30c232d0ecd9d1c60bbb9f3973456ef0bee1d1a12ad14b1e082b5 e4316291c939800d8b34d477d92be9404a30d52b7eee37302aef3d3205cf4ae0 lib/codeql/rust/elements/Function.qll 2c76c2c7036891996b1f0ebde16c414edf37ebb44ff9c3483088dc6218733e07 d84d017d98aa240bf3bee6502a030aa8cfb7ed95425ffa9853e73b41485e1f4a lib/codeql/rust/elements/GenericArg.qll 5f11ce0e3c5f08de84db61f56ba1b984652455ba6b95a8b8a5b5a235913d4072 756b6a73d66fde45bdcc65ce2362a5b1391af2927e6d54b6550b3ecd5fd11e75 @@ -494,10 +494,10 @@ lib/codeql/rust/elements/internal/generated/FieldList.qll 43c13c6e3c9ba75a7a4cb8 lib/codeql/rust/elements/internal/generated/FnPtrType.qll 748d766dbefd19a7d644734c57885eeede66897029bbfe1b87919517f43bfde2 5a7d80acc00e56594ed85026a8ea4923104d2e98c2e42db8c5bcd32ddd164e48 lib/codeql/rust/elements/internal/generated/ForExpr.qll 541b62b48911d4999f9ed64ab6c8b9910073ac4add0225761f319677328cf120 976c3a91c9eedfb1e2d9ea76ac501348643b3d23c723d7a777042258d416d091 lib/codeql/rust/elements/internal/generated/ForType.qll 3d43d044a1189281f09c55caafb6c8020a836f49e2866077086101925a573cf2 646b59bfd1b428aaf7211f574c49f79cb4c6a79ca151aa0663b2b31480298721 -lib/codeql/rust/elements/internal/generated/Format.qll 37ad20cf2bf363b4027a8913d095292c8a4eb8ccdf2a9965f2fb7d41930f9bfe 329b89cdd75ce951269273dd18897e32ff5cfcc94f451001c64143386c1e48dd +lib/codeql/rust/elements/internal/generated/Format.qll df7ef61e6ba61fa0eb093f8e6b3e7a0329104e03f659c9507db9535b8b4ea759 ef8ddd98405fc84938ad8cd5f87d2858e01d06a6bb00566a785a984b60a79dc6 lib/codeql/rust/elements/internal/generated/FormatArgsArg.qll e07a1ae310f590003f1b88fada7dcf4847c99adb9d4c838d1c88e66e1da85c5f 0ef7342451fe2cb06e765fb4b33bb8c4a9b927f5edbc8feb5c6ba3655697f447 -lib/codeql/rust/elements/internal/generated/FormatArgsExpr.qll 40d6daa7d2bafb33798a21d79774dc802cfbd7a31618ac3bd0149399ea2bf893 d1172e2151791228559004792e125fc4625f6a26ffad25f29efb0ad263bf8795 -lib/codeql/rust/elements/internal/generated/FormatArgument.qll 00646f38217a66978b8b2648cca39dddbed22ece693b26cb682f019fbfedda95 e364e085f967847a7ed21b76156a9203d64032f0f0eea357b4779885a41bf9a7 +lib/codeql/rust/elements/internal/generated/FormatArgsExpr.qll 8aed8715a27d3af3de56ded4610c6792a25216b1544eb7e57c8b0b37c14bd9c1 590a2b0063d2ecd00bbbd1ce29603c8fd69972e34e6daddf309c915ce4ec1375 +lib/codeql/rust/elements/internal/generated/FormatArgument.qll cd05153276e63e689c95d5537fbc7d892615f62e110323759ef02e23a7587407 be2a4531b498f01625effa4c631d51ee8857698b00cfb829074120a0f2696d57 lib/codeql/rust/elements/internal/generated/FormatTemplateVariableAccess.qll a6175214fad445df9234b3ee9bf5147da75baf82473fb8d384b455e3add0dac1 a928db0ff126b2e54a18f5c488232abd1bd6c5eda24591d3c3bb80c6ee71c770 lib/codeql/rust/elements/internal/generated/Function.qll f285ee0c771f897eba6db34a7e98f3cfb7db91b0df252ff4b37fc9d779de0bfb 07401e832565ff376acda219514c2e2bbe4ae5058c76a73b40ca6ca66f1626c7 lib/codeql/rust/elements/internal/generated/GenericArg.qll 464da0ba1c5ddcd1be68617167f177773d99b5ac4775ec8ea24d503e789a9099 6faa1033d59baf7c210ac4837a55781cfc054b7acbad8027faf4630dbfa6e101 @@ -549,7 +549,7 @@ lib/codeql/rust/elements/internal/generated/ParamList.qll c808c9d84dd7800573832b lib/codeql/rust/elements/internal/generated/ParenExpr.qll bc0731505bfe88516205ec360582a4222d2681d11342c93e15258590ddee82f2 d4bd6e0c80cf1d63746c88d4bcb3a01d4c75732e5da09e3ebd9437ced227fb60 lib/codeql/rust/elements/internal/generated/ParenPat.qll ce24b8f8ecbf0f204af200317405724063887257460c80cf250c39b2fdf37185 e7c87d37e1a0ca7ea03840017e1aa9ddb7f927f1f3b6396c0305b46aeee33db6 lib/codeql/rust/elements/internal/generated/ParenType.qll 9cc954d73f8330dcac7b475f97748b63af5c8766dee9d2f2872c0a7e4c903537 c07534c8a9c683c4a9b11d490095647e420de0a0bfc23273eaf6f31b00244273 -lib/codeql/rust/elements/internal/generated/ParentChild.qll b4d25c43ed44715053255c3c2f8aeb8d21826adc365f24026b2123a4f25cba86 1bc4bb0380a1a8b69055ffeac203b11b2a1b94e5ad88d1b32ff659e8feb26016 +lib/codeql/rust/elements/internal/generated/ParentChild.qll c1eca840f6c97dc3c7fec5deaf1be98c17558610ffc37b503571779afdadc912 9564f6ae3803505c2bc086b76e43570127a13374655d2013c77ce1863e0c1397 lib/codeql/rust/elements/internal/generated/Pat.qll 3605ac062be2f294ee73336e9669027b8b655f4ad55660e1eab35266275154ee 7f9400db2884d336dd1d21df2a8093759c2a110be9bf6482ce8e80ae0fd74ed4 lib/codeql/rust/elements/internal/generated/Path.qll f2b1be2f8f44001a6533533c978c4a9a8b7d64838d6f39eef5f0c0e7890611b8 d724a00a38f42429ffa8fb3bffbb5ec69e16a32ceeeb1d1f026fc7adf87424a8 lib/codeql/rust/elements/internal/generated/PathExpr.qll 2096e3c1db22ee488a761690adabfc9cfdea501c99f7c5d96c0019cb113fc506 54245ce0449c4e263173213df01e079d5168a758503a5dbd61b25ad35a311140 @@ -562,7 +562,7 @@ lib/codeql/rust/elements/internal/generated/PtrType.qll 40099c5a4041314b66932dfd lib/codeql/rust/elements/internal/generated/PureSynthConstructors.qll ea294a3ba33fd1bc632046c4fedbcb84dcb961a8e4599969d65893b19d90e590 ea294a3ba33fd1bc632046c4fedbcb84dcb961a8e4599969d65893b19d90e590 lib/codeql/rust/elements/internal/generated/RangeExpr.qll 23cca03bf43535f33b22a38894f70d669787be4e4f5b8fe5c8f7b964d30e9027 18624cef6c6b679eeace2a98737e472432e0ead354cca02192b4d45330f047c9 lib/codeql/rust/elements/internal/generated/RangePat.qll efd93730de217cf50dcba5875595263a5eadf9f7e4e1272401342a094d158614 229b251b3d118932e31e78ac4dfb75f48b766f240f20d436062785606d44467b -lib/codeql/rust/elements/internal/generated/Raw.qll 5f83209cda8319c5c6c932631b60c6f2163d2d9cf7be63f63523e2206c01d004 3581039746e86365f37644e86ac2c89d67e2123aa1b039d9e0afdffc7156c96d +lib/codeql/rust/elements/internal/generated/Raw.qll d679e866776a927f61d62ba980203e1142454606bdac69cc9b6720679ca5bbdd f47922df7f8c8efba0e2e5adde030247e43f02e9df7d263096c697bfe65c4277 lib/codeql/rust/elements/internal/generated/RecordExpr.qll eb6cb662e463f9260efae1a6ce874fa781172063b916ef1963f861e9942d308d 1a21cbccc8f3799ff13281e822818ebfb21d81591720a427cac3625512cb9d40 lib/codeql/rust/elements/internal/generated/RecordExprField.qll 7e9f8663d3b74ebbc9603b10c9912f082febba6bd73d344b100bbd3edf837802 fbe6b578e7fd5d5a6f21bbb8c388957ab7210a6a249ec71510a50fb35b319ea1 lib/codeql/rust/elements/internal/generated/RecordExprFieldList.qll 179a97211fe7aa6265085d4d54115cdbc0e1cd7c9b2135591e8f36d6432f13d3 dd44bbbc1e83a1ed3a587afb729d7debf7aeb7b63245de181726af13090e50c0 @@ -752,13 +752,19 @@ test/extractor-tests/generated/ForExpr/ForExpr_getPat.ql 1e0205a9b3a58fd2ddba49e test/extractor-tests/generated/ForType/ForType.ql ba930d0c4fe52d57449ce4025b1c3e49c688afc5ef18ee8ac1ed7a9fd3eb8d41 08e9aa0301a942f6f9564ddeddc69606f3e2916e1b551cc56ae3b6048c56ce61 test/extractor-tests/generated/ForType/ForType_getGenericParamList.ql e25cd79737bbae92d8f417c6bbf6fb8ae660976b8005cd91d0900c7076fdd827 b1e32b7e3ca9f29a4564f83e37ae53de6baf04837a393e6dedc64a01cc7d10e8 test/extractor-tests/generated/ForType/ForType_getTy.ql e932d3412828bb83afc42e2dc1a4cbe9fcf25ec9a9617ec138722f834091a61a 298fc9df34b2cb436c8f180c4d229341ee4a73e3c451b905f017f32a6f65056c -test/extractor-tests/generated/FormatArgsArg/FormatArgsArg.ql a521903c73f79e2616f7b8ef76790e11cbf432f8437825d52d117da232022b9e 4cb195d09ecb51e5bbd5c1c069ec1720f74fc074efc88b0f5c07cfc140167775 -test/extractor-tests/generated/FormatArgsArg/FormatArgsArg_getExpr.ql 7e1a7f902fb661660760d2a2f3f4cb6818a0c9f5b5061ede6ae80223774e4e09 8a50f64cba6f56320631206c801160201e3c98e74367bb035d689baaa9b4e411 -test/extractor-tests/generated/FormatArgsArg/FormatArgsArg_getName.ql 0e2f24388d516e14d195957163a2d5d97029c9e11a83ca71cf69e00ecc0bb2a8 dab2969f5ae6a15ec331c0152e7c116d1ee2c3d073b2d4da59ffbcb83404c65f -test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr.ql 0cd439f61569ecf046e9548c458329647f331bfa034ae8b3d4f7628595881287 013a948607e1ac96100ea9a8cd3c8f357e378ac21baa015dcf4927022c2bdafb +test/extractor-tests/generated/FormatArgsExpr/Format.ql 25268dd7ad2a58b071c3a38164944c1b7389dfdda01c99ef2694a475596341b4 0a3f674d5a4f005835b9a5ba11a6e8bf58477829258f30ae7d8f76f8986f7b7f +test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg.ql a521903c73f79e2616f7b8ef76790e11cbf432f8437825d52d117da232022b9e 4cb195d09ecb51e5bbd5c1c069ec1720f74fc074efc88b0f5c07cfc140167775 +test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg_getExpr.ql 7e1a7f902fb661660760d2a2f3f4cb6818a0c9f5b5061ede6ae80223774e4e09 8a50f64cba6f56320631206c801160201e3c98e74367bb035d689baaa9b4e411 +test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg_getName.ql 0e2f24388d516e14d195957163a2d5d97029c9e11a83ca71cf69e00ecc0bb2a8 dab2969f5ae6a15ec331c0152e7c116d1ee2c3d073b2d4da59ffbcb83404c65f +test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr.ql 7b6f09b23d0dffa19b8dddf7f5cfe53068f8a8e5279e235c6d54e60616bd0822 47db74f035770ce708a00355acbfd4ae99152b7eb29cf28001985806a4efe5aa test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getArg.ql 8f692486be1546b914b17abdff4a989dfbaa889bfa1fc44597f4357806c1a1dd da9fd237e31e9c8dd0ef0c3c968157815b87d3e8dcdfd74674c988ce2ab6d270 test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getAttr.ql 1f9bf1344f942e65c3a3591b6ae04d3f5a2a1a65459bce0d976698de7d8a5958 02acb861d8ab4d32cf144c589881a888c3da5e2ade27e8c85fec3ae45219bb3b +test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getFormat.ql 02d3fad540700966488b24c62dcf200548154a2f10f578ee2995d8c4ebe32287 cccfe779b9804c2bb968a2b1f54da8a72393805c2c8b31d7160e8538f2f335f2 test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getTemplate.ql c912ac37275cbe7b3b29607bed1a3190c80779436422c14a475113e1bfd91a54 ef90f67a9b952a38ce557b1afbf0b5ce8551e83ddfaad8309a0c9523e40b5ea7 +test/extractor-tests/generated/FormatArgsExpr/FormatArgument.ql 7a7ee3a3322b4af8cb3b525cfed8cc9719d136ea80aa6b3fb30c7e16394dd93f 5aa8a77d7741b02f8ceb9e5991efa4c2c43c6f1624989218990e985108dae535 +test/extractor-tests/generated/FormatArgsExpr/FormatArgument_getVariable.ql 7bd4ec3dde2ef0463585794101e6cc426c368b0e4ab95fbb1f24f8f0a76cf471 e7b01e8b21df5b22c51643e2c909c6fc4ca96fda41b3290c907ba228abe8669b +test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess.ql 2793ba1ff52182dab992d82d3767a000928f6b2fbfdb621349cafc183f0d2480 c3777d03214f7feb9020de3ce45af6556129e39e9b30d083de605b70ab9a0a12 +test/extractor-tests/generated/FormatArgsExpr/Format_getArgument.ql 26d592398a17795427b5b6b51ff4a013ee15c31443e732a000baca5f2e65acca 7940a864b84b89e84d7fb186599cb8b6bcbead7141c592b8ab0c59fcd380d5fb test/extractor-tests/generated/Function/Function.ql c1c2a9b68c35f839ccd2b5e62e87d1acd94dcc2a3dc4c307c269b84b2a0806e6 1c446f19d2f81dd139aa5a1578d1b165e13bddbaeab8cfee8f0430bced3a99ab test/extractor-tests/generated/Function/Function_getAbi.ql e5c9c97de036ddd51cae5d99d41847c35c6b2eabbbd145f4467cb501edc606d8 0b81511528bd0ef9e63b19edfc3cb638d8af43eb87d018fad69d6ef8f8221454 test/extractor-tests/generated/Function/Function_getAttr.ql 44067ee11bdec8e91774ff10de0704a8c5c1b60816d587378e86bf3d82e1f660 b4bebf9441bda1f2d1e34e9261e07a7468cbabf53cf8047384f3c8b11869f04e diff --git a/rust/ql/.gitattributes b/rust/ql/.gitattributes index 68b893ba9c7..5e2e30e2ffe 100644 --- a/rust/ql/.gitattributes +++ b/rust/ql/.gitattributes @@ -754,13 +754,19 @@ /test/extractor-tests/generated/ForType/ForType.ql linguist-generated /test/extractor-tests/generated/ForType/ForType_getGenericParamList.ql linguist-generated /test/extractor-tests/generated/ForType/ForType_getTy.ql linguist-generated -/test/extractor-tests/generated/FormatArgsArg/FormatArgsArg.ql linguist-generated -/test/extractor-tests/generated/FormatArgsArg/FormatArgsArg_getExpr.ql linguist-generated -/test/extractor-tests/generated/FormatArgsArg/FormatArgsArg_getName.ql linguist-generated +/test/extractor-tests/generated/FormatArgsExpr/Format.ql linguist-generated +/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg.ql linguist-generated +/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg_getExpr.ql linguist-generated +/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg_getName.ql linguist-generated /test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr.ql linguist-generated /test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getArg.ql linguist-generated /test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getAttr.ql linguist-generated +/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getFormat.ql linguist-generated /test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getTemplate.ql linguist-generated +/test/extractor-tests/generated/FormatArgsExpr/FormatArgument.ql linguist-generated +/test/extractor-tests/generated/FormatArgsExpr/FormatArgument_getVariable.ql linguist-generated +/test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess.ql linguist-generated +/test/extractor-tests/generated/FormatArgsExpr/Format_getArgument.ql linguist-generated /test/extractor-tests/generated/Function/Function.ql linguist-generated /test/extractor-tests/generated/Function/Function_getAbi.ql linguist-generated /test/extractor-tests/generated/Function/Function_getAttr.ql linguist-generated diff --git a/rust/ql/lib/codeql/rust/controlflow/internal/generated/CfgNodes.qll b/rust/ql/lib/codeql/rust/controlflow/internal/generated/CfgNodes.qll index b42a00bf551..2cbb9e9d3bd 100644 --- a/rust/ql/lib/codeql/rust/controlflow/internal/generated/CfgNodes.qll +++ b/rust/ql/lib/codeql/rust/controlflow/internal/generated/CfgNodes.qll @@ -928,7 +928,11 @@ module MakeCfgNodes Input> { /** * A FormatArgsExpr. For example: * ```rust - * todo!() + * format_args!("no args"); + * format_args!("{} foo {:?}", 1, 2); + * format_args!("{b} foo {a:?}", a=1, b=2); + * let (x, y) = (1, 42); + * format_args!("{x}, {y}"); * ``` */ final class FormatArgsExprCfgNode extends CfgNodeFinal, ExprCfgNode { @@ -980,6 +984,21 @@ module MakeCfgNodes Input> { * Holds if `getTemplate()` exists. */ predicate hasTemplate() { exists(this.getTemplate()) } + + /** + * Gets the `index`th format of this format arguments expression (0-based). + */ + Format getFormat(int index) { result = node.getFormat(index) } + + /** + * Gets any of the formats of this format arguments expression. + */ + Format getAFormat() { result = this.getFormat(_) } + + /** + * Gets the number of formats of this format arguments expression. + */ + int getNumberOfFormats() { result = count(int i | exists(this.getFormat(i))) } } final private class ParentFormatTemplateVariableAccess extends ParentAstNode, diff --git a/rust/ql/lib/codeql/rust/elements/Format.qll b/rust/ql/lib/codeql/rust/elements/Format.qll index 0c8b5d1c541..f8b705be4fd 100644 --- a/rust/ql/lib/codeql/rust/elements/Format.qll +++ b/rust/ql/lib/codeql/rust/elements/Format.qll @@ -5,6 +5,7 @@ private import internal.FormatImpl import codeql.rust.elements.FormatArgsExpr +import codeql.rust.elements.FormatArgument import codeql.rust.elements.Locatable /** diff --git a/rust/ql/lib/codeql/rust/elements/FormatArgsExpr.qll b/rust/ql/lib/codeql/rust/elements/FormatArgsExpr.qll index 226b4d211aa..419a48a5335 100644 --- a/rust/ql/lib/codeql/rust/elements/FormatArgsExpr.qll +++ b/rust/ql/lib/codeql/rust/elements/FormatArgsExpr.qll @@ -6,12 +6,17 @@ private import internal.FormatArgsExprImpl import codeql.rust.elements.Attr import codeql.rust.elements.Expr +import codeql.rust.elements.Format import codeql.rust.elements.FormatArgsArg /** * A FormatArgsExpr. For example: * ```rust - * todo!() + * format_args!("no args"); + * format_args!("{} foo {:?}", 1, 2); + * format_args!("{b} foo {a:?}", a=1, b=2); + * let (x, y) = (1, 42); + * format_args!("{x}, {y}"); * ``` */ final class FormatArgsExpr = Impl::FormatArgsExpr; diff --git a/rust/ql/lib/codeql/rust/elements/FormatArgument.qll b/rust/ql/lib/codeql/rust/elements/FormatArgument.qll index 62313c52372..00e9007434b 100644 --- a/rust/ql/lib/codeql/rust/elements/FormatArgument.qll +++ b/rust/ql/lib/codeql/rust/elements/FormatArgument.qll @@ -5,6 +5,7 @@ private import internal.FormatArgumentImpl import codeql.rust.elements.Format +import codeql.rust.elements.FormatTemplateVariableAccess import codeql.rust.elements.Locatable /** diff --git a/rust/ql/lib/codeql/rust/elements/internal/FormatArgsExprImpl.qll b/rust/ql/lib/codeql/rust/elements/internal/FormatArgsExprImpl.qll index 667439777b1..59e020fb9e4 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/FormatArgsExprImpl.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/FormatArgsExprImpl.qll @@ -16,16 +16,16 @@ module Impl { /** * A FormatArgsExpr. For example: * ```rust - * todo!() + * format_args!("no args"); + * format_args!("{} foo {:?}", 1, 2); + * format_args!("{b} foo {a:?}", a=1, b=2); + * let (x, y) = (1, 42); + * format_args!("{x}, {y}"); * ``` */ class FormatArgsExpr extends Generated::FormatArgsExpr { - /** - * Gets the `index`th format of this `FormatArgsExpr`'s formatting template (0-based). - */ - Format getFormat(int index) { - result = - rank[index + 1](Format f, int i | f.getParent() = this and f.getIndex() = i | f order by i) + override Format getFormat(int index) { + result.getParent() = this and result.getIndex() = index + 1 } } } diff --git a/rust/ql/lib/codeql/rust/elements/internal/FormatArgumentImpl.qll b/rust/ql/lib/codeql/rust/elements/internal/FormatArgumentImpl.qll index 7370939716d..6719d9d8cb3 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/FormatArgumentImpl.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/FormatArgumentImpl.qll @@ -39,6 +39,8 @@ module Impl { override string toString() { result = name } override Format getParent() { result = Synth::TFormat(parent, index, _, _) } + + override FormatTemplateVariableAccess getVariable() { result.getArgument() = this } } private class FormatSynthLocationImpl extends FormatArgument, LocatableImpl::SynthLocatable { diff --git a/rust/ql/lib/codeql/rust/elements/internal/FormatImpl.qll b/rust/ql/lib/codeql/rust/elements/internal/FormatImpl.qll index 59c66768f05..7cde91053e9 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/FormatImpl.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/FormatImpl.qll @@ -38,6 +38,8 @@ module Impl { override int getIndex() { result = index } + override FormatArgument getArgument() { result.getParent() = this } + /** * Gets the name or position reference of this format, if any. For example `name` and `0` in: * ```rust diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/Format.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/Format.qll index f2ade708ffa..41c748d7fde 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/generated/Format.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/generated/Format.qll @@ -7,6 +7,7 @@ private import codeql.rust.elements.internal.generated.Synth private import codeql.rust.elements.internal.generated.Raw import codeql.rust.elements.FormatArgsExpr +import codeql.rust.elements.FormatArgument import codeql.rust.elements.internal.LocatableImpl::Impl as LocatableImpl /** @@ -34,5 +35,15 @@ module Generated { * Gets the index of this format. */ int getIndex() { none() } + + /** + * Gets the argument of this format, if it exists. + */ + FormatArgument getArgument() { none() } + + /** + * Holds if `getArgument()` exists. + */ + final predicate hasArgument() { exists(this.getArgument()) } } } diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/FormatArgsExpr.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/FormatArgsExpr.qll index 7fe088e2541..38034779e05 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/generated/FormatArgsExpr.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/generated/FormatArgsExpr.qll @@ -9,6 +9,7 @@ private import codeql.rust.elements.internal.generated.Raw import codeql.rust.elements.Attr import codeql.rust.elements.Expr import codeql.rust.elements.internal.ExprImpl::Impl as ExprImpl +import codeql.rust.elements.Format import codeql.rust.elements.FormatArgsArg /** @@ -19,7 +20,11 @@ module Generated { /** * A FormatArgsExpr. For example: * ```rust - * todo!() + * format_args!("no args"); + * format_args!("{} foo {:?}", 1, 2); + * format_args!("{b} foo {a:?}", a=1, b=2); + * let (x, y) = (1, 42); + * format_args!("{x}, {y}"); * ``` * INTERNAL: Do not reference the `Generated::FormatArgsExpr` class directly. * Use the subclass `FormatArgsExpr`, where the following predicates are available. @@ -81,5 +86,20 @@ module Generated { * Holds if `getTemplate()` exists. */ final predicate hasTemplate() { exists(this.getTemplate()) } + + /** + * Gets the `index`th format of this format arguments expression (0-based). + */ + Format getFormat(int index) { none() } + + /** + * Gets any of the formats of this format arguments expression. + */ + final Format getAFormat() { result = this.getFormat(_) } + + /** + * Gets the number of formats of this format arguments expression. + */ + final int getNumberOfFormats() { result = count(int i | exists(this.getFormat(i))) } } } diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/FormatArgument.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/FormatArgument.qll index 658d6b92e7a..a1db224494b 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/generated/FormatArgument.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/generated/FormatArgument.qll @@ -7,6 +7,7 @@ private import codeql.rust.elements.internal.generated.Synth private import codeql.rust.elements.internal.generated.Raw import codeql.rust.elements.Format +import codeql.rust.elements.FormatTemplateVariableAccess import codeql.rust.elements.internal.LocatableImpl::Impl as LocatableImpl /** @@ -33,5 +34,15 @@ module Generated { * Gets the parent of this format argument. */ Format getParent() { none() } + + /** + * Gets the variable of this format argument, if it exists. + */ + FormatTemplateVariableAccess getVariable() { none() } + + /** + * Holds if `getVariable()` exists. + */ + final predicate hasVariable() { exists(this.getVariable()) } } } diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/ParentChild.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/ParentChild.qll index 470207683ae..a396da834d4 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/generated/ParentChild.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/generated/ParentChild.qll @@ -52,14 +52,17 @@ private module Impl { } private Element getImmediateChildOfFormat(Format e, int index, string partialPredicateCall) { - exists(int b, int bLocatable, int n | + exists(int b, int bLocatable, int n, int nArgument | b = 0 and bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and n = bLocatable and + nArgument = n + 1 and ( none() or result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall) + or + index = n and result = e.getArgument() and partialPredicateCall = "Argument()" ) ) } @@ -67,14 +70,17 @@ private module Impl { private Element getImmediateChildOfFormatArgument( FormatArgument e, int index, string partialPredicateCall ) { - exists(int b, int bLocatable, int n | + exists(int b, int bLocatable, int n, int nVariable | b = 0 and bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and n = bLocatable and + nVariable = n + 1 and ( none() or result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall) + or + index = n and result = e.getVariable() and partialPredicateCall = "Variable()" ) ) } @@ -1761,13 +1767,14 @@ private module Impl { private Element getImmediateChildOfFormatArgsExpr( FormatArgsExpr e, int index, string partialPredicateCall ) { - exists(int b, int bExpr, int n, int nArg, int nAttr, int nTemplate | + exists(int b, int bExpr, int n, int nArg, int nAttr, int nTemplate, int nFormat | b = 0 and bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and n = bExpr and nArg = n + 1 + max(int i | i = -1 or exists(e.getArg(i)) | i) and nAttr = nArg + 1 + max(int i | i = -1 or exists(e.getAttr(i)) | i) and nTemplate = nAttr + 1 and + nFormat = nTemplate + 1 + max(int i | i = -1 or exists(e.getFormat(i)) | i) and ( none() or @@ -1780,6 +1787,9 @@ private module Impl { partialPredicateCall = "Attr(" + (index - nArg).toString() + ")" or index = nAttr and result = e.getTemplate() and partialPredicateCall = "Template()" + or + result = e.getFormat(index - nTemplate) and + partialPredicateCall = "Format(" + (index - nTemplate).toString() + ")" ) ) } diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/Raw.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/Raw.qll index 25af8ddac64..efcdd4818dc 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/generated/Raw.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/generated/Raw.qll @@ -1885,7 +1885,11 @@ module Raw { * INTERNAL: Do not use. * A FormatArgsExpr. For example: * ```rust - * todo!() + * format_args!("no args"); + * format_args!("{} foo {:?}", 1, 2); + * format_args!("{b} foo {a:?}", a=1, b=2); + * let (x, y) = (1, 42); + * format_args!("{x}, {y}"); * ``` */ class FormatArgsExpr extends @format_args_expr, Expr { diff --git a/rust/ql/test/extractor-tests/generated/.generated_tests.list b/rust/ql/test/extractor-tests/generated/.generated_tests.list index b60779ebd86..bfbe339bcc8 100644 --- a/rust/ql/test/extractor-tests/generated/.generated_tests.list +++ b/rust/ql/test/extractor-tests/generated/.generated_tests.list @@ -31,8 +31,10 @@ FieldExpr/gen_field_expr.rs 9a70500d592e0a071b03d974a55558b3bc0df531ff11bce5898f FnPtrType/gen_fn_ptr_type.rs a7842d8c21636739d1be959e5ce5e0b23482d5ef6eab5c45b009895da8175932 a7842d8c21636739d1be959e5ce5e0b23482d5ef6eab5c45b009895da8175932 ForExpr/gen_for_expr.rs 67decf3073e1a9363d9df05a5a64a6059349e50b81356f480f7aeb352189136d 67decf3073e1a9363d9df05a5a64a6059349e50b81356f480f7aeb352189136d ForType/gen_for_type.rs 6cb447df02c61b192e283e019576c28225added02d167030d64ebd0bebb1b158 6cb447df02c61b192e283e019576c28225added02d167030d64ebd0bebb1b158 -FormatArgsArg/gen_format_args_arg.rs c466f2fc2c0f9592061a159a217a87551d67f1ccb0e4d8f7f56a463a2aa4a73a c466f2fc2c0f9592061a159a217a87551d67f1ccb0e4d8f7f56a463a2aa4a73a -FormatArgsExpr/gen_format_args_expr.rs 7184dbb8833f970676e59fca3a40ec51d14a68e3151d8a6d637896494f2b4454 7184dbb8833f970676e59fca3a40ec51d14a68e3151d8a6d637896494f2b4454 +FormatArgsExpr/gen_format.rs bd009cb152c35e2aacd147b5520a42be31e66e9a8715ec1d0fd57b8e97c743ed bd009cb152c35e2aacd147b5520a42be31e66e9a8715ec1d0fd57b8e97c743ed +FormatArgsExpr/gen_format_args_arg.rs c466f2fc2c0f9592061a159a217a87551d67f1ccb0e4d8f7f56a463a2aa4a73a c466f2fc2c0f9592061a159a217a87551d67f1ccb0e4d8f7f56a463a2aa4a73a +FormatArgsExpr/gen_format_args_expr.rs 72c806ed163e9dcce2d0c5c8664d409b2aa635c1022c91959f9e8ae084f05bf2 72c806ed163e9dcce2d0c5c8664d409b2aa635c1022c91959f9e8ae084f05bf2 +FormatArgsExpr/gen_format_argument.rs 350d370e6f1db03d756384a3dbdb294697d241ff7c28d159cf57748abe99cfe9 350d370e6f1db03d756384a3dbdb294697d241ff7c28d159cf57748abe99cfe9 Function/gen_function.rs ba6ecb9e0d89183295eb02f3c20ebbf5c209f89bd0172c73a3b4a6dacbf3a54c ba6ecb9e0d89183295eb02f3c20ebbf5c209f89bd0172c73a3b4a6dacbf3a54c GenericArgList/gen_generic_arg_list.rs cfb072d3b48f9dd568c23d4dfefba28766628678f66bbf9a436de9919ead35f5 cfb072d3b48f9dd568c23d4dfefba28766628678f66bbf9a436de9919ead35f5 GenericParamList/gen_generic_param_list.rs 4cc9b628f53e1a6c5781ad195b8648fa6dee0bb41b24007fbd986527374d3669 4cc9b628f53e1a6c5781ad195b8648fa6dee0bb41b24007fbd986527374d3669 diff --git a/rust/ql/test/extractor-tests/generated/.gitattributes b/rust/ql/test/extractor-tests/generated/.gitattributes index 8ea3a00a31f..df5c0c5b60c 100644 --- a/rust/ql/test/extractor-tests/generated/.gitattributes +++ b/rust/ql/test/extractor-tests/generated/.gitattributes @@ -33,8 +33,10 @@ /FnPtrType/gen_fn_ptr_type.rs linguist-generated /ForExpr/gen_for_expr.rs linguist-generated /ForType/gen_for_type.rs linguist-generated -/FormatArgsArg/gen_format_args_arg.rs linguist-generated +/FormatArgsExpr/gen_format.rs linguist-generated +/FormatArgsExpr/gen_format_args_arg.rs linguist-generated /FormatArgsExpr/gen_format_args_expr.rs linguist-generated +/FormatArgsExpr/gen_format_argument.rs linguist-generated /Function/gen_function.rs linguist-generated /GenericArgList/gen_generic_arg_list.rs linguist-generated /GenericParamList/gen_generic_param_list.rs linguist-generated diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/Format.expected b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/Format.expected new file mode 100644 index 00000000000..312f5a3b071 --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/Format.expected @@ -0,0 +1,9 @@ +| gen_format.rs:5:21:5:22 | {} | getParent: | gen_format.rs:5:14:5:32 | FormatArgsExpr | getIndex: | 1 | hasArgument: | no | +| gen_format_args_expr.rs:6:19:6:20 | {} | getParent: | gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | getIndex: | 1 | hasArgument: | no | +| gen_format_args_expr.rs:6:26:6:29 | {:?} | getParent: | gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | getIndex: | 3 | hasArgument: | no | +| gen_format_args_expr.rs:7:19:7:21 | {b} | getParent: | gen_format_args_expr.rs:7:17:7:43 | FormatArgsExpr | getIndex: | 1 | hasArgument: | yes | +| gen_format_args_expr.rs:7:27:7:31 | {a:?} | getParent: | gen_format_args_expr.rs:7:17:7:43 | FormatArgsExpr | getIndex: | 3 | hasArgument: | yes | +| gen_format_args_expr.rs:9:19:9:21 | {x} | getParent: | gen_format_args_expr.rs:9:17:9:28 | FormatArgsExpr | getIndex: | 1 | hasArgument: | yes | +| gen_format_args_expr.rs:9:24:9:26 | {y} | getParent: | gen_format_args_expr.rs:9:17:9:28 | FormatArgsExpr | getIndex: | 3 | hasArgument: | yes | +| gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | getParent: | gen_format_argument.rs:5:14:5:47 | FormatArgsExpr | getIndex: | 1 | hasArgument: | yes | +| gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | getParent: | gen_format_argument.rs:7:14:7:56 | FormatArgsExpr | getIndex: | 1 | hasArgument: | yes | diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/Format.ql b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/Format.ql new file mode 100644 index 00000000000..fa17b4294f7 --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/Format.ql @@ -0,0 +1,12 @@ +// generated by codegen, do not edit +import codeql.rust.elements +import TestUtils + +from Format x, FormatArgsExpr getParent, int getIndex, string hasArgument +where + toBeTested(x) and + not x.isUnknown() and + getParent = x.getParent() and + getIndex = x.getIndex() and + if x.hasArgument() then hasArgument = "yes" else hasArgument = "no" +select x, "getParent:", getParent, "getIndex:", getIndex, "hasArgument:", hasArgument diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg.expected b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg.expected new file mode 100644 index 00000000000..8e704471e02 --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg.expected @@ -0,0 +1,8 @@ +| gen_format.rs:5:26:5:32 | FormatArgsArg | hasExpr: | yes | hasName: | no | +| gen_format_args_expr.rs:6:33:6:33 | FormatArgsArg | hasExpr: | yes | hasName: | no | +| gen_format_args_expr.rs:6:36:6:36 | FormatArgsArg | hasExpr: | yes | hasName: | no | +| gen_format_args_expr.rs:7:35:7:37 | FormatArgsArg | hasExpr: | yes | hasName: | yes | +| gen_format_args_expr.rs:7:40:7:42 | FormatArgsArg | hasExpr: | yes | hasName: | yes | +| gen_format_argument.rs:7:34:7:38 | FormatArgsArg | hasExpr: | yes | hasName: | no | +| gen_format_argument.rs:7:41:7:45 | FormatArgsArg | hasExpr: | yes | hasName: | no | +| gen_format_argument.rs:7:48:7:56 | FormatArgsArg | hasExpr: | yes | hasName: | no | diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsArg/FormatArgsArg.ql b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg.ql similarity index 100% rename from rust/ql/test/extractor-tests/generated/FormatArgsArg/FormatArgsArg.ql rename to rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg.ql diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg_getExpr.expected b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg_getExpr.expected new file mode 100644 index 00000000000..90cf2cae221 --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg_getExpr.expected @@ -0,0 +1,8 @@ +| gen_format.rs:5:26:5:32 | FormatArgsArg | gen_format.rs:5:26:5:32 | "world" | +| gen_format_args_expr.rs:6:33:6:33 | FormatArgsArg | gen_format_args_expr.rs:6:33:6:33 | 1 | +| gen_format_args_expr.rs:6:36:6:36 | FormatArgsArg | gen_format_args_expr.rs:6:36:6:36 | 2 | +| gen_format_args_expr.rs:7:35:7:37 | FormatArgsArg | gen_format_args_expr.rs:7:37:7:37 | 1 | +| gen_format_args_expr.rs:7:40:7:42 | FormatArgsArg | gen_format_args_expr.rs:7:42:7:42 | 2 | +| gen_format_argument.rs:7:34:7:38 | FormatArgsArg | gen_format_argument.rs:7:34:7:38 | value | +| gen_format_argument.rs:7:41:7:45 | FormatArgsArg | gen_format_argument.rs:7:41:7:45 | width | +| gen_format_argument.rs:7:48:7:56 | FormatArgsArg | gen_format_argument.rs:7:48:7:56 | precision | diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsArg/FormatArgsArg_getExpr.ql b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg_getExpr.ql similarity index 100% rename from rust/ql/test/extractor-tests/generated/FormatArgsArg/FormatArgsArg_getExpr.ql rename to rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg_getExpr.ql diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg_getName.expected b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg_getName.expected new file mode 100644 index 00000000000..ad5d7ab4ab2 --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg_getName.expected @@ -0,0 +1,2 @@ +| gen_format_args_expr.rs:7:35:7:37 | FormatArgsArg | gen_format_args_expr.rs:7:35:7:35 | a | +| gen_format_args_expr.rs:7:40:7:42 | FormatArgsArg | gen_format_args_expr.rs:7:40:7:40 | b | diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsArg/FormatArgsArg_getName.ql b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg_getName.ql similarity index 100% rename from rust/ql/test/extractor-tests/generated/FormatArgsArg/FormatArgsArg_getName.ql rename to rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsArg_getName.ql diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr.expected b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr.expected index e69de29bb2d..bed19ed26d4 100644 --- a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr.expected +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr.expected @@ -0,0 +1,7 @@ +| gen_format.rs:5:14:5:32 | FormatArgsExpr | getNumberOfArgs: | 1 | getNumberOfAttrs: | 0 | hasTemplate: | yes | getNumberOfFormats: | 1 | +| gen_format_args_expr.rs:5:17:5:27 | FormatArgsExpr | getNumberOfArgs: | 0 | getNumberOfAttrs: | 0 | hasTemplate: | yes | getNumberOfFormats: | 0 | +| gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | getNumberOfArgs: | 2 | getNumberOfAttrs: | 0 | hasTemplate: | yes | getNumberOfFormats: | 2 | +| gen_format_args_expr.rs:7:17:7:43 | FormatArgsExpr | getNumberOfArgs: | 2 | getNumberOfAttrs: | 0 | hasTemplate: | yes | getNumberOfFormats: | 2 | +| gen_format_args_expr.rs:9:17:9:28 | FormatArgsExpr | getNumberOfArgs: | 0 | getNumberOfAttrs: | 0 | hasTemplate: | yes | getNumberOfFormats: | 2 | +| gen_format_argument.rs:5:14:5:47 | FormatArgsExpr | getNumberOfArgs: | 0 | getNumberOfAttrs: | 0 | hasTemplate: | yes | getNumberOfFormats: | 1 | +| gen_format_argument.rs:7:14:7:56 | FormatArgsExpr | getNumberOfArgs: | 3 | getNumberOfAttrs: | 0 | hasTemplate: | yes | getNumberOfFormats: | 1 | diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr.ql b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr.ql index 4d5bcf05173..6a43bc1ea0a 100644 --- a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr.ql +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr.ql @@ -2,12 +2,15 @@ import codeql.rust.elements import TestUtils -from FormatArgsExpr x, int getNumberOfArgs, int getNumberOfAttrs, string hasTemplate +from + FormatArgsExpr x, int getNumberOfArgs, int getNumberOfAttrs, string hasTemplate, + int getNumberOfFormats where toBeTested(x) and not x.isUnknown() and getNumberOfArgs = x.getNumberOfArgs() and getNumberOfAttrs = x.getNumberOfAttrs() and - if x.hasTemplate() then hasTemplate = "yes" else hasTemplate = "no" + (if x.hasTemplate() then hasTemplate = "yes" else hasTemplate = "no") and + getNumberOfFormats = x.getNumberOfFormats() select x, "getNumberOfArgs:", getNumberOfArgs, "getNumberOfAttrs:", getNumberOfAttrs, - "hasTemplate:", hasTemplate + "hasTemplate:", hasTemplate, "getNumberOfFormats:", getNumberOfFormats diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getArg.expected b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getArg.expected index e69de29bb2d..89fce13908f 100644 --- a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getArg.expected +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getArg.expected @@ -0,0 +1,8 @@ +| gen_format.rs:5:14:5:32 | FormatArgsExpr | 0 | gen_format.rs:5:26:5:32 | FormatArgsArg | +| gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | 0 | gen_format_args_expr.rs:6:33:6:33 | FormatArgsArg | +| gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | 1 | gen_format_args_expr.rs:6:36:6:36 | FormatArgsArg | +| gen_format_args_expr.rs:7:17:7:43 | FormatArgsExpr | 0 | gen_format_args_expr.rs:7:35:7:37 | FormatArgsArg | +| gen_format_args_expr.rs:7:17:7:43 | FormatArgsExpr | 1 | gen_format_args_expr.rs:7:40:7:42 | FormatArgsArg | +| gen_format_argument.rs:7:14:7:56 | FormatArgsExpr | 0 | gen_format_argument.rs:7:34:7:38 | FormatArgsArg | +| gen_format_argument.rs:7:14:7:56 | FormatArgsExpr | 1 | gen_format_argument.rs:7:41:7:45 | FormatArgsArg | +| gen_format_argument.rs:7:14:7:56 | FormatArgsExpr | 2 | gen_format_argument.rs:7:48:7:56 | FormatArgsArg | diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getFormat.expected b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getFormat.expected new file mode 100644 index 00000000000..acbe782a35d --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getFormat.expected @@ -0,0 +1,9 @@ +| gen_format.rs:5:14:5:32 | FormatArgsExpr | 0 | gen_format.rs:5:21:5:22 | {} | +| gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | 0 | gen_format_args_expr.rs:6:19:6:20 | {} | +| gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | 2 | gen_format_args_expr.rs:6:26:6:29 | {:?} | +| gen_format_args_expr.rs:7:17:7:43 | FormatArgsExpr | 0 | gen_format_args_expr.rs:7:19:7:21 | {b} | +| gen_format_args_expr.rs:7:17:7:43 | FormatArgsExpr | 2 | gen_format_args_expr.rs:7:27:7:31 | {a:?} | +| gen_format_args_expr.rs:9:17:9:28 | FormatArgsExpr | 0 | gen_format_args_expr.rs:9:19:9:21 | {x} | +| gen_format_args_expr.rs:9:17:9:28 | FormatArgsExpr | 2 | gen_format_args_expr.rs:9:24:9:26 | {y} | +| gen_format_argument.rs:5:14:5:47 | FormatArgsExpr | 0 | gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | +| gen_format_argument.rs:7:14:7:56 | FormatArgsExpr | 0 | gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getFormat.ql b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getFormat.ql new file mode 100644 index 00000000000..ca61ca2bebd --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getFormat.ql @@ -0,0 +1,7 @@ +// generated by codegen, do not edit +import codeql.rust.elements +import TestUtils + +from FormatArgsExpr x, int index +where toBeTested(x) and not x.isUnknown() +select x, index, x.getFormat(index) diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getTemplate.expected b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getTemplate.expected index e69de29bb2d..6c4f7030810 100644 --- a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getTemplate.expected +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getTemplate.expected @@ -0,0 +1,7 @@ +| gen_format.rs:5:14:5:32 | FormatArgsExpr | gen_format.rs:5:14:5:23 | "Hello {}\\n" | +| gen_format_args_expr.rs:5:17:5:27 | FormatArgsExpr | gen_format_args_expr.rs:5:18:5:26 | "no args" | +| gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | gen_format_args_expr.rs:6:18:6:30 | "{} foo {:?}" | +| gen_format_args_expr.rs:7:17:7:43 | FormatArgsExpr | gen_format_args_expr.rs:7:18:7:32 | "{b} foo {a:?}" | +| gen_format_args_expr.rs:9:17:9:28 | FormatArgsExpr | gen_format_args_expr.rs:9:18:9:27 | "{x}, {y}" | +| gen_format_argument.rs:5:14:5:47 | FormatArgsExpr | gen_format_argument.rs:5:14:5:47 | "Value {value:#width$.precision$}\\n" | +| gen_format_argument.rs:7:14:7:56 | FormatArgsExpr | gen_format_argument.rs:7:14:7:31 | "Value {0:#1$.2$}\\n" | diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getVariable.expected b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getVariable.expected new file mode 100644 index 00000000000..dca240710f7 --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getVariable.expected @@ -0,0 +1,5 @@ +| gen_format_args_expr.rs:9:17:9:28 | FormatArgsExpr | 1 | gen_format_args_expr.rs:9:20:9:20 | x | +| gen_format_args_expr.rs:9:17:9:28 | FormatArgsExpr | 3 | gen_format_args_expr.rs:9:25:9:25 | y | +| gen_format_argument.rs:5:14:5:47 | FormatArgsExpr | 1 | gen_format_argument.rs:5:22:5:26 | value | +| gen_format_argument.rs:5:14:5:47 | FormatArgsExpr | 1 | gen_format_argument.rs:5:29:5:33 | width | +| gen_format_argument.rs:5:14:5:47 | FormatArgsExpr | 1 | gen_format_argument.rs:5:36:5:44 | precision | diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgument.expected b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgument.expected new file mode 100644 index 00000000000..e63b4b6558f --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgument.expected @@ -0,0 +1,10 @@ +| gen_format_args_expr.rs:7:20:7:20 | b | getParent: | gen_format_args_expr.rs:7:19:7:21 | {b} | hasVariable: | no | +| gen_format_args_expr.rs:7:28:7:28 | a | getParent: | gen_format_args_expr.rs:7:27:7:31 | {a:?} | hasVariable: | no | +| gen_format_args_expr.rs:9:20:9:20 | x | getParent: | gen_format_args_expr.rs:9:19:9:21 | {x} | hasVariable: | yes | +| gen_format_args_expr.rs:9:25:9:25 | y | getParent: | gen_format_args_expr.rs:9:24:9:26 | {y} | hasVariable: | yes | +| gen_format_argument.rs:5:22:5:26 | value | getParent: | gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | hasVariable: | yes | +| gen_format_argument.rs:5:29:5:33 | width | getParent: | gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | hasVariable: | yes | +| gen_format_argument.rs:5:36:5:44 | precision | getParent: | gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | hasVariable: | yes | +| gen_format_argument.rs:7:22:7:22 | 0 | getParent: | gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | hasVariable: | no | +| gen_format_argument.rs:7:25:7:25 | 1 | getParent: | gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | hasVariable: | no | +| gen_format_argument.rs:7:28:7:28 | 2 | getParent: | gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | hasVariable: | no | diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgument.ql b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgument.ql new file mode 100644 index 00000000000..ed57154f7e8 --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgument.ql @@ -0,0 +1,11 @@ +// generated by codegen, do not edit +import codeql.rust.elements +import TestUtils + +from FormatArgument x, Format getParent, string hasVariable +where + toBeTested(x) and + not x.isUnknown() and + getParent = x.getParent() and + if x.hasVariable() then hasVariable = "yes" else hasVariable = "no" +select x, "getParent:", getParent, "hasVariable:", hasVariable diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgument_getVariable.expected b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgument_getVariable.expected new file mode 100644 index 00000000000..11db93ec06d --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgument_getVariable.expected @@ -0,0 +1,5 @@ +| gen_format_args_expr.rs:9:20:9:20 | x | gen_format_args_expr.rs:9:20:9:20 | x | +| gen_format_args_expr.rs:9:25:9:25 | y | gen_format_args_expr.rs:9:25:9:25 | y | +| gen_format_argument.rs:5:22:5:26 | value | gen_format_argument.rs:5:22:5:26 | value | +| gen_format_argument.rs:5:29:5:33 | width | gen_format_argument.rs:5:29:5:33 | width | +| gen_format_argument.rs:5:36:5:44 | precision | gen_format_argument.rs:5:36:5:44 | precision | diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgument_getVariable.ql b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgument_getVariable.ql new file mode 100644 index 00000000000..5d303bc4b6c --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgument_getVariable.ql @@ -0,0 +1,7 @@ +// generated by codegen, do not edit +import codeql.rust.elements +import TestUtils + +from FormatArgument x +where toBeTested(x) and not x.isUnknown() +select x, x.getVariable() diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess.expected b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess.expected new file mode 100644 index 00000000000..df4fdad5c91 --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess.expected @@ -0,0 +1,5 @@ +| gen_format_args_expr.rs:9:20:9:20 | x | +| gen_format_args_expr.rs:9:25:9:25 | y | +| gen_format_argument.rs:5:22:5:26 | value | +| gen_format_argument.rs:5:29:5:33 | width | +| gen_format_argument.rs:5:36:5:44 | precision | diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess.ql b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess.ql new file mode 100644 index 00000000000..4f43ca11870 --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess.ql @@ -0,0 +1,7 @@ +// generated by codegen, do not edit +import codeql.rust.elements +import TestUtils + +from FormatTemplateVariableAccess x +where toBeTested(x) and not x.isUnknown() +select x diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/Format_getArgument.expected b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/Format_getArgument.expected new file mode 100644 index 00000000000..af9dd77578c --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/Format_getArgument.expected @@ -0,0 +1,10 @@ +| gen_format_args_expr.rs:7:19:7:21 | {b} | gen_format_args_expr.rs:7:20:7:20 | b | +| gen_format_args_expr.rs:7:27:7:31 | {a:?} | gen_format_args_expr.rs:7:28:7:28 | a | +| gen_format_args_expr.rs:9:19:9:21 | {x} | gen_format_args_expr.rs:9:20:9:20 | x | +| gen_format_args_expr.rs:9:24:9:26 | {y} | gen_format_args_expr.rs:9:25:9:25 | y | +| gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | gen_format_argument.rs:5:22:5:26 | value | +| gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | gen_format_argument.rs:5:29:5:33 | width | +| gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | gen_format_argument.rs:5:36:5:44 | precision | +| gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | gen_format_argument.rs:7:22:7:22 | 0 | +| gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | gen_format_argument.rs:7:25:7:25 | 1 | +| gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | gen_format_argument.rs:7:28:7:28 | 2 | diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/Format_getArgument.ql b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/Format_getArgument.ql new file mode 100644 index 00000000000..e131365770b --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/Format_getArgument.ql @@ -0,0 +1,7 @@ +// generated by codegen, do not edit +import codeql.rust.elements +import TestUtils + +from Format x +where toBeTested(x) and not x.isUnknown() +select x, x.getArgument() diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/gen_format.rs b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/gen_format.rs new file mode 100644 index 00000000000..86b78256d40 --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/gen_format.rs @@ -0,0 +1,6 @@ +// generated by codegen, do not edit + +fn test_format() -> () { + // A format element in a formatting template. For example the `{}` in: + println!("Hello {}", "world"); +} diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsArg/gen_format_args_arg.rs b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/gen_format_args_arg.rs similarity index 100% rename from rust/ql/test/extractor-tests/generated/FormatArgsArg/gen_format_args_arg.rs rename to rust/ql/test/extractor-tests/generated/FormatArgsExpr/gen_format_args_arg.rs diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/gen_format_args_expr.rs b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/gen_format_args_expr.rs index 7345a633ba5..3c2acb387fc 100644 --- a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/gen_format_args_expr.rs +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/gen_format_args_expr.rs @@ -2,5 +2,9 @@ fn test_format_args_expr() -> () { // A FormatArgsExpr. For example: - todo!() + format_args!("no args"); + format_args!("{} foo {:?}", 1, 2); + format_args!("{b} foo {a:?}", a=1, b=2); + let (x, y) = (1, 42); + format_args!("{x}, {y}"); } diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/gen_format_argument.rs b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/gen_format_argument.rs new file mode 100644 index 00000000000..32cb123f51d --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/gen_format_argument.rs @@ -0,0 +1,8 @@ +// generated by codegen, do not edit + +fn test_format_argument() -> () { + // An argument in a format element in a formatting template. For example the `width`, `precision`, and `value` in: + println!("Value {value:#width$.precision$}"); + // or the `0`, `1` and `2` in: + println!("Value {0:#1$.2$}", value, width, precision); +} diff --git a/rust/schema/annotations.py b/rust/schema/annotations.py index ae94b0604e7..60f67a710d8 100644 --- a/rust/schema/annotations.py +++ b/rust/schema/annotations.py @@ -1011,6 +1011,7 @@ class _: @annotate(FormatArgsArg) +@qltest.test_with(FormatArgsExpr) class _: """ A FormatArgsArg. For example: @@ -1025,9 +1026,14 @@ class _: """ A FormatArgsExpr. For example: ```rust - todo!() + format_args!("no args"); + format_args!("{} foo {:?}", 1, 2); + format_args!("{b} foo {a:?}", a=1, b=2); + let (x, y) = (1, 42); + format_args!("{x}, {y}"); ``` """ + formats: list["Format"] | child | synth @annotate(GenericArg) @@ -1766,14 +1772,15 @@ class _: attrs: drop -@qltest.skip @synth.on_arguments(parent="FormatArgsExpr", index=int, kind=int) +@qltest.test_with(FormatArgsExpr) class FormatTemplateVariableAccess(PathExprBase): pass -@qltest.skip @synth.on_arguments(parent=FormatArgsExpr, index=int, text=string, offset=int) +@qltest.test_with(FormatArgsExpr) + class Format(Locatable): """ A format element in a formatting template. For example the `{}` in: @@ -1783,10 +1790,11 @@ class Format(Locatable): """ parent: FormatArgsExpr index: int + argument: optional["FormatArgument"] | child -@qltest.skip @synth.on_arguments(parent=FormatArgsExpr, index=int, kind=int, name=string, positional=boolean, offset=int) +@qltest.test_with(FormatArgsExpr) class FormatArgument(Locatable): """ An argument in a format element in a formatting template. For example the `width`, `precision`, and `value` in: @@ -1799,6 +1807,7 @@ class FormatArgument(Locatable): ``` """ parent: Format + variable: optional[FormatTemplateVariableAccess] | child @annotate(Item) class _: From 9a07b3c3d4d76e618c0bee5f363778285ef2984e Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Fri, 22 Nov 2024 12:24:44 +0100 Subject: [PATCH 44/47] Rust: remove obsolete expected files --- .../generated/FormatArgsArg/FormatArgsArg.expected | 0 .../generated/FormatArgsArg/FormatArgsArg_getExpr.expected | 0 .../generated/FormatArgsArg/FormatArgsArg_getName.expected | 0 3 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsArg/FormatArgsArg.expected delete mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsArg/FormatArgsArg_getExpr.expected delete mode 100644 rust/ql/test/extractor-tests/generated/FormatArgsArg/FormatArgsArg_getName.expected diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsArg/FormatArgsArg.expected b/rust/ql/test/extractor-tests/generated/FormatArgsArg/FormatArgsArg.expected deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsArg/FormatArgsArg_getExpr.expected b/rust/ql/test/extractor-tests/generated/FormatArgsArg/FormatArgsArg_getExpr.expected deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsArg/FormatArgsArg_getName.expected b/rust/ql/test/extractor-tests/generated/FormatArgsArg/FormatArgsArg_getName.expected deleted file mode 100644 index e69de29bb2d..00000000000 From 169671ad937023b7aa0fee226335ba65eb4c0e3b Mon Sep 17 00:00:00 2001 From: Calum Grant <42069085+calumgrant@users.noreply.github.com> Date: Fri, 22 Nov 2024 11:42:39 +0000 Subject: [PATCH 45/47] Revert "C++: Implement compilation_build_mode" --- .../old.dbscheme | 2339 --------------- .../semmlecode.cpp.dbscheme | 2323 --------------- .../upgrade.properties | 3 - cpp/ql/lib/semmle/code/cpp/Compilation.qll | 3 - cpp/ql/lib/semmlecode.cpp.dbscheme | 16 - cpp/ql/lib/semmlecode.cpp.dbscheme.stats | 2639 ++++++++--------- .../old.dbscheme | 2323 --------------- .../semmlecode.cpp.dbscheme | 2339 --------------- .../upgrade.properties | 2 - 9 files changed, 1288 insertions(+), 10699 deletions(-) delete mode 100644 cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/old.dbscheme delete mode 100644 cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/semmlecode.cpp.dbscheme delete mode 100644 cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties delete mode 100644 cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/old.dbscheme delete mode 100644 cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/semmlecode.cpp.dbscheme delete mode 100644 cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/upgrade.properties diff --git a/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/old.dbscheme b/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/old.dbscheme deleted file mode 100644 index f0156f5f88a..00000000000 --- a/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/old.dbscheme +++ /dev/null @@ -1,2339 +0,0 @@ - -/** - * An invocation of the compiler. Note that more than one file may be - * compiled per invocation. For example, this command compiles three - * source files: - * - * gcc -c f1.c f2.c f3.c - * - * The `id` simply identifies the invocation, while `cwd` is the working - * directory from which the compiler was invoked. - */ -compilations( - /** - * An invocation of the compiler. Note that more than one file may - * be compiled per invocation. For example, this command compiles - * three source files: - * - * gcc -c f1.c f2.c f3.c - */ - unique int id : @compilation, - string cwd : string ref -); - -/** - * The arguments that were passed to the extractor for a compiler - * invocation. If `id` is for the compiler invocation - * - * gcc -c f1.c f2.c f3.c - * - * then typically there will be rows for - * - * num | arg - * --- | --- - * 0 | *path to extractor* - * 1 | `--mimic` - * 2 | `/usr/bin/gcc` - * 3 | `-c` - * 4 | f1.c - * 5 | f2.c - * 6 | f3.c - */ -#keyset[id, num] -compilation_args( - int id : @compilation ref, - int num : int ref, - string arg : string ref -); - -/** - * Optionally, record the build mode for each compilation. - */ -compilation_build_mode( - unique int id : @compilation ref, - int mode : int ref -); - -/* -case @compilation_build_mode.mode of - 0 = @build_mode_none -| 1 = @build_mode_manual -| 2 = @build_mode_auto -; -*/ - -/** - * The source files that are compiled by a compiler invocation. - * If `id` is for the compiler invocation - * - * gcc -c f1.c f2.c f3.c - * - * then there will be rows for - * - * num | arg - * --- | --- - * 0 | f1.c - * 1 | f2.c - * 2 | f3.c - * - * Note that even if those files `#include` headers, those headers - * do not appear as rows. - */ -#keyset[id, num] -compilation_compiling_files( - int id : @compilation ref, - int num : int ref, - int file : @file ref -); - -/** - * The time taken by the extractor for a compiler invocation. - * - * For each file `num`, there will be rows for - * - * kind | seconds - * ---- | --- - * 1 | CPU seconds used by the extractor frontend - * 2 | Elapsed seconds during the extractor frontend - * 3 | CPU seconds used by the extractor backend - * 4 | Elapsed seconds during the extractor backend - */ -#keyset[id, num, kind] -compilation_time( - int id : @compilation ref, - int num : int ref, - /* kind: - 1 = frontend_cpu_seconds - 2 = frontend_elapsed_seconds - 3 = extractor_cpu_seconds - 4 = extractor_elapsed_seconds - */ - int kind : int ref, - float seconds : float ref -); - -/** - * An error or warning generated by the extractor. - * The diagnostic message `diagnostic` was generated during compiler - * invocation `compilation`, and is the `file_number_diagnostic_number`th - * message generated while extracting the `file_number`th file of that - * invocation. - */ -#keyset[compilation, file_number, file_number_diagnostic_number] -diagnostic_for( - int diagnostic : @diagnostic ref, - int compilation : @compilation ref, - int file_number : int ref, - int file_number_diagnostic_number : int ref -); - -/** - * If extraction was successful, then `cpu_seconds` and - * `elapsed_seconds` are the CPU time and elapsed time (respectively) - * that extraction took for compiler invocation `id`. - */ -compilation_finished( - unique int id : @compilation ref, - float cpu_seconds : float ref, - float elapsed_seconds : float ref -); - - -/** - * External data, loaded from CSV files during snapshot creation. See - * [Tutorial: Incorporating external data](https://help.semmle.com/wiki/display/SD/Tutorial%3A+Incorporating+external+data) - * for more information. - */ -externalData( - int id : @externalDataElement, - string path : string ref, - int column: int ref, - string value : string ref -); - -/** - * The source location of the snapshot. - */ -sourceLocationPrefix(string prefix : string ref); - -/** - * Information about packages that provide code used during compilation. - * The `id` is just a unique identifier. - * The `namespace` is typically the name of the package manager that - * provided the package (e.g. "dpkg" or "yum"). - * The `package_name` is the name of the package, and `version` is its - * version (as a string). - */ -external_packages( - unique int id: @external_package, - string namespace : string ref, - string package_name : string ref, - string version : string ref -); - -/** - * Holds if File `fileid` was provided by package `package`. - */ -header_to_external_package( - int fileid : @file ref, - int package : @external_package ref -); - -/* - * Version history - */ - -svnentries( - unique int id : @svnentry, - string revision : string ref, - string author : string ref, - date revisionDate : date ref, - int changeSize : int ref -) - -svnaffectedfiles( - int id : @svnentry ref, - int file : @file ref, - string action : string ref -) - -svnentrymsg( - unique int id : @svnentry ref, - string message : string ref -) - -svnchurn( - int commit : @svnentry ref, - int file : @file ref, - int addedLines : int ref, - int deletedLines : int ref -) - -/* - * C++ dbscheme - */ - -extractor_version( - string codeql_version: string ref, - string frontend_version: string ref -) - -@location = @location_stmt | @location_expr | @location_default ; - -/** - * The location of an element that is not an expression or a statement. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `file`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ -locations_default( - /** The location of an element that is not an expression or a statement. */ - unique int id: @location_default, - int container: @container ref, - int startLine: int ref, - int startColumn: int ref, - int endLine: int ref, - int endColumn: int ref -); - -/** - * The location of a statement. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `file`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ -locations_stmt( - /** The location of a statement. */ - unique int id: @location_stmt, - int container: @container ref, - int startLine: int ref, - int startColumn: int ref, - int endLine: int ref, - int endColumn: int ref -); - -/** - * The location of an expression. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `file`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ -locations_expr( - /** The location of an expression. */ - unique int id: @location_expr, - int container: @container ref, - int startLine: int ref, - int startColumn: int ref, - int endLine: int ref, - int endColumn: int ref -); - -/** An element for which line-count information is available. */ -@sourceline = @file | @function | @variable | @enumconstant | @xmllocatable; - -numlines( - int element_id: @sourceline ref, - int num_lines: int ref, - int num_code: int ref, - int num_comment: int ref -); - -diagnostics( - unique int id: @diagnostic, - int severity: int ref, - string error_tag: string ref, - string error_message: string ref, - string full_error_message: string ref, - int location: @location_default ref -); - -files( - unique int id: @file, - string name: string ref -); - -folders( - unique int id: @folder, - string name: string ref -); - -@container = @folder | @file - -containerparent( - int parent: @container ref, - unique int child: @container ref -); - -fileannotations( - int id: @file ref, - int kind: int ref, - string name: string ref, - string value: string ref -); - -inmacroexpansion( - int id: @element ref, - int inv: @macroinvocation ref -); - -affectedbymacroexpansion( - int id: @element ref, - int inv: @macroinvocation ref -); - -case @macroinvocation.kind of - 1 = @macro_expansion -| 2 = @other_macro_reference -; - -macroinvocations( - unique int id: @macroinvocation, - int macro_id: @ppd_define ref, - int location: @location_default ref, - int kind: int ref -); - -macroparent( - unique int id: @macroinvocation ref, - int parent_id: @macroinvocation ref -); - -// a macroinvocation may be part of another location -// the way to find a constant expression that uses a macro -// is thus to find a constant expression that has a location -// to which a macro invocation is bound -macrolocationbind( - int id: @macroinvocation ref, - int location: @location ref -); - -#keyset[invocation, argument_index] -macro_argument_unexpanded( - int invocation: @macroinvocation ref, - int argument_index: int ref, - string text: string ref -); - -#keyset[invocation, argument_index] -macro_argument_expanded( - int invocation: @macroinvocation ref, - int argument_index: int ref, - string text: string ref -); - -/* -case @function.kind of - 1 = @normal_function -| 2 = @constructor -| 3 = @destructor -| 4 = @conversion_function -| 5 = @operator -| 6 = @builtin_function // GCC built-in functions, e.g. __builtin___memcpy_chk -| 7 = @user_defined_literal -| 8 = @deduction_guide -; -*/ - -functions( - unique int id: @function, - string name: string ref, - int kind: int ref -); - -function_entry_point( - int id: @function ref, - unique int entry_point: @stmt ref -); - -function_return_type( - int id: @function ref, - int return_type: @type ref -); - -/** - * If `function` is a coroutine, then this gives the `std::experimental::resumable_traits` - * instance associated with it, and the variables representing the `handle` and `promise` - * for it. - */ -coroutine( - unique int function: @function ref, - int traits: @type ref -); - -/* -case @coroutine_placeholder_variable.kind of - 1 = @handle -| 2 = @promise -| 3 = @init_await_resume -; -*/ - -coroutine_placeholder_variable( - unique int placeholder_variable: @variable ref, - int kind: int ref, - int function: @function ref -) - -/** The `new` function used for allocating the coroutine state, if any. */ -coroutine_new( - unique int function: @function ref, - int new: @function ref -); - -/** The `delete` function used for deallocating the coroutine state, if any. */ -coroutine_delete( - unique int function: @function ref, - int delete: @function ref -); - -purefunctions(unique int id: @function ref); - -function_deleted(unique int id: @function ref); - -function_defaulted(unique int id: @function ref); - -function_prototyped(unique int id: @function ref) - -deduction_guide_for_class( - int id: @function ref, - int class_template: @usertype ref -) - -member_function_this_type( - unique int id: @function ref, - int this_type: @type ref -); - -#keyset[id, type_id] -fun_decls( - int id: @fun_decl, - int function: @function ref, - int type_id: @type ref, - string name: string ref, - int location: @location_default ref -); -fun_def(unique int id: @fun_decl ref); -fun_specialized(unique int id: @fun_decl ref); -fun_implicit(unique int id: @fun_decl ref); -fun_decl_specifiers( - int id: @fun_decl ref, - string name: string ref -) -#keyset[fun_decl, index] -fun_decl_throws( - int fun_decl: @fun_decl ref, - int index: int ref, - int type_id: @type ref -); -/* an empty throw specification is different from none */ -fun_decl_empty_throws(unique int fun_decl: @fun_decl ref); -fun_decl_noexcept( - int fun_decl: @fun_decl ref, - int constant: @expr ref -); -fun_decl_empty_noexcept(int fun_decl: @fun_decl ref); -fun_decl_typedef_type( - unique int fun_decl: @fun_decl ref, - int typedeftype_id: @usertype ref -); - -param_decl_bind( - unique int id: @var_decl ref, - int index: int ref, - int fun_decl: @fun_decl ref -); - -#keyset[id, type_id] -var_decls( - int id: @var_decl, - int variable: @variable ref, - int type_id: @type ref, - string name: string ref, - int location: @location_default ref -); -var_def(unique int id: @var_decl ref); -var_decl_specifiers( - int id: @var_decl ref, - string name: string ref -) -is_structured_binding(unique int id: @variable ref); - -type_decls( - unique int id: @type_decl, - int type_id: @type ref, - int location: @location_default ref -); -type_def(unique int id: @type_decl ref); -type_decl_top( - unique int type_decl: @type_decl ref -); - -namespace_decls( - unique int id: @namespace_decl, - int namespace_id: @namespace ref, - int location: @location_default ref, - int bodylocation: @location_default ref -); - -case @using.kind of - 1 = @using_declaration -| 2 = @using_directive -| 3 = @using_enum_declaration -; - -usings( - unique int id: @using, - int element_id: @element ref, - int location: @location_default ref, - int kind: int ref -); - -/** The element which contains the `using` declaration. */ -using_container( - int parent: @element ref, - int child: @using ref -); - -static_asserts( - unique int id: @static_assert, - int condition : @expr ref, - string message : string ref, - int location: @location_default ref, - int enclosing : @element ref -); - -// each function has an ordered list of parameters -#keyset[id, type_id] -#keyset[function, index, type_id] -params( - int id: @parameter, - int function: @parameterized_element ref, - int index: int ref, - int type_id: @type ref -); - -overrides( - int new: @function ref, - int old: @function ref -); - -#keyset[id, type_id] -membervariables( - int id: @membervariable, - int type_id: @type ref, - string name: string ref -); - -#keyset[id, type_id] -globalvariables( - int id: @globalvariable, - int type_id: @type ref, - string name: string ref -); - -#keyset[id, type_id] -localvariables( - int id: @localvariable, - int type_id: @type ref, - string name: string ref -); - -autoderivation( - unique int var: @variable ref, - int derivation_type: @type ref -); - -orphaned_variables( - int var: @localvariable ref, - int function: @function ref -) - -enumconstants( - unique int id: @enumconstant, - int parent: @usertype ref, - int index: int ref, - int type_id: @type ref, - string name: string ref, - int location: @location_default ref -); - -@variable = @localscopevariable | @globalvariable | @membervariable; - -@localscopevariable = @localvariable | @parameter; - -/** - * Built-in types are the fundamental types, e.g., integral, floating, and void. - */ -case @builtintype.kind of - 1 = @errortype -| 2 = @unknowntype -| 3 = @void -| 4 = @boolean -| 5 = @char -| 6 = @unsigned_char -| 7 = @signed_char -| 8 = @short -| 9 = @unsigned_short -| 10 = @signed_short -| 11 = @int -| 12 = @unsigned_int -| 13 = @signed_int -| 14 = @long -| 15 = @unsigned_long -| 16 = @signed_long -| 17 = @long_long -| 18 = @unsigned_long_long -| 19 = @signed_long_long -// ... 20 Microsoft-specific __int8 -// ... 21 Microsoft-specific __int16 -// ... 22 Microsoft-specific __int32 -// ... 23 Microsoft-specific __int64 -| 24 = @float -| 25 = @double -| 26 = @long_double -| 27 = @complex_float // C99-specific _Complex float -| 28 = @complex_double // C99-specific _Complex double -| 29 = @complex_long_double // C99-specific _Complex long double -| 30 = @imaginary_float // C99-specific _Imaginary float -| 31 = @imaginary_double // C99-specific _Imaginary double -| 32 = @imaginary_long_double // C99-specific _Imaginary long double -| 33 = @wchar_t // Microsoft-specific -| 34 = @decltype_nullptr // C++11 -| 35 = @int128 // __int128 -| 36 = @unsigned_int128 // unsigned __int128 -| 37 = @signed_int128 // signed __int128 -| 38 = @float128 // __float128 -| 39 = @complex_float128 // _Complex __float128 -| 40 = @decimal32 // _Decimal32 -| 41 = @decimal64 // _Decimal64 -| 42 = @decimal128 // _Decimal128 -| 43 = @char16_t -| 44 = @char32_t -| 45 = @std_float32 // _Float32 -| 46 = @float32x // _Float32x -| 47 = @std_float64 // _Float64 -| 48 = @float64x // _Float64x -| 49 = @std_float128 // _Float128 -// ... 50 _Float128x -| 51 = @char8_t -| 52 = @float16 // _Float16 -| 53 = @complex_float16 // _Complex _Float16 -| 54 = @fp16 // __fp16 -| 55 = @std_bfloat16 // __bf16 -| 56 = @std_float16 // std::float16_t -| 57 = @complex_std_float32 // _Complex _Float32 -| 58 = @complex_float32x // _Complex _Float32x -| 59 = @complex_std_float64 // _Complex _Float64 -| 60 = @complex_float64x // _Complex _Float64x -| 61 = @complex_std_float128 // _Complex _Float128 -; - -builtintypes( - unique int id: @builtintype, - string name: string ref, - int kind: int ref, - int size: int ref, - int sign: int ref, - int alignment: int ref -); - -/** - * Derived types are types that are directly derived from existing types and - * point to, refer to, transform type data to return a new type. - */ -case @derivedtype.kind of - 1 = @pointer -| 2 = @reference -| 3 = @type_with_specifiers -| 4 = @array -| 5 = @gnu_vector -| 6 = @routineptr -| 7 = @routinereference -| 8 = @rvalue_reference // C++11 -// ... 9 type_conforming_to_protocols deprecated -| 10 = @block -; - -derivedtypes( - unique int id: @derivedtype, - string name: string ref, - int kind: int ref, - int type_id: @type ref -); - -pointerishsize(unique int id: @derivedtype ref, - int size: int ref, - int alignment: int ref); - -arraysizes( - unique int id: @derivedtype ref, - int num_elements: int ref, - int bytesize: int ref, - int alignment: int ref -); - -typedefbase( - unique int id: @usertype ref, - int type_id: @type ref -); - -/** - * An instance of the C++11 `decltype` operator. For example: - * ``` - * int a; - * decltype(1+a) b; - * ``` - * Here `expr` is `1+a`. - * - * Sometimes an additional pair of parentheses around the expression - * would change the semantics of this decltype, e.g. - * ``` - * struct A { double x; }; - * const A* a = new A(); - * decltype( a->x ); // type is double - * decltype((a->x)); // type is const double& - * ``` - * (Please consult the C++11 standard for more details). - * `parentheses_would_change_meaning` is `true` iff that is the case. - */ -#keyset[id, expr] -decltypes( - int id: @decltype, - int expr: @expr ref, - int base_type: @type ref, - boolean parentheses_would_change_meaning: boolean ref -); - -/* -case @usertype.kind of - 1 = @struct -| 2 = @class -| 3 = @union -| 4 = @enum -| 5 = @typedef // classic C: typedef typedef type name -| 6 = @template -| 7 = @template_parameter -| 8 = @template_template_parameter -| 9 = @proxy_class // a proxy class associated with a template parameter -// ... 10 objc_class deprecated -// ... 11 objc_protocol deprecated -// ... 12 objc_category deprecated -| 13 = @scoped_enum -| 14 = @using_alias // a using name = type style typedef -; -*/ - -usertypes( - unique int id: @usertype, - string name: string ref, - int kind: int ref -); - -usertypesize( - unique int id: @usertype ref, - int size: int ref, - int alignment: int ref -); - -usertype_final(unique int id: @usertype ref); - -usertype_uuid( - unique int id: @usertype ref, - string uuid: string ref -); - -mangled_name( - unique int id: @declaration ref, - int mangled_name : @mangledname, - boolean is_complete: boolean ref -); - -is_pod_class(unique int id: @usertype ref); -is_standard_layout_class(unique int id: @usertype ref); - -is_complete(unique int id: @usertype ref); - -is_class_template(unique int id: @usertype ref); -class_instantiation( - int to: @usertype ref, - int from: @usertype ref -); -class_template_argument( - int type_id: @usertype ref, - int index: int ref, - int arg_type: @type ref -); -class_template_argument_value( - int type_id: @usertype ref, - int index: int ref, - int arg_value: @expr ref -); - -is_proxy_class_for( - unique int id: @usertype ref, - unique int templ_param_id: @usertype ref -); - -type_mentions( - unique int id: @type_mention, - int type_id: @type ref, - int location: @location ref, - // a_symbol_reference_kind from the frontend. - int kind: int ref -); - -is_function_template(unique int id: @function ref); -function_instantiation( - unique int to: @function ref, - int from: @function ref -); -function_template_argument( - int function_id: @function ref, - int index: int ref, - int arg_type: @type ref -); -function_template_argument_value( - int function_id: @function ref, - int index: int ref, - int arg_value: @expr ref -); - -is_variable_template(unique int id: @variable ref); -variable_instantiation( - unique int to: @variable ref, - int from: @variable ref -); -variable_template_argument( - int variable_id: @variable ref, - int index: int ref, - int arg_type: @type ref -); -variable_template_argument_value( - int variable_id: @variable ref, - int index: int ref, - int arg_value: @expr ref -); - -routinetypes( - unique int id: @routinetype, - int return_type: @type ref -); - -routinetypeargs( - int routine: @routinetype ref, - int index: int ref, - int type_id: @type ref -); - -ptrtomembers( - unique int id: @ptrtomember, - int type_id: @type ref, - int class_id: @type ref -); - -/* - specifiers for types, functions, and variables - - "public", - "protected", - "private", - - "const", - "volatile", - "static", - - "pure", - "virtual", - "sealed", // Microsoft - "__interface", // Microsoft - "inline", - "explicit", - - "near", // near far extension - "far", // near far extension - "__ptr32", // Microsoft - "__ptr64", // Microsoft - "__sptr", // Microsoft - "__uptr", // Microsoft - "dllimport", // Microsoft - "dllexport", // Microsoft - "thread", // Microsoft - "naked", // Microsoft - "microsoft_inline", // Microsoft - "forceinline", // Microsoft - "selectany", // Microsoft - "nothrow", // Microsoft - "novtable", // Microsoft - "noreturn", // Microsoft - "noinline", // Microsoft - "noalias", // Microsoft - "restrict", // Microsoft -*/ - -specifiers( - unique int id: @specifier, - unique string str: string ref -); - -typespecifiers( - int type_id: @type ref, - int spec_id: @specifier ref -); - -funspecifiers( - int func_id: @function ref, - int spec_id: @specifier ref -); - -varspecifiers( - int var_id: @accessible ref, - int spec_id: @specifier ref -); - -explicit_specifier_exprs( - unique int func_id: @function ref, - int constant: @expr ref -) - -attributes( - unique int id: @attribute, - int kind: int ref, - string name: string ref, - string name_space: string ref, - int location: @location_default ref -); - -case @attribute.kind of - 0 = @gnuattribute -| 1 = @stdattribute -| 2 = @declspec -| 3 = @msattribute -| 4 = @alignas -// ... 5 @objc_propertyattribute deprecated -; - -attribute_args( - unique int id: @attribute_arg, - int kind: int ref, - int attribute: @attribute ref, - int index: int ref, - int location: @location_default ref -); - -case @attribute_arg.kind of - 0 = @attribute_arg_empty -| 1 = @attribute_arg_token -| 2 = @attribute_arg_constant -| 3 = @attribute_arg_type -| 4 = @attribute_arg_constant_expr -| 5 = @attribute_arg_expr -; - -attribute_arg_value( - unique int arg: @attribute_arg ref, - string value: string ref -); -attribute_arg_type( - unique int arg: @attribute_arg ref, - int type_id: @type ref -); -attribute_arg_constant( - unique int arg: @attribute_arg ref, - int constant: @expr ref -) -attribute_arg_expr( - unique int arg: @attribute_arg ref, - int expr: @expr ref -) -attribute_arg_name( - unique int arg: @attribute_arg ref, - string name: string ref -); - -typeattributes( - int type_id: @type ref, - int spec_id: @attribute ref -); - -funcattributes( - int func_id: @function ref, - int spec_id: @attribute ref -); - -varattributes( - int var_id: @accessible ref, - int spec_id: @attribute ref -); - -stmtattributes( - int stmt_id: @stmt ref, - int spec_id: @attribute ref -); - -@type = @builtintype - | @derivedtype - | @usertype - /* TODO | @fixedpointtype */ - | @routinetype - | @ptrtomember - | @decltype; - -unspecifiedtype( - unique int type_id: @type ref, - int unspecified_type_id: @type ref -); - -member( - int parent: @type ref, - int index: int ref, - int child: @member ref -); - -@enclosingfunction_child = @usertype | @variable | @namespace - -enclosingfunction( - unique int child: @enclosingfunction_child ref, - int parent: @function ref -); - -derivations( - unique int derivation: @derivation, - int sub: @type ref, - int index: int ref, - int super: @type ref, - int location: @location_default ref -); - -derspecifiers( - int der_id: @derivation ref, - int spec_id: @specifier ref -); - -/** - * Contains the byte offset of the base class subobject within the derived - * class. Only holds for non-virtual base classes, but see table - * `virtual_base_offsets` for offsets of virtual base class subobjects. - */ -direct_base_offsets( - unique int der_id: @derivation ref, - int offset: int ref -); - -/** - * Contains the byte offset of the virtual base class subobject for class - * `super` within a most-derived object of class `sub`. `super` can be either a - * direct or indirect base class. - */ -#keyset[sub, super] -virtual_base_offsets( - int sub: @usertype ref, - int super: @usertype ref, - int offset: int ref -); - -frienddecls( - unique int id: @frienddecl, - int type_id: @type ref, - int decl_id: @declaration ref, - int location: @location_default ref -); - -@declaredtype = @usertype ; - -@declaration = @function - | @declaredtype - | @variable - | @enumconstant - | @frienddecl; - -@member = @membervariable - | @function - | @declaredtype - | @enumconstant; - -@locatable = @diagnostic - | @declaration - | @ppd_include - | @ppd_define - | @macroinvocation - /*| @funcall*/ - | @xmllocatable - | @attribute - | @attribute_arg; - -@namedscope = @namespace | @usertype; - -@element = @locatable - | @file - | @folder - | @specifier - | @type - | @expr - | @namespace - | @initialiser - | @stmt - | @derivation - | @comment - | @preprocdirect - | @fun_decl - | @var_decl - | @type_decl - | @namespace_decl - | @using - | @namequalifier - | @specialnamequalifyingelement - | @static_assert - | @type_mention - | @lambdacapture; - -@exprparent = @element; - -comments( - unique int id: @comment, - string contents: string ref, - int location: @location_default ref -); - -commentbinding( - int id: @comment ref, - int element: @element ref -); - -exprconv( - int converted: @expr ref, - unique int conversion: @expr ref -); - -compgenerated(unique int id: @element ref); - -/** - * `destructor_call` destructs the `i`'th entity that should be - * destructed following `element`. Note that entities should be - * destructed in reverse construction order, so for a given `element` - * these should be called from highest to lowest `i`. - */ -#keyset[element, destructor_call] -#keyset[element, i] -synthetic_destructor_call( - int element: @element ref, - int i: int ref, - int destructor_call: @routineexpr ref -); - -namespaces( - unique int id: @namespace, - string name: string ref -); - -namespace_inline( - unique int id: @namespace ref -); - -namespacembrs( - int parentid: @namespace ref, - unique int memberid: @namespacembr ref -); - -@namespacembr = @declaration | @namespace; - -exprparents( - int expr_id: @expr ref, - int child_index: int ref, - int parent_id: @exprparent ref -); - -expr_isload(unique int expr_id: @expr ref); - -@cast = @c_style_cast - | @const_cast - | @dynamic_cast - | @reinterpret_cast - | @static_cast - ; - -/* -case @conversion.kind of - 0 = @simple_conversion // a numeric conversion, qualification conversion, or a reinterpret_cast -| 1 = @bool_conversion // conversion to 'bool' -| 2 = @base_class_conversion // a derived-to-base conversion -| 3 = @derived_class_conversion // a base-to-derived conversion -| 4 = @pm_base_class_conversion // a derived-to-base conversion of a pointer to member -| 5 = @pm_derived_class_conversion // a base-to-derived conversion of a pointer to member -| 6 = @glvalue_adjust // an adjustment of the type of a glvalue -| 7 = @prvalue_adjust // an adjustment of the type of a prvalue -; -*/ -/** - * Describes the semantics represented by a cast expression. This is largely - * independent of the source syntax of the cast, so it is separate from the - * regular expression kind. - */ -conversionkinds( - unique int expr_id: @cast ref, - int kind: int ref -); - -@conversion = @cast - | @array_to_pointer - | @parexpr - | @reference_to - | @ref_indirect - | @temp_init - | @c11_generic - ; - -/* -case @funbindexpr.kind of - 0 = @normal_call // a normal call -| 1 = @virtual_call // a virtual call -| 2 = @adl_call // a call whose target is only found by ADL -; -*/ -iscall( - unique int caller: @funbindexpr ref, - int kind: int ref -); - -numtemplatearguments( - unique int expr_id: @expr ref, - int num: int ref -); - -specialnamequalifyingelements( - unique int id: @specialnamequalifyingelement, - unique string name: string ref -); - -@namequalifiableelement = @expr | @namequalifier; -@namequalifyingelement = @namespace - | @specialnamequalifyingelement - | @usertype; - -namequalifiers( - unique int id: @namequalifier, - unique int qualifiableelement: @namequalifiableelement ref, - int qualifyingelement: @namequalifyingelement ref, - int location: @location_default ref -); - -varbind( - int expr: @varbindexpr ref, - int var: @accessible ref -); - -funbind( - int expr: @funbindexpr ref, - int fun: @function ref -); - -@any_new_expr = @new_expr - | @new_array_expr; - -@new_or_delete_expr = @any_new_expr - | @delete_expr - | @delete_array_expr; - -@prefix_crement_expr = @preincrexpr | @predecrexpr; - -@postfix_crement_expr = @postincrexpr | @postdecrexpr; - -@increment_expr = @preincrexpr | @postincrexpr; - -@decrement_expr = @predecrexpr | @postdecrexpr; - -@crement_expr = @increment_expr | @decrement_expr; - -@un_arith_op_expr = @arithnegexpr - | @unaryplusexpr - | @conjugation - | @realpartexpr - | @imagpartexpr - | @crement_expr - ; - -@un_bitwise_op_expr = @complementexpr; - -@un_log_op_expr = @notexpr; - -@un_op_expr = @address_of - | @indirect - | @un_arith_op_expr - | @un_bitwise_op_expr - | @builtinaddressof - | @vec_fill - | @un_log_op_expr - | @co_await - | @co_yield - ; - -@bin_log_op_expr = @andlogicalexpr | @orlogicalexpr; - -@cmp_op_expr = @eq_op_expr | @rel_op_expr; - -@eq_op_expr = @eqexpr | @neexpr; - -@rel_op_expr = @gtexpr - | @ltexpr - | @geexpr - | @leexpr - | @spaceshipexpr - ; - -@bin_bitwise_op_expr = @lshiftexpr - | @rshiftexpr - | @andexpr - | @orexpr - | @xorexpr - ; - -@p_arith_op_expr = @paddexpr - | @psubexpr - | @pdiffexpr - ; - -@bin_arith_op_expr = @addexpr - | @subexpr - | @mulexpr - | @divexpr - | @remexpr - | @jmulexpr - | @jdivexpr - | @fjaddexpr - | @jfaddexpr - | @fjsubexpr - | @jfsubexpr - | @minexpr - | @maxexpr - | @p_arith_op_expr - ; - -@bin_op_expr = @bin_arith_op_expr - | @bin_bitwise_op_expr - | @cmp_op_expr - | @bin_log_op_expr - ; - -@op_expr = @un_op_expr - | @bin_op_expr - | @assign_expr - | @conditionalexpr - ; - -@assign_arith_expr = @assignaddexpr - | @assignsubexpr - | @assignmulexpr - | @assigndivexpr - | @assignremexpr - ; - -@assign_bitwise_expr = @assignandexpr - | @assignorexpr - | @assignxorexpr - | @assignlshiftexpr - | @assignrshiftexpr - ; - -@assign_pointer_expr = @assignpaddexpr - | @assignpsubexpr - ; - -@assign_op_expr = @assign_arith_expr - | @assign_bitwise_expr - | @assign_pointer_expr - ; - -@assign_expr = @assignexpr | @assign_op_expr | @blockassignexpr - -/* - Binary encoding of the allocator form. - - case @allocator.form of - 0 = plain - | 1 = alignment - ; -*/ - -/** - * The allocator function associated with a `new` or `new[]` expression. - * The `form` column specified whether the allocation call contains an alignment - * argument. - */ -expr_allocator( - unique int expr: @any_new_expr ref, - int func: @function ref, - int form: int ref -); - -/* - Binary encoding of the deallocator form. - - case @deallocator.form of - 0 = plain - | 1 = size - | 2 = alignment - | 4 = destroying_delete - ; -*/ - -/** - * The deallocator function associated with a `delete`, `delete[]`, `new`, or - * `new[]` expression. For a `new` or `new[]` expression, the deallocator is the - * one used to free memory if the initialization throws an exception. - * The `form` column specifies whether the deallocation call contains a size - * argument, and alignment argument, or both. - */ -expr_deallocator( - unique int expr: @new_or_delete_expr ref, - int func: @function ref, - int form: int ref -); - -/** - * Holds if the `@conditionalexpr` is of the two operand form - * `guard ? : false`. - */ -expr_cond_two_operand( - unique int cond: @conditionalexpr ref -); - -/** - * The guard of `@conditionalexpr` `guard ? true : false` - */ -expr_cond_guard( - unique int cond: @conditionalexpr ref, - int guard: @expr ref -); - -/** - * The expression used when the guard of `@conditionalexpr` - * `guard ? true : false` holds. For the two operand form - * `guard ?: false` consider using `expr_cond_guard` instead. - */ -expr_cond_true( - unique int cond: @conditionalexpr ref, - int true: @expr ref -); - -/** - * The expression used when the guard of `@conditionalexpr` - * `guard ? true : false` does not hold. - */ -expr_cond_false( - unique int cond: @conditionalexpr ref, - int false: @expr ref -); - -/** A string representation of the value. */ -values( - unique int id: @value, - string str: string ref -); - -/** The actual text in the source code for the value, if any. */ -valuetext( - unique int id: @value ref, - string text: string ref -); - -valuebind( - int val: @value ref, - unique int expr: @expr ref -); - -fieldoffsets( - unique int id: @variable ref, - int byteoffset: int ref, - int bitoffset: int ref -); - -bitfield( - unique int id: @variable ref, - int bits: int ref, - int declared_bits: int ref -); - -/* TODO -memberprefix( - int member: @expr ref, - int prefix: @expr ref -); -*/ - -/* - kind(1) = mbrcallexpr - kind(2) = mbrptrcallexpr - kind(3) = mbrptrmbrcallexpr - kind(4) = ptrmbrptrmbrcallexpr - kind(5) = mbrreadexpr // x.y - kind(6) = mbrptrreadexpr // p->y - kind(7) = mbrptrmbrreadexpr // x.*pm - kind(8) = mbrptrmbrptrreadexpr // x->*pm - kind(9) = staticmbrreadexpr // static x.y - kind(10) = staticmbrptrreadexpr // static p->y -*/ -/* TODO -memberaccess( - int member: @expr ref, - int kind: int ref -); -*/ - -initialisers( - unique int init: @initialiser, - int var: @accessible ref, - unique int expr: @expr ref, - int location: @location_expr ref -); - -braced_initialisers( - int init: @initialiser ref -); - -/** - * An ancestor for the expression, for cases in which we cannot - * otherwise find the expression's parent. - */ -expr_ancestor( - int exp: @expr ref, - int ancestor: @element ref -); - -exprs( - unique int id: @expr, - int kind: int ref, - int location: @location_expr ref -); - -expr_reuse( - int reuse: @expr ref, - int original: @expr ref, - int value_category: int ref -) - -/* - case @value.category of - 1 = prval - | 2 = xval - | 3 = lval - ; -*/ -expr_types( - int id: @expr ref, - int typeid: @type ref, - int value_category: int ref -); - -case @expr.kind of - 1 = @errorexpr -| 2 = @address_of // & AddressOfExpr -| 3 = @reference_to // ReferenceToExpr (implicit?) -| 4 = @indirect // * PointerDereferenceExpr -| 5 = @ref_indirect // ReferenceDereferenceExpr (implicit?) -// ... -| 8 = @array_to_pointer // (???) -| 9 = @vacuous_destructor_call // VacuousDestructorCall -// ... -| 11 = @assume // Microsoft -| 12 = @parexpr -| 13 = @arithnegexpr -| 14 = @unaryplusexpr -| 15 = @complementexpr -| 16 = @notexpr -| 17 = @conjugation // GNU ~ operator -| 18 = @realpartexpr // GNU __real -| 19 = @imagpartexpr // GNU __imag -| 20 = @postincrexpr -| 21 = @postdecrexpr -| 22 = @preincrexpr -| 23 = @predecrexpr -| 24 = @conditionalexpr -| 25 = @addexpr -| 26 = @subexpr -| 27 = @mulexpr -| 28 = @divexpr -| 29 = @remexpr -| 30 = @jmulexpr // C99 mul imaginary -| 31 = @jdivexpr // C99 div imaginary -| 32 = @fjaddexpr // C99 add real + imaginary -| 33 = @jfaddexpr // C99 add imaginary + real -| 34 = @fjsubexpr // C99 sub real - imaginary -| 35 = @jfsubexpr // C99 sub imaginary - real -| 36 = @paddexpr // pointer add (pointer + int or int + pointer) -| 37 = @psubexpr // pointer sub (pointer - integer) -| 38 = @pdiffexpr // difference between two pointers -| 39 = @lshiftexpr -| 40 = @rshiftexpr -| 41 = @andexpr -| 42 = @orexpr -| 43 = @xorexpr -| 44 = @eqexpr -| 45 = @neexpr -| 46 = @gtexpr -| 47 = @ltexpr -| 48 = @geexpr -| 49 = @leexpr -| 50 = @minexpr // GNU minimum -| 51 = @maxexpr // GNU maximum -| 52 = @assignexpr -| 53 = @assignaddexpr -| 54 = @assignsubexpr -| 55 = @assignmulexpr -| 56 = @assigndivexpr -| 57 = @assignremexpr -| 58 = @assignlshiftexpr -| 59 = @assignrshiftexpr -| 60 = @assignandexpr -| 61 = @assignorexpr -| 62 = @assignxorexpr -| 63 = @assignpaddexpr // assign pointer add -| 64 = @assignpsubexpr // assign pointer sub -| 65 = @andlogicalexpr -| 66 = @orlogicalexpr -| 67 = @commaexpr -| 68 = @subscriptexpr // access to member of an array, e.g., a[5] -// ... 69 @objc_subscriptexpr deprecated -// ... 70 @cmdaccess deprecated -// ... -| 73 = @virtfunptrexpr -| 74 = @callexpr -// ... 75 @msgexpr_normal deprecated -// ... 76 @msgexpr_super deprecated -// ... 77 @atselectorexpr deprecated -// ... 78 @atprotocolexpr deprecated -| 79 = @vastartexpr -| 80 = @vaargexpr -| 81 = @vaendexpr -| 82 = @vacopyexpr -// ... 83 @atencodeexpr deprecated -| 84 = @varaccess -| 85 = @thisaccess -// ... 86 @objc_box_expr deprecated -| 87 = @new_expr -| 88 = @delete_expr -| 89 = @throw_expr -| 90 = @condition_decl // a variable declared in a condition, e.g., if(int x = y > 2) -| 91 = @braced_init_list -| 92 = @type_id -| 93 = @runtime_sizeof -| 94 = @runtime_alignof -| 95 = @sizeof_pack -| 96 = @expr_stmt // GNU extension -| 97 = @routineexpr -| 98 = @type_operand // used to access a type in certain contexts (haven't found any examples yet....) -| 99 = @offsetofexpr // offsetof ::= type and field -| 100 = @hasassignexpr // __has_assign ::= type -| 101 = @hascopyexpr // __has_copy ::= type -| 102 = @hasnothrowassign // __has_nothrow_assign ::= type -| 103 = @hasnothrowconstr // __has_nothrow_constructor ::= type -| 104 = @hasnothrowcopy // __has_nothrow_copy ::= type -| 105 = @hastrivialassign // __has_trivial_assign ::= type -| 106 = @hastrivialconstr // __has_trivial_constructor ::= type -| 107 = @hastrivialcopy // __has_trivial_copy ::= type -| 108 = @hasuserdestr // __has_user_destructor ::= type -| 109 = @hasvirtualdestr // __has_virtual_destructor ::= type -| 110 = @isabstractexpr // __is_abstract ::= type -| 111 = @isbaseofexpr // __is_base_of ::= type type -| 112 = @isclassexpr // __is_class ::= type -| 113 = @isconvtoexpr // __is_convertible_to ::= type type -| 114 = @isemptyexpr // __is_empty ::= type -| 115 = @isenumexpr // __is_enum ::= type -| 116 = @ispodexpr // __is_pod ::= type -| 117 = @ispolyexpr // __is_polymorphic ::= type -| 118 = @isunionexpr // __is_union ::= type -| 119 = @typescompexpr // GNU __builtin_types_compatible ::= type type -| 120 = @intaddrexpr // frontend internal builtin, used to implement offsetof -// ... -| 122 = @hastrivialdestructor // __has_trivial_destructor ::= type -| 123 = @literal -| 124 = @uuidof -| 127 = @aggregateliteral -| 128 = @delete_array_expr -| 129 = @new_array_expr -// ... 130 @objc_array_literal deprecated -// ... 131 @objc_dictionary_literal deprecated -| 132 = @foldexpr -// ... -| 200 = @ctordirectinit -| 201 = @ctorvirtualinit -| 202 = @ctorfieldinit -| 203 = @ctordelegatinginit -| 204 = @dtordirectdestruct -| 205 = @dtorvirtualdestruct -| 206 = @dtorfielddestruct -// ... -| 210 = @static_cast -| 211 = @reinterpret_cast -| 212 = @const_cast -| 213 = @dynamic_cast -| 214 = @c_style_cast -| 215 = @lambdaexpr -| 216 = @param_ref -| 217 = @noopexpr -// ... -| 294 = @istriviallyconstructibleexpr -| 295 = @isdestructibleexpr -| 296 = @isnothrowdestructibleexpr -| 297 = @istriviallydestructibleexpr -| 298 = @istriviallyassignableexpr -| 299 = @isnothrowassignableexpr -| 300 = @istrivialexpr -| 301 = @isstandardlayoutexpr -| 302 = @istriviallycopyableexpr -| 303 = @isliteraltypeexpr -| 304 = @hastrivialmoveconstructorexpr -| 305 = @hastrivialmoveassignexpr -| 306 = @hasnothrowmoveassignexpr -| 307 = @isconstructibleexpr -| 308 = @isnothrowconstructibleexpr -| 309 = @hasfinalizerexpr -| 310 = @isdelegateexpr -| 311 = @isinterfaceclassexpr -| 312 = @isrefarrayexpr -| 313 = @isrefclassexpr -| 314 = @issealedexpr -| 315 = @issimplevalueclassexpr -| 316 = @isvalueclassexpr -| 317 = @isfinalexpr -| 319 = @noexceptexpr -| 320 = @builtinshufflevector -| 321 = @builtinchooseexpr -| 322 = @builtinaddressof -| 323 = @vec_fill -| 324 = @builtinconvertvector -| 325 = @builtincomplex -| 326 = @spaceshipexpr -| 327 = @co_await -| 328 = @co_yield -| 329 = @temp_init -| 330 = @isassignable -| 331 = @isaggregate -| 332 = @hasuniqueobjectrepresentations -| 333 = @builtinbitcast -| 334 = @builtinshuffle -| 335 = @blockassignexpr -| 336 = @issame -| 337 = @isfunction -| 338 = @islayoutcompatible -| 339 = @ispointerinterconvertiblebaseof -| 340 = @isarray -| 341 = @arrayrank -| 342 = @arrayextent -| 343 = @isarithmetic -| 344 = @iscompletetype -| 345 = @iscompound -| 346 = @isconst -| 347 = @isfloatingpoint -| 348 = @isfundamental -| 349 = @isintegral -| 350 = @islvaluereference -| 351 = @ismemberfunctionpointer -| 352 = @ismemberobjectpointer -| 353 = @ismemberpointer -| 354 = @isobject -| 355 = @ispointer -| 356 = @isreference -| 357 = @isrvaluereference -| 358 = @isscalar -| 359 = @issigned -| 360 = @isunsigned -| 361 = @isvoid -| 362 = @isvolatile -| 363 = @reuseexpr -| 364 = @istriviallycopyassignable -| 365 = @isassignablenopreconditioncheck -| 366 = @referencebindstotemporary -| 367 = @issameas -| 368 = @builtinhasattribute -| 369 = @ispointerinterconvertiblewithclass -| 370 = @builtinispointerinterconvertiblewithclass -| 371 = @iscorrespondingmember -| 372 = @builtiniscorrespondingmember -| 373 = @isboundedarray -| 374 = @isunboundedarray -| 375 = @isreferenceable -| 378 = @isnothrowconvertible -| 379 = @referenceconstructsfromtemporary -| 380 = @referenceconvertsfromtemporary -| 381 = @isconvertible -| 382 = @isvalidwinrttype -| 383 = @iswinclass -| 384 = @iswininterface -| 385 = @istriviallyequalitycomparable -| 386 = @isscopedenum -| 387 = @istriviallyrelocatable -| 388 = @datasizeof -| 389 = @c11_generic -| 390 = @requires_expr -| 391 = @nested_requirement -| 392 = @compound_requirement -| 393 = @concept_id -; - -@var_args_expr = @vastartexpr - | @vaendexpr - | @vaargexpr - | @vacopyexpr - ; - -@builtin_op = @var_args_expr - | @noopexpr - | @offsetofexpr - | @intaddrexpr - | @hasassignexpr - | @hascopyexpr - | @hasnothrowassign - | @hasnothrowconstr - | @hasnothrowcopy - | @hastrivialassign - | @hastrivialconstr - | @hastrivialcopy - | @hastrivialdestructor - | @hasuserdestr - | @hasvirtualdestr - | @isabstractexpr - | @isbaseofexpr - | @isclassexpr - | @isconvtoexpr - | @isemptyexpr - | @isenumexpr - | @ispodexpr - | @ispolyexpr - | @isunionexpr - | @typescompexpr - | @builtinshufflevector - | @builtinconvertvector - | @builtinaddressof - | @istriviallyconstructibleexpr - | @isdestructibleexpr - | @isnothrowdestructibleexpr - | @istriviallydestructibleexpr - | @istriviallyassignableexpr - | @isnothrowassignableexpr - | @istrivialexpr - | @isstandardlayoutexpr - | @istriviallycopyableexpr - | @isliteraltypeexpr - | @hastrivialmoveconstructorexpr - | @hastrivialmoveassignexpr - | @hasnothrowmoveassignexpr - | @isconstructibleexpr - | @isnothrowconstructibleexpr - | @hasfinalizerexpr - | @isdelegateexpr - | @isinterfaceclassexpr - | @isrefarrayexpr - | @isrefclassexpr - | @issealedexpr - | @issimplevalueclassexpr - | @isvalueclassexpr - | @isfinalexpr - | @builtinchooseexpr - | @builtincomplex - | @isassignable - | @isaggregate - | @hasuniqueobjectrepresentations - | @builtinbitcast - | @builtinshuffle - | @issame - | @isfunction - | @islayoutcompatible - | @ispointerinterconvertiblebaseof - | @isarray - | @arrayrank - | @arrayextent - | @isarithmetic - | @iscompletetype - | @iscompound - | @isconst - | @isfloatingpoint - | @isfundamental - | @isintegral - | @islvaluereference - | @ismemberfunctionpointer - | @ismemberobjectpointer - | @ismemberpointer - | @isobject - | @ispointer - | @isreference - | @isrvaluereference - | @isscalar - | @issigned - | @isunsigned - | @isvoid - | @isvolatile - | @istriviallycopyassignable - | @isassignablenopreconditioncheck - | @referencebindstotemporary - | @issameas - | @builtinhasattribute - | @ispointerinterconvertiblewithclass - | @builtinispointerinterconvertiblewithclass - | @iscorrespondingmember - | @builtiniscorrespondingmember - | @isboundedarray - | @isunboundedarray - | @isreferenceable - | @isnothrowconvertible - | @referenceconstructsfromtemporary - | @referenceconvertsfromtemporary - | @isconvertible - | @isvalidwinrttype - | @iswinclass - | @iswininterface - | @istriviallyequalitycomparable - | @isscopedenum - | @istriviallyrelocatable - ; - -compound_requirement_is_noexcept( - int expr: @compound_requirement ref -); - -new_allocated_type( - unique int expr: @new_expr ref, - int type_id: @type ref -); - -new_array_allocated_type( - unique int expr: @new_array_expr ref, - int type_id: @type ref -); - -/** - * The field being initialized by an initializer expression within an aggregate - * initializer for a class/struct/union. Position is used to sort repeated initializers. - */ -#keyset[aggregate, position] -aggregate_field_init( - int aggregate: @aggregateliteral ref, - int initializer: @expr ref, - int field: @membervariable ref, - int position: int ref -); - -/** - * The index of the element being initialized by an initializer expression - * within an aggregate initializer for an array. Position is used to sort repeated initializers. - */ -#keyset[aggregate, position] -aggregate_array_init( - int aggregate: @aggregateliteral ref, - int initializer: @expr ref, - int element_index: int ref, - int position: int ref -); - -@ctorinit = @ctordirectinit - | @ctorvirtualinit - | @ctorfieldinit - | @ctordelegatinginit; -@dtordestruct = @dtordirectdestruct - | @dtorvirtualdestruct - | @dtorfielddestruct; - - -condition_decl_bind( - unique int expr: @condition_decl ref, - unique int decl: @declaration ref -); - -typeid_bind( - unique int expr: @type_id ref, - int type_id: @type ref -); - -uuidof_bind( - unique int expr: @uuidof ref, - int type_id: @type ref -); - -@runtime_sizeof_or_alignof = @runtime_sizeof | @runtime_alignof | @datasizeof; - -sizeof_bind( - unique int expr: @runtime_sizeof_or_alignof ref, - int type_id: @type ref -); - -code_block( - unique int block: @literal ref, - unique int routine: @function ref -); - -lambdas( - unique int expr: @lambdaexpr ref, - string default_capture: string ref, - boolean has_explicit_return_type: boolean ref -); - -lambda_capture( - unique int id: @lambdacapture, - int lambda: @lambdaexpr ref, - int index: int ref, - int field: @membervariable ref, - boolean captured_by_reference: boolean ref, - boolean is_implicit: boolean ref, - int location: @location_default ref -); - -@funbindexpr = @routineexpr - | @new_expr - | @delete_expr - | @delete_array_expr - | @ctordirectinit - | @ctorvirtualinit - | @ctordelegatinginit - | @dtordirectdestruct - | @dtorvirtualdestruct; - -@varbindexpr = @varaccess | @ctorfieldinit | @dtorfielddestruct; -@addressable = @function | @variable ; -@accessible = @addressable | @enumconstant ; - -@access = @varaccess | @routineexpr ; - -fold( - int expr: @foldexpr ref, - string operator: string ref, - boolean is_left_fold: boolean ref -); - -stmts( - unique int id: @stmt, - int kind: int ref, - int location: @location_stmt ref -); - -case @stmt.kind of - 1 = @stmt_expr -| 2 = @stmt_if -| 3 = @stmt_while -| 4 = @stmt_goto -| 5 = @stmt_label -| 6 = @stmt_return -| 7 = @stmt_block -| 8 = @stmt_end_test_while // do { ... } while ( ... ) -| 9 = @stmt_for -| 10 = @stmt_switch_case -| 11 = @stmt_switch -| 13 = @stmt_asm // "asm" statement or the body of an asm function -| 15 = @stmt_try_block -| 16 = @stmt_microsoft_try // Microsoft -| 17 = @stmt_decl -| 18 = @stmt_set_vla_size // C99 -| 19 = @stmt_vla_decl // C99 -| 25 = @stmt_assigned_goto // GNU -| 26 = @stmt_empty -| 27 = @stmt_continue -| 28 = @stmt_break -| 29 = @stmt_range_based_for // C++11 -// ... 30 @stmt_at_autoreleasepool_block deprecated -// ... 31 @stmt_objc_for_in deprecated -// ... 32 @stmt_at_synchronized deprecated -| 33 = @stmt_handler -// ... 34 @stmt_finally_end deprecated -| 35 = @stmt_constexpr_if -| 37 = @stmt_co_return -; - -type_vla( - int type_id: @type ref, - int decl: @stmt_vla_decl ref -); - -variable_vla( - int var: @variable ref, - int decl: @stmt_vla_decl ref -); - -if_initialization( - unique int if_stmt: @stmt_if ref, - int init_id: @stmt ref -); - -if_then( - unique int if_stmt: @stmt_if ref, - int then_id: @stmt ref -); - -if_else( - unique int if_stmt: @stmt_if ref, - int else_id: @stmt ref -); - -constexpr_if_initialization( - unique int constexpr_if_stmt: @stmt_constexpr_if ref, - int init_id: @stmt ref -); - -constexpr_if_then( - unique int constexpr_if_stmt: @stmt_constexpr_if ref, - int then_id: @stmt ref -); - -constexpr_if_else( - unique int constexpr_if_stmt: @stmt_constexpr_if ref, - int else_id: @stmt ref -); - -while_body( - unique int while_stmt: @stmt_while ref, - int body_id: @stmt ref -); - -do_body( - unique int do_stmt: @stmt_end_test_while ref, - int body_id: @stmt ref -); - -switch_initialization( - unique int switch_stmt: @stmt_switch ref, - int init_id: @stmt ref -); - -#keyset[switch_stmt, index] -switch_case( - int switch_stmt: @stmt_switch ref, - int index: int ref, - int case_id: @stmt_switch_case ref -); - -switch_body( - unique int switch_stmt: @stmt_switch ref, - int body_id: @stmt ref -); - -@stmt_for_or_range_based_for = @stmt_for - | @stmt_range_based_for; - -for_initialization( - unique int for_stmt: @stmt_for_or_range_based_for ref, - int init_id: @stmt ref -); - -for_condition( - unique int for_stmt: @stmt_for ref, - int condition_id: @expr ref -); - -for_update( - unique int for_stmt: @stmt_for ref, - int update_id: @expr ref -); - -for_body( - unique int for_stmt: @stmt_for ref, - int body_id: @stmt ref -); - -@stmtparent = @stmt | @expr_stmt ; -stmtparents( - unique int id: @stmt ref, - int index: int ref, - int parent: @stmtparent ref -); - -ishandler(unique int block: @stmt_block ref); - -@cfgnode = @stmt | @expr | @function | @initialiser ; - -stmt_decl_bind( - int stmt: @stmt_decl ref, - int num: int ref, - int decl: @declaration ref -); - -stmt_decl_entry_bind( - int stmt: @stmt_decl ref, - int num: int ref, - int decl_entry: @element ref -); - -@parameterized_element = @function | @stmt_block | @requires_expr; - -blockscope( - unique int block: @stmt_block ref, - int enclosing: @parameterized_element ref -); - -@jump = @stmt_goto | @stmt_break | @stmt_continue; - -@jumporlabel = @jump | @stmt_label | @literal; - -jumpinfo( - unique int id: @jumporlabel ref, - string str: string ref, - int target: @stmt ref -); - -preprocdirects( - unique int id: @preprocdirect, - int kind: int ref, - int location: @location_default ref -); -case @preprocdirect.kind of - 0 = @ppd_if -| 1 = @ppd_ifdef -| 2 = @ppd_ifndef -| 3 = @ppd_elif -| 4 = @ppd_else -| 5 = @ppd_endif -| 6 = @ppd_plain_include -| 7 = @ppd_define -| 8 = @ppd_undef -| 9 = @ppd_line -| 10 = @ppd_error -| 11 = @ppd_pragma -| 12 = @ppd_objc_import -| 13 = @ppd_include_next -| 18 = @ppd_warning -; - -@ppd_include = @ppd_plain_include | @ppd_objc_import | @ppd_include_next; - -@ppd_branch = @ppd_if | @ppd_ifdef | @ppd_ifndef | @ppd_elif; - -preprocpair( - int begin : @ppd_branch ref, - int elseelifend : @preprocdirect ref -); - -preproctrue(int branch : @ppd_branch ref); -preprocfalse(int branch : @ppd_branch ref); - -preproctext( - unique int id: @preprocdirect ref, - string head: string ref, - string body: string ref -); - -includes( - unique int id: @ppd_include ref, - int included: @file ref -); - -link_targets( - int id: @link_target, - int binary: @file ref -); - -link_parent( - int element : @element ref, - int link_target : @link_target ref -); - -/* XML Files */ - -xmlEncoding(unique int id: @file ref, string encoding: string ref); - -xmlDTDs( - unique int id: @xmldtd, - string root: string ref, - string publicId: string ref, - string systemId: string ref, - int fileid: @file ref -); - -xmlElements( - unique int id: @xmlelement, - string name: string ref, - int parentid: @xmlparent ref, - int idx: int ref, - int fileid: @file ref -); - -xmlAttrs( - unique int id: @xmlattribute, - int elementid: @xmlelement ref, - string name: string ref, - string value: string ref, - int idx: int ref, - int fileid: @file ref -); - -xmlNs( - int id: @xmlnamespace, - string prefixName: string ref, - string URI: string ref, - int fileid: @file ref -); - -xmlHasNs( - int elementId: @xmlnamespaceable ref, - int nsId: @xmlnamespace ref, - int fileid: @file ref -); - -xmlComments( - unique int id: @xmlcomment, - string text: string ref, - int parentid: @xmlparent ref, - int fileid: @file ref -); - -xmlChars( - unique int id: @xmlcharacters, - string text: string ref, - int parentid: @xmlparent ref, - int idx: int ref, - int isCDATA: int ref, - int fileid: @file ref -); - -@xmlparent = @file | @xmlelement; -@xmlnamespaceable = @xmlelement | @xmlattribute; - -xmllocations( - int xmlElement: @xmllocatable ref, - int location: @location_default ref -); - -@xmllocatable = @xmlcharacters - | @xmlelement - | @xmlcomment - | @xmlattribute - | @xmldtd - | @file - | @xmlnamespace; diff --git a/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/semmlecode.cpp.dbscheme b/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/semmlecode.cpp.dbscheme deleted file mode 100644 index e51fad7a243..00000000000 --- a/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/semmlecode.cpp.dbscheme +++ /dev/null @@ -1,2323 +0,0 @@ - -/** - * An invocation of the compiler. Note that more than one file may be - * compiled per invocation. For example, this command compiles three - * source files: - * - * gcc -c f1.c f2.c f3.c - * - * The `id` simply identifies the invocation, while `cwd` is the working - * directory from which the compiler was invoked. - */ -compilations( - /** - * An invocation of the compiler. Note that more than one file may - * be compiled per invocation. For example, this command compiles - * three source files: - * - * gcc -c f1.c f2.c f3.c - */ - unique int id : @compilation, - string cwd : string ref -); - -/** - * The arguments that were passed to the extractor for a compiler - * invocation. If `id` is for the compiler invocation - * - * gcc -c f1.c f2.c f3.c - * - * then typically there will be rows for - * - * num | arg - * --- | --- - * 0 | *path to extractor* - * 1 | `--mimic` - * 2 | `/usr/bin/gcc` - * 3 | `-c` - * 4 | f1.c - * 5 | f2.c - * 6 | f3.c - */ -#keyset[id, num] -compilation_args( - int id : @compilation ref, - int num : int ref, - string arg : string ref -); - -/** - * The source files that are compiled by a compiler invocation. - * If `id` is for the compiler invocation - * - * gcc -c f1.c f2.c f3.c - * - * then there will be rows for - * - * num | arg - * --- | --- - * 0 | f1.c - * 1 | f2.c - * 2 | f3.c - * - * Note that even if those files `#include` headers, those headers - * do not appear as rows. - */ -#keyset[id, num] -compilation_compiling_files( - int id : @compilation ref, - int num : int ref, - int file : @file ref -); - -/** - * The time taken by the extractor for a compiler invocation. - * - * For each file `num`, there will be rows for - * - * kind | seconds - * ---- | --- - * 1 | CPU seconds used by the extractor frontend - * 2 | Elapsed seconds during the extractor frontend - * 3 | CPU seconds used by the extractor backend - * 4 | Elapsed seconds during the extractor backend - */ -#keyset[id, num, kind] -compilation_time( - int id : @compilation ref, - int num : int ref, - /* kind: - 1 = frontend_cpu_seconds - 2 = frontend_elapsed_seconds - 3 = extractor_cpu_seconds - 4 = extractor_elapsed_seconds - */ - int kind : int ref, - float seconds : float ref -); - -/** - * An error or warning generated by the extractor. - * The diagnostic message `diagnostic` was generated during compiler - * invocation `compilation`, and is the `file_number_diagnostic_number`th - * message generated while extracting the `file_number`th file of that - * invocation. - */ -#keyset[compilation, file_number, file_number_diagnostic_number] -diagnostic_for( - int diagnostic : @diagnostic ref, - int compilation : @compilation ref, - int file_number : int ref, - int file_number_diagnostic_number : int ref -); - -/** - * If extraction was successful, then `cpu_seconds` and - * `elapsed_seconds` are the CPU time and elapsed time (respectively) - * that extraction took for compiler invocation `id`. - */ -compilation_finished( - unique int id : @compilation ref, - float cpu_seconds : float ref, - float elapsed_seconds : float ref -); - - -/** - * External data, loaded from CSV files during snapshot creation. See - * [Tutorial: Incorporating external data](https://help.semmle.com/wiki/display/SD/Tutorial%3A+Incorporating+external+data) - * for more information. - */ -externalData( - int id : @externalDataElement, - string path : string ref, - int column: int ref, - string value : string ref -); - -/** - * The source location of the snapshot. - */ -sourceLocationPrefix(string prefix : string ref); - -/** - * Information about packages that provide code used during compilation. - * The `id` is just a unique identifier. - * The `namespace` is typically the name of the package manager that - * provided the package (e.g. "dpkg" or "yum"). - * The `package_name` is the name of the package, and `version` is its - * version (as a string). - */ -external_packages( - unique int id: @external_package, - string namespace : string ref, - string package_name : string ref, - string version : string ref -); - -/** - * Holds if File `fileid` was provided by package `package`. - */ -header_to_external_package( - int fileid : @file ref, - int package : @external_package ref -); - -/* - * Version history - */ - -svnentries( - unique int id : @svnentry, - string revision : string ref, - string author : string ref, - date revisionDate : date ref, - int changeSize : int ref -) - -svnaffectedfiles( - int id : @svnentry ref, - int file : @file ref, - string action : string ref -) - -svnentrymsg( - unique int id : @svnentry ref, - string message : string ref -) - -svnchurn( - int commit : @svnentry ref, - int file : @file ref, - int addedLines : int ref, - int deletedLines : int ref -) - -/* - * C++ dbscheme - */ - -extractor_version( - string codeql_version: string ref, - string frontend_version: string ref -) - -@location = @location_stmt | @location_expr | @location_default ; - -/** - * The location of an element that is not an expression or a statement. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `file`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ -locations_default( - /** The location of an element that is not an expression or a statement. */ - unique int id: @location_default, - int container: @container ref, - int startLine: int ref, - int startColumn: int ref, - int endLine: int ref, - int endColumn: int ref -); - -/** - * The location of a statement. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `file`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ -locations_stmt( - /** The location of a statement. */ - unique int id: @location_stmt, - int container: @container ref, - int startLine: int ref, - int startColumn: int ref, - int endLine: int ref, - int endColumn: int ref -); - -/** - * The location of an expression. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `file`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ -locations_expr( - /** The location of an expression. */ - unique int id: @location_expr, - int container: @container ref, - int startLine: int ref, - int startColumn: int ref, - int endLine: int ref, - int endColumn: int ref -); - -/** An element for which line-count information is available. */ -@sourceline = @file | @function | @variable | @enumconstant | @xmllocatable; - -numlines( - int element_id: @sourceline ref, - int num_lines: int ref, - int num_code: int ref, - int num_comment: int ref -); - -diagnostics( - unique int id: @diagnostic, - int severity: int ref, - string error_tag: string ref, - string error_message: string ref, - string full_error_message: string ref, - int location: @location_default ref -); - -files( - unique int id: @file, - string name: string ref -); - -folders( - unique int id: @folder, - string name: string ref -); - -@container = @folder | @file - -containerparent( - int parent: @container ref, - unique int child: @container ref -); - -fileannotations( - int id: @file ref, - int kind: int ref, - string name: string ref, - string value: string ref -); - -inmacroexpansion( - int id: @element ref, - int inv: @macroinvocation ref -); - -affectedbymacroexpansion( - int id: @element ref, - int inv: @macroinvocation ref -); - -case @macroinvocation.kind of - 1 = @macro_expansion -| 2 = @other_macro_reference -; - -macroinvocations( - unique int id: @macroinvocation, - int macro_id: @ppd_define ref, - int location: @location_default ref, - int kind: int ref -); - -macroparent( - unique int id: @macroinvocation ref, - int parent_id: @macroinvocation ref -); - -// a macroinvocation may be part of another location -// the way to find a constant expression that uses a macro -// is thus to find a constant expression that has a location -// to which a macro invocation is bound -macrolocationbind( - int id: @macroinvocation ref, - int location: @location ref -); - -#keyset[invocation, argument_index] -macro_argument_unexpanded( - int invocation: @macroinvocation ref, - int argument_index: int ref, - string text: string ref -); - -#keyset[invocation, argument_index] -macro_argument_expanded( - int invocation: @macroinvocation ref, - int argument_index: int ref, - string text: string ref -); - -/* -case @function.kind of - 1 = @normal_function -| 2 = @constructor -| 3 = @destructor -| 4 = @conversion_function -| 5 = @operator -| 6 = @builtin_function // GCC built-in functions, e.g. __builtin___memcpy_chk -| 7 = @user_defined_literal -| 8 = @deduction_guide -; -*/ - -functions( - unique int id: @function, - string name: string ref, - int kind: int ref -); - -function_entry_point( - int id: @function ref, - unique int entry_point: @stmt ref -); - -function_return_type( - int id: @function ref, - int return_type: @type ref -); - -/** - * If `function` is a coroutine, then this gives the `std::experimental::resumable_traits` - * instance associated with it, and the variables representing the `handle` and `promise` - * for it. - */ -coroutine( - unique int function: @function ref, - int traits: @type ref -); - -/* -case @coroutine_placeholder_variable.kind of - 1 = @handle -| 2 = @promise -| 3 = @init_await_resume -; -*/ - -coroutine_placeholder_variable( - unique int placeholder_variable: @variable ref, - int kind: int ref, - int function: @function ref -) - -/** The `new` function used for allocating the coroutine state, if any. */ -coroutine_new( - unique int function: @function ref, - int new: @function ref -); - -/** The `delete` function used for deallocating the coroutine state, if any. */ -coroutine_delete( - unique int function: @function ref, - int delete: @function ref -); - -purefunctions(unique int id: @function ref); - -function_deleted(unique int id: @function ref); - -function_defaulted(unique int id: @function ref); - -function_prototyped(unique int id: @function ref) - -deduction_guide_for_class( - int id: @function ref, - int class_template: @usertype ref -) - -member_function_this_type( - unique int id: @function ref, - int this_type: @type ref -); - -#keyset[id, type_id] -fun_decls( - int id: @fun_decl, - int function: @function ref, - int type_id: @type ref, - string name: string ref, - int location: @location_default ref -); -fun_def(unique int id: @fun_decl ref); -fun_specialized(unique int id: @fun_decl ref); -fun_implicit(unique int id: @fun_decl ref); -fun_decl_specifiers( - int id: @fun_decl ref, - string name: string ref -) -#keyset[fun_decl, index] -fun_decl_throws( - int fun_decl: @fun_decl ref, - int index: int ref, - int type_id: @type ref -); -/* an empty throw specification is different from none */ -fun_decl_empty_throws(unique int fun_decl: @fun_decl ref); -fun_decl_noexcept( - int fun_decl: @fun_decl ref, - int constant: @expr ref -); -fun_decl_empty_noexcept(int fun_decl: @fun_decl ref); -fun_decl_typedef_type( - unique int fun_decl: @fun_decl ref, - int typedeftype_id: @usertype ref -); - -param_decl_bind( - unique int id: @var_decl ref, - int index: int ref, - int fun_decl: @fun_decl ref -); - -#keyset[id, type_id] -var_decls( - int id: @var_decl, - int variable: @variable ref, - int type_id: @type ref, - string name: string ref, - int location: @location_default ref -); -var_def(unique int id: @var_decl ref); -var_decl_specifiers( - int id: @var_decl ref, - string name: string ref -) -is_structured_binding(unique int id: @variable ref); - -type_decls( - unique int id: @type_decl, - int type_id: @type ref, - int location: @location_default ref -); -type_def(unique int id: @type_decl ref); -type_decl_top( - unique int type_decl: @type_decl ref -); - -namespace_decls( - unique int id: @namespace_decl, - int namespace_id: @namespace ref, - int location: @location_default ref, - int bodylocation: @location_default ref -); - -case @using.kind of - 1 = @using_declaration -| 2 = @using_directive -| 3 = @using_enum_declaration -; - -usings( - unique int id: @using, - int element_id: @element ref, - int location: @location_default ref, - int kind: int ref -); - -/** The element which contains the `using` declaration. */ -using_container( - int parent: @element ref, - int child: @using ref -); - -static_asserts( - unique int id: @static_assert, - int condition : @expr ref, - string message : string ref, - int location: @location_default ref, - int enclosing : @element ref -); - -// each function has an ordered list of parameters -#keyset[id, type_id] -#keyset[function, index, type_id] -params( - int id: @parameter, - int function: @parameterized_element ref, - int index: int ref, - int type_id: @type ref -); - -overrides( - int new: @function ref, - int old: @function ref -); - -#keyset[id, type_id] -membervariables( - int id: @membervariable, - int type_id: @type ref, - string name: string ref -); - -#keyset[id, type_id] -globalvariables( - int id: @globalvariable, - int type_id: @type ref, - string name: string ref -); - -#keyset[id, type_id] -localvariables( - int id: @localvariable, - int type_id: @type ref, - string name: string ref -); - -autoderivation( - unique int var: @variable ref, - int derivation_type: @type ref -); - -orphaned_variables( - int var: @localvariable ref, - int function: @function ref -) - -enumconstants( - unique int id: @enumconstant, - int parent: @usertype ref, - int index: int ref, - int type_id: @type ref, - string name: string ref, - int location: @location_default ref -); - -@variable = @localscopevariable | @globalvariable | @membervariable; - -@localscopevariable = @localvariable | @parameter; - -/** - * Built-in types are the fundamental types, e.g., integral, floating, and void. - */ -case @builtintype.kind of - 1 = @errortype -| 2 = @unknowntype -| 3 = @void -| 4 = @boolean -| 5 = @char -| 6 = @unsigned_char -| 7 = @signed_char -| 8 = @short -| 9 = @unsigned_short -| 10 = @signed_short -| 11 = @int -| 12 = @unsigned_int -| 13 = @signed_int -| 14 = @long -| 15 = @unsigned_long -| 16 = @signed_long -| 17 = @long_long -| 18 = @unsigned_long_long -| 19 = @signed_long_long -// ... 20 Microsoft-specific __int8 -// ... 21 Microsoft-specific __int16 -// ... 22 Microsoft-specific __int32 -// ... 23 Microsoft-specific __int64 -| 24 = @float -| 25 = @double -| 26 = @long_double -| 27 = @complex_float // C99-specific _Complex float -| 28 = @complex_double // C99-specific _Complex double -| 29 = @complex_long_double // C99-specific _Complex long double -| 30 = @imaginary_float // C99-specific _Imaginary float -| 31 = @imaginary_double // C99-specific _Imaginary double -| 32 = @imaginary_long_double // C99-specific _Imaginary long double -| 33 = @wchar_t // Microsoft-specific -| 34 = @decltype_nullptr // C++11 -| 35 = @int128 // __int128 -| 36 = @unsigned_int128 // unsigned __int128 -| 37 = @signed_int128 // signed __int128 -| 38 = @float128 // __float128 -| 39 = @complex_float128 // _Complex __float128 -| 40 = @decimal32 // _Decimal32 -| 41 = @decimal64 // _Decimal64 -| 42 = @decimal128 // _Decimal128 -| 43 = @char16_t -| 44 = @char32_t -| 45 = @std_float32 // _Float32 -| 46 = @float32x // _Float32x -| 47 = @std_float64 // _Float64 -| 48 = @float64x // _Float64x -| 49 = @std_float128 // _Float128 -// ... 50 _Float128x -| 51 = @char8_t -| 52 = @float16 // _Float16 -| 53 = @complex_float16 // _Complex _Float16 -| 54 = @fp16 // __fp16 -| 55 = @std_bfloat16 // __bf16 -| 56 = @std_float16 // std::float16_t -| 57 = @complex_std_float32 // _Complex _Float32 -| 58 = @complex_float32x // _Complex _Float32x -| 59 = @complex_std_float64 // _Complex _Float64 -| 60 = @complex_float64x // _Complex _Float64x -| 61 = @complex_std_float128 // _Complex _Float128 -; - -builtintypes( - unique int id: @builtintype, - string name: string ref, - int kind: int ref, - int size: int ref, - int sign: int ref, - int alignment: int ref -); - -/** - * Derived types are types that are directly derived from existing types and - * point to, refer to, transform type data to return a new type. - */ -case @derivedtype.kind of - 1 = @pointer -| 2 = @reference -| 3 = @type_with_specifiers -| 4 = @array -| 5 = @gnu_vector -| 6 = @routineptr -| 7 = @routinereference -| 8 = @rvalue_reference // C++11 -// ... 9 type_conforming_to_protocols deprecated -| 10 = @block -; - -derivedtypes( - unique int id: @derivedtype, - string name: string ref, - int kind: int ref, - int type_id: @type ref -); - -pointerishsize(unique int id: @derivedtype ref, - int size: int ref, - int alignment: int ref); - -arraysizes( - unique int id: @derivedtype ref, - int num_elements: int ref, - int bytesize: int ref, - int alignment: int ref -); - -typedefbase( - unique int id: @usertype ref, - int type_id: @type ref -); - -/** - * An instance of the C++11 `decltype` operator. For example: - * ``` - * int a; - * decltype(1+a) b; - * ``` - * Here `expr` is `1+a`. - * - * Sometimes an additional pair of parentheses around the expression - * would change the semantics of this decltype, e.g. - * ``` - * struct A { double x; }; - * const A* a = new A(); - * decltype( a->x ); // type is double - * decltype((a->x)); // type is const double& - * ``` - * (Please consult the C++11 standard for more details). - * `parentheses_would_change_meaning` is `true` iff that is the case. - */ -#keyset[id, expr] -decltypes( - int id: @decltype, - int expr: @expr ref, - int base_type: @type ref, - boolean parentheses_would_change_meaning: boolean ref -); - -/* -case @usertype.kind of - 1 = @struct -| 2 = @class -| 3 = @union -| 4 = @enum -| 5 = @typedef // classic C: typedef typedef type name -| 6 = @template -| 7 = @template_parameter -| 8 = @template_template_parameter -| 9 = @proxy_class // a proxy class associated with a template parameter -// ... 10 objc_class deprecated -// ... 11 objc_protocol deprecated -// ... 12 objc_category deprecated -| 13 = @scoped_enum -| 14 = @using_alias // a using name = type style typedef -; -*/ - -usertypes( - unique int id: @usertype, - string name: string ref, - int kind: int ref -); - -usertypesize( - unique int id: @usertype ref, - int size: int ref, - int alignment: int ref -); - -usertype_final(unique int id: @usertype ref); - -usertype_uuid( - unique int id: @usertype ref, - string uuid: string ref -); - -mangled_name( - unique int id: @declaration ref, - int mangled_name : @mangledname, - boolean is_complete: boolean ref -); - -is_pod_class(unique int id: @usertype ref); -is_standard_layout_class(unique int id: @usertype ref); - -is_complete(unique int id: @usertype ref); - -is_class_template(unique int id: @usertype ref); -class_instantiation( - int to: @usertype ref, - int from: @usertype ref -); -class_template_argument( - int type_id: @usertype ref, - int index: int ref, - int arg_type: @type ref -); -class_template_argument_value( - int type_id: @usertype ref, - int index: int ref, - int arg_value: @expr ref -); - -is_proxy_class_for( - unique int id: @usertype ref, - unique int templ_param_id: @usertype ref -); - -type_mentions( - unique int id: @type_mention, - int type_id: @type ref, - int location: @location ref, - // a_symbol_reference_kind from the frontend. - int kind: int ref -); - -is_function_template(unique int id: @function ref); -function_instantiation( - unique int to: @function ref, - int from: @function ref -); -function_template_argument( - int function_id: @function ref, - int index: int ref, - int arg_type: @type ref -); -function_template_argument_value( - int function_id: @function ref, - int index: int ref, - int arg_value: @expr ref -); - -is_variable_template(unique int id: @variable ref); -variable_instantiation( - unique int to: @variable ref, - int from: @variable ref -); -variable_template_argument( - int variable_id: @variable ref, - int index: int ref, - int arg_type: @type ref -); -variable_template_argument_value( - int variable_id: @variable ref, - int index: int ref, - int arg_value: @expr ref -); - -routinetypes( - unique int id: @routinetype, - int return_type: @type ref -); - -routinetypeargs( - int routine: @routinetype ref, - int index: int ref, - int type_id: @type ref -); - -ptrtomembers( - unique int id: @ptrtomember, - int type_id: @type ref, - int class_id: @type ref -); - -/* - specifiers for types, functions, and variables - - "public", - "protected", - "private", - - "const", - "volatile", - "static", - - "pure", - "virtual", - "sealed", // Microsoft - "__interface", // Microsoft - "inline", - "explicit", - - "near", // near far extension - "far", // near far extension - "__ptr32", // Microsoft - "__ptr64", // Microsoft - "__sptr", // Microsoft - "__uptr", // Microsoft - "dllimport", // Microsoft - "dllexport", // Microsoft - "thread", // Microsoft - "naked", // Microsoft - "microsoft_inline", // Microsoft - "forceinline", // Microsoft - "selectany", // Microsoft - "nothrow", // Microsoft - "novtable", // Microsoft - "noreturn", // Microsoft - "noinline", // Microsoft - "noalias", // Microsoft - "restrict", // Microsoft -*/ - -specifiers( - unique int id: @specifier, - unique string str: string ref -); - -typespecifiers( - int type_id: @type ref, - int spec_id: @specifier ref -); - -funspecifiers( - int func_id: @function ref, - int spec_id: @specifier ref -); - -varspecifiers( - int var_id: @accessible ref, - int spec_id: @specifier ref -); - -explicit_specifier_exprs( - unique int func_id: @function ref, - int constant: @expr ref -) - -attributes( - unique int id: @attribute, - int kind: int ref, - string name: string ref, - string name_space: string ref, - int location: @location_default ref -); - -case @attribute.kind of - 0 = @gnuattribute -| 1 = @stdattribute -| 2 = @declspec -| 3 = @msattribute -| 4 = @alignas -// ... 5 @objc_propertyattribute deprecated -; - -attribute_args( - unique int id: @attribute_arg, - int kind: int ref, - int attribute: @attribute ref, - int index: int ref, - int location: @location_default ref -); - -case @attribute_arg.kind of - 0 = @attribute_arg_empty -| 1 = @attribute_arg_token -| 2 = @attribute_arg_constant -| 3 = @attribute_arg_type -| 4 = @attribute_arg_constant_expr -| 5 = @attribute_arg_expr -; - -attribute_arg_value( - unique int arg: @attribute_arg ref, - string value: string ref -); -attribute_arg_type( - unique int arg: @attribute_arg ref, - int type_id: @type ref -); -attribute_arg_constant( - unique int arg: @attribute_arg ref, - int constant: @expr ref -) -attribute_arg_expr( - unique int arg: @attribute_arg ref, - int expr: @expr ref -) -attribute_arg_name( - unique int arg: @attribute_arg ref, - string name: string ref -); - -typeattributes( - int type_id: @type ref, - int spec_id: @attribute ref -); - -funcattributes( - int func_id: @function ref, - int spec_id: @attribute ref -); - -varattributes( - int var_id: @accessible ref, - int spec_id: @attribute ref -); - -stmtattributes( - int stmt_id: @stmt ref, - int spec_id: @attribute ref -); - -@type = @builtintype - | @derivedtype - | @usertype - /* TODO | @fixedpointtype */ - | @routinetype - | @ptrtomember - | @decltype; - -unspecifiedtype( - unique int type_id: @type ref, - int unspecified_type_id: @type ref -); - -member( - int parent: @type ref, - int index: int ref, - int child: @member ref -); - -@enclosingfunction_child = @usertype | @variable | @namespace - -enclosingfunction( - unique int child: @enclosingfunction_child ref, - int parent: @function ref -); - -derivations( - unique int derivation: @derivation, - int sub: @type ref, - int index: int ref, - int super: @type ref, - int location: @location_default ref -); - -derspecifiers( - int der_id: @derivation ref, - int spec_id: @specifier ref -); - -/** - * Contains the byte offset of the base class subobject within the derived - * class. Only holds for non-virtual base classes, but see table - * `virtual_base_offsets` for offsets of virtual base class subobjects. - */ -direct_base_offsets( - unique int der_id: @derivation ref, - int offset: int ref -); - -/** - * Contains the byte offset of the virtual base class subobject for class - * `super` within a most-derived object of class `sub`. `super` can be either a - * direct or indirect base class. - */ -#keyset[sub, super] -virtual_base_offsets( - int sub: @usertype ref, - int super: @usertype ref, - int offset: int ref -); - -frienddecls( - unique int id: @frienddecl, - int type_id: @type ref, - int decl_id: @declaration ref, - int location: @location_default ref -); - -@declaredtype = @usertype ; - -@declaration = @function - | @declaredtype - | @variable - | @enumconstant - | @frienddecl; - -@member = @membervariable - | @function - | @declaredtype - | @enumconstant; - -@locatable = @diagnostic - | @declaration - | @ppd_include - | @ppd_define - | @macroinvocation - /*| @funcall*/ - | @xmllocatable - | @attribute - | @attribute_arg; - -@namedscope = @namespace | @usertype; - -@element = @locatable - | @file - | @folder - | @specifier - | @type - | @expr - | @namespace - | @initialiser - | @stmt - | @derivation - | @comment - | @preprocdirect - | @fun_decl - | @var_decl - | @type_decl - | @namespace_decl - | @using - | @namequalifier - | @specialnamequalifyingelement - | @static_assert - | @type_mention - | @lambdacapture; - -@exprparent = @element; - -comments( - unique int id: @comment, - string contents: string ref, - int location: @location_default ref -); - -commentbinding( - int id: @comment ref, - int element: @element ref -); - -exprconv( - int converted: @expr ref, - unique int conversion: @expr ref -); - -compgenerated(unique int id: @element ref); - -/** - * `destructor_call` destructs the `i`'th entity that should be - * destructed following `element`. Note that entities should be - * destructed in reverse construction order, so for a given `element` - * these should be called from highest to lowest `i`. - */ -#keyset[element, destructor_call] -#keyset[element, i] -synthetic_destructor_call( - int element: @element ref, - int i: int ref, - int destructor_call: @routineexpr ref -); - -namespaces( - unique int id: @namespace, - string name: string ref -); - -namespace_inline( - unique int id: @namespace ref -); - -namespacembrs( - int parentid: @namespace ref, - unique int memberid: @namespacembr ref -); - -@namespacembr = @declaration | @namespace; - -exprparents( - int expr_id: @expr ref, - int child_index: int ref, - int parent_id: @exprparent ref -); - -expr_isload(unique int expr_id: @expr ref); - -@cast = @c_style_cast - | @const_cast - | @dynamic_cast - | @reinterpret_cast - | @static_cast - ; - -/* -case @conversion.kind of - 0 = @simple_conversion // a numeric conversion, qualification conversion, or a reinterpret_cast -| 1 = @bool_conversion // conversion to 'bool' -| 2 = @base_class_conversion // a derived-to-base conversion -| 3 = @derived_class_conversion // a base-to-derived conversion -| 4 = @pm_base_class_conversion // a derived-to-base conversion of a pointer to member -| 5 = @pm_derived_class_conversion // a base-to-derived conversion of a pointer to member -| 6 = @glvalue_adjust // an adjustment of the type of a glvalue -| 7 = @prvalue_adjust // an adjustment of the type of a prvalue -; -*/ -/** - * Describes the semantics represented by a cast expression. This is largely - * independent of the source syntax of the cast, so it is separate from the - * regular expression kind. - */ -conversionkinds( - unique int expr_id: @cast ref, - int kind: int ref -); - -@conversion = @cast - | @array_to_pointer - | @parexpr - | @reference_to - | @ref_indirect - | @temp_init - | @c11_generic - ; - -/* -case @funbindexpr.kind of - 0 = @normal_call // a normal call -| 1 = @virtual_call // a virtual call -| 2 = @adl_call // a call whose target is only found by ADL -; -*/ -iscall( - unique int caller: @funbindexpr ref, - int kind: int ref -); - -numtemplatearguments( - unique int expr_id: @expr ref, - int num: int ref -); - -specialnamequalifyingelements( - unique int id: @specialnamequalifyingelement, - unique string name: string ref -); - -@namequalifiableelement = @expr | @namequalifier; -@namequalifyingelement = @namespace - | @specialnamequalifyingelement - | @usertype; - -namequalifiers( - unique int id: @namequalifier, - unique int qualifiableelement: @namequalifiableelement ref, - int qualifyingelement: @namequalifyingelement ref, - int location: @location_default ref -); - -varbind( - int expr: @varbindexpr ref, - int var: @accessible ref -); - -funbind( - int expr: @funbindexpr ref, - int fun: @function ref -); - -@any_new_expr = @new_expr - | @new_array_expr; - -@new_or_delete_expr = @any_new_expr - | @delete_expr - | @delete_array_expr; - -@prefix_crement_expr = @preincrexpr | @predecrexpr; - -@postfix_crement_expr = @postincrexpr | @postdecrexpr; - -@increment_expr = @preincrexpr | @postincrexpr; - -@decrement_expr = @predecrexpr | @postdecrexpr; - -@crement_expr = @increment_expr | @decrement_expr; - -@un_arith_op_expr = @arithnegexpr - | @unaryplusexpr - | @conjugation - | @realpartexpr - | @imagpartexpr - | @crement_expr - ; - -@un_bitwise_op_expr = @complementexpr; - -@un_log_op_expr = @notexpr; - -@un_op_expr = @address_of - | @indirect - | @un_arith_op_expr - | @un_bitwise_op_expr - | @builtinaddressof - | @vec_fill - | @un_log_op_expr - | @co_await - | @co_yield - ; - -@bin_log_op_expr = @andlogicalexpr | @orlogicalexpr; - -@cmp_op_expr = @eq_op_expr | @rel_op_expr; - -@eq_op_expr = @eqexpr | @neexpr; - -@rel_op_expr = @gtexpr - | @ltexpr - | @geexpr - | @leexpr - | @spaceshipexpr - ; - -@bin_bitwise_op_expr = @lshiftexpr - | @rshiftexpr - | @andexpr - | @orexpr - | @xorexpr - ; - -@p_arith_op_expr = @paddexpr - | @psubexpr - | @pdiffexpr - ; - -@bin_arith_op_expr = @addexpr - | @subexpr - | @mulexpr - | @divexpr - | @remexpr - | @jmulexpr - | @jdivexpr - | @fjaddexpr - | @jfaddexpr - | @fjsubexpr - | @jfsubexpr - | @minexpr - | @maxexpr - | @p_arith_op_expr - ; - -@bin_op_expr = @bin_arith_op_expr - | @bin_bitwise_op_expr - | @cmp_op_expr - | @bin_log_op_expr - ; - -@op_expr = @un_op_expr - | @bin_op_expr - | @assign_expr - | @conditionalexpr - ; - -@assign_arith_expr = @assignaddexpr - | @assignsubexpr - | @assignmulexpr - | @assigndivexpr - | @assignremexpr - ; - -@assign_bitwise_expr = @assignandexpr - | @assignorexpr - | @assignxorexpr - | @assignlshiftexpr - | @assignrshiftexpr - ; - -@assign_pointer_expr = @assignpaddexpr - | @assignpsubexpr - ; - -@assign_op_expr = @assign_arith_expr - | @assign_bitwise_expr - | @assign_pointer_expr - ; - -@assign_expr = @assignexpr | @assign_op_expr | @blockassignexpr - -/* - Binary encoding of the allocator form. - - case @allocator.form of - 0 = plain - | 1 = alignment - ; -*/ - -/** - * The allocator function associated with a `new` or `new[]` expression. - * The `form` column specified whether the allocation call contains an alignment - * argument. - */ -expr_allocator( - unique int expr: @any_new_expr ref, - int func: @function ref, - int form: int ref -); - -/* - Binary encoding of the deallocator form. - - case @deallocator.form of - 0 = plain - | 1 = size - | 2 = alignment - | 4 = destroying_delete - ; -*/ - -/** - * The deallocator function associated with a `delete`, `delete[]`, `new`, or - * `new[]` expression. For a `new` or `new[]` expression, the deallocator is the - * one used to free memory if the initialization throws an exception. - * The `form` column specifies whether the deallocation call contains a size - * argument, and alignment argument, or both. - */ -expr_deallocator( - unique int expr: @new_or_delete_expr ref, - int func: @function ref, - int form: int ref -); - -/** - * Holds if the `@conditionalexpr` is of the two operand form - * `guard ? : false`. - */ -expr_cond_two_operand( - unique int cond: @conditionalexpr ref -); - -/** - * The guard of `@conditionalexpr` `guard ? true : false` - */ -expr_cond_guard( - unique int cond: @conditionalexpr ref, - int guard: @expr ref -); - -/** - * The expression used when the guard of `@conditionalexpr` - * `guard ? true : false` holds. For the two operand form - * `guard ?: false` consider using `expr_cond_guard` instead. - */ -expr_cond_true( - unique int cond: @conditionalexpr ref, - int true: @expr ref -); - -/** - * The expression used when the guard of `@conditionalexpr` - * `guard ? true : false` does not hold. - */ -expr_cond_false( - unique int cond: @conditionalexpr ref, - int false: @expr ref -); - -/** A string representation of the value. */ -values( - unique int id: @value, - string str: string ref -); - -/** The actual text in the source code for the value, if any. */ -valuetext( - unique int id: @value ref, - string text: string ref -); - -valuebind( - int val: @value ref, - unique int expr: @expr ref -); - -fieldoffsets( - unique int id: @variable ref, - int byteoffset: int ref, - int bitoffset: int ref -); - -bitfield( - unique int id: @variable ref, - int bits: int ref, - int declared_bits: int ref -); - -/* TODO -memberprefix( - int member: @expr ref, - int prefix: @expr ref -); -*/ - -/* - kind(1) = mbrcallexpr - kind(2) = mbrptrcallexpr - kind(3) = mbrptrmbrcallexpr - kind(4) = ptrmbrptrmbrcallexpr - kind(5) = mbrreadexpr // x.y - kind(6) = mbrptrreadexpr // p->y - kind(7) = mbrptrmbrreadexpr // x.*pm - kind(8) = mbrptrmbrptrreadexpr // x->*pm - kind(9) = staticmbrreadexpr // static x.y - kind(10) = staticmbrptrreadexpr // static p->y -*/ -/* TODO -memberaccess( - int member: @expr ref, - int kind: int ref -); -*/ - -initialisers( - unique int init: @initialiser, - int var: @accessible ref, - unique int expr: @expr ref, - int location: @location_expr ref -); - -braced_initialisers( - int init: @initialiser ref -); - -/** - * An ancestor for the expression, for cases in which we cannot - * otherwise find the expression's parent. - */ -expr_ancestor( - int exp: @expr ref, - int ancestor: @element ref -); - -exprs( - unique int id: @expr, - int kind: int ref, - int location: @location_expr ref -); - -expr_reuse( - int reuse: @expr ref, - int original: @expr ref, - int value_category: int ref -) - -/* - case @value.category of - 1 = prval - | 2 = xval - | 3 = lval - ; -*/ -expr_types( - int id: @expr ref, - int typeid: @type ref, - int value_category: int ref -); - -case @expr.kind of - 1 = @errorexpr -| 2 = @address_of // & AddressOfExpr -| 3 = @reference_to // ReferenceToExpr (implicit?) -| 4 = @indirect // * PointerDereferenceExpr -| 5 = @ref_indirect // ReferenceDereferenceExpr (implicit?) -// ... -| 8 = @array_to_pointer // (???) -| 9 = @vacuous_destructor_call // VacuousDestructorCall -// ... -| 11 = @assume // Microsoft -| 12 = @parexpr -| 13 = @arithnegexpr -| 14 = @unaryplusexpr -| 15 = @complementexpr -| 16 = @notexpr -| 17 = @conjugation // GNU ~ operator -| 18 = @realpartexpr // GNU __real -| 19 = @imagpartexpr // GNU __imag -| 20 = @postincrexpr -| 21 = @postdecrexpr -| 22 = @preincrexpr -| 23 = @predecrexpr -| 24 = @conditionalexpr -| 25 = @addexpr -| 26 = @subexpr -| 27 = @mulexpr -| 28 = @divexpr -| 29 = @remexpr -| 30 = @jmulexpr // C99 mul imaginary -| 31 = @jdivexpr // C99 div imaginary -| 32 = @fjaddexpr // C99 add real + imaginary -| 33 = @jfaddexpr // C99 add imaginary + real -| 34 = @fjsubexpr // C99 sub real - imaginary -| 35 = @jfsubexpr // C99 sub imaginary - real -| 36 = @paddexpr // pointer add (pointer + int or int + pointer) -| 37 = @psubexpr // pointer sub (pointer - integer) -| 38 = @pdiffexpr // difference between two pointers -| 39 = @lshiftexpr -| 40 = @rshiftexpr -| 41 = @andexpr -| 42 = @orexpr -| 43 = @xorexpr -| 44 = @eqexpr -| 45 = @neexpr -| 46 = @gtexpr -| 47 = @ltexpr -| 48 = @geexpr -| 49 = @leexpr -| 50 = @minexpr // GNU minimum -| 51 = @maxexpr // GNU maximum -| 52 = @assignexpr -| 53 = @assignaddexpr -| 54 = @assignsubexpr -| 55 = @assignmulexpr -| 56 = @assigndivexpr -| 57 = @assignremexpr -| 58 = @assignlshiftexpr -| 59 = @assignrshiftexpr -| 60 = @assignandexpr -| 61 = @assignorexpr -| 62 = @assignxorexpr -| 63 = @assignpaddexpr // assign pointer add -| 64 = @assignpsubexpr // assign pointer sub -| 65 = @andlogicalexpr -| 66 = @orlogicalexpr -| 67 = @commaexpr -| 68 = @subscriptexpr // access to member of an array, e.g., a[5] -// ... 69 @objc_subscriptexpr deprecated -// ... 70 @cmdaccess deprecated -// ... -| 73 = @virtfunptrexpr -| 74 = @callexpr -// ... 75 @msgexpr_normal deprecated -// ... 76 @msgexpr_super deprecated -// ... 77 @atselectorexpr deprecated -// ... 78 @atprotocolexpr deprecated -| 79 = @vastartexpr -| 80 = @vaargexpr -| 81 = @vaendexpr -| 82 = @vacopyexpr -// ... 83 @atencodeexpr deprecated -| 84 = @varaccess -| 85 = @thisaccess -// ... 86 @objc_box_expr deprecated -| 87 = @new_expr -| 88 = @delete_expr -| 89 = @throw_expr -| 90 = @condition_decl // a variable declared in a condition, e.g., if(int x = y > 2) -| 91 = @braced_init_list -| 92 = @type_id -| 93 = @runtime_sizeof -| 94 = @runtime_alignof -| 95 = @sizeof_pack -| 96 = @expr_stmt // GNU extension -| 97 = @routineexpr -| 98 = @type_operand // used to access a type in certain contexts (haven't found any examples yet....) -| 99 = @offsetofexpr // offsetof ::= type and field -| 100 = @hasassignexpr // __has_assign ::= type -| 101 = @hascopyexpr // __has_copy ::= type -| 102 = @hasnothrowassign // __has_nothrow_assign ::= type -| 103 = @hasnothrowconstr // __has_nothrow_constructor ::= type -| 104 = @hasnothrowcopy // __has_nothrow_copy ::= type -| 105 = @hastrivialassign // __has_trivial_assign ::= type -| 106 = @hastrivialconstr // __has_trivial_constructor ::= type -| 107 = @hastrivialcopy // __has_trivial_copy ::= type -| 108 = @hasuserdestr // __has_user_destructor ::= type -| 109 = @hasvirtualdestr // __has_virtual_destructor ::= type -| 110 = @isabstractexpr // __is_abstract ::= type -| 111 = @isbaseofexpr // __is_base_of ::= type type -| 112 = @isclassexpr // __is_class ::= type -| 113 = @isconvtoexpr // __is_convertible_to ::= type type -| 114 = @isemptyexpr // __is_empty ::= type -| 115 = @isenumexpr // __is_enum ::= type -| 116 = @ispodexpr // __is_pod ::= type -| 117 = @ispolyexpr // __is_polymorphic ::= type -| 118 = @isunionexpr // __is_union ::= type -| 119 = @typescompexpr // GNU __builtin_types_compatible ::= type type -| 120 = @intaddrexpr // frontend internal builtin, used to implement offsetof -// ... -| 122 = @hastrivialdestructor // __has_trivial_destructor ::= type -| 123 = @literal -| 124 = @uuidof -| 127 = @aggregateliteral -| 128 = @delete_array_expr -| 129 = @new_array_expr -// ... 130 @objc_array_literal deprecated -// ... 131 @objc_dictionary_literal deprecated -| 132 = @foldexpr -// ... -| 200 = @ctordirectinit -| 201 = @ctorvirtualinit -| 202 = @ctorfieldinit -| 203 = @ctordelegatinginit -| 204 = @dtordirectdestruct -| 205 = @dtorvirtualdestruct -| 206 = @dtorfielddestruct -// ... -| 210 = @static_cast -| 211 = @reinterpret_cast -| 212 = @const_cast -| 213 = @dynamic_cast -| 214 = @c_style_cast -| 215 = @lambdaexpr -| 216 = @param_ref -| 217 = @noopexpr -// ... -| 294 = @istriviallyconstructibleexpr -| 295 = @isdestructibleexpr -| 296 = @isnothrowdestructibleexpr -| 297 = @istriviallydestructibleexpr -| 298 = @istriviallyassignableexpr -| 299 = @isnothrowassignableexpr -| 300 = @istrivialexpr -| 301 = @isstandardlayoutexpr -| 302 = @istriviallycopyableexpr -| 303 = @isliteraltypeexpr -| 304 = @hastrivialmoveconstructorexpr -| 305 = @hastrivialmoveassignexpr -| 306 = @hasnothrowmoveassignexpr -| 307 = @isconstructibleexpr -| 308 = @isnothrowconstructibleexpr -| 309 = @hasfinalizerexpr -| 310 = @isdelegateexpr -| 311 = @isinterfaceclassexpr -| 312 = @isrefarrayexpr -| 313 = @isrefclassexpr -| 314 = @issealedexpr -| 315 = @issimplevalueclassexpr -| 316 = @isvalueclassexpr -| 317 = @isfinalexpr -| 319 = @noexceptexpr -| 320 = @builtinshufflevector -| 321 = @builtinchooseexpr -| 322 = @builtinaddressof -| 323 = @vec_fill -| 324 = @builtinconvertvector -| 325 = @builtincomplex -| 326 = @spaceshipexpr -| 327 = @co_await -| 328 = @co_yield -| 329 = @temp_init -| 330 = @isassignable -| 331 = @isaggregate -| 332 = @hasuniqueobjectrepresentations -| 333 = @builtinbitcast -| 334 = @builtinshuffle -| 335 = @blockassignexpr -| 336 = @issame -| 337 = @isfunction -| 338 = @islayoutcompatible -| 339 = @ispointerinterconvertiblebaseof -| 340 = @isarray -| 341 = @arrayrank -| 342 = @arrayextent -| 343 = @isarithmetic -| 344 = @iscompletetype -| 345 = @iscompound -| 346 = @isconst -| 347 = @isfloatingpoint -| 348 = @isfundamental -| 349 = @isintegral -| 350 = @islvaluereference -| 351 = @ismemberfunctionpointer -| 352 = @ismemberobjectpointer -| 353 = @ismemberpointer -| 354 = @isobject -| 355 = @ispointer -| 356 = @isreference -| 357 = @isrvaluereference -| 358 = @isscalar -| 359 = @issigned -| 360 = @isunsigned -| 361 = @isvoid -| 362 = @isvolatile -| 363 = @reuseexpr -| 364 = @istriviallycopyassignable -| 365 = @isassignablenopreconditioncheck -| 366 = @referencebindstotemporary -| 367 = @issameas -| 368 = @builtinhasattribute -| 369 = @ispointerinterconvertiblewithclass -| 370 = @builtinispointerinterconvertiblewithclass -| 371 = @iscorrespondingmember -| 372 = @builtiniscorrespondingmember -| 373 = @isboundedarray -| 374 = @isunboundedarray -| 375 = @isreferenceable -| 378 = @isnothrowconvertible -| 379 = @referenceconstructsfromtemporary -| 380 = @referenceconvertsfromtemporary -| 381 = @isconvertible -| 382 = @isvalidwinrttype -| 383 = @iswinclass -| 384 = @iswininterface -| 385 = @istriviallyequalitycomparable -| 386 = @isscopedenum -| 387 = @istriviallyrelocatable -| 388 = @datasizeof -| 389 = @c11_generic -| 390 = @requires_expr -| 391 = @nested_requirement -| 392 = @compound_requirement -| 393 = @concept_id -; - -@var_args_expr = @vastartexpr - | @vaendexpr - | @vaargexpr - | @vacopyexpr - ; - -@builtin_op = @var_args_expr - | @noopexpr - | @offsetofexpr - | @intaddrexpr - | @hasassignexpr - | @hascopyexpr - | @hasnothrowassign - | @hasnothrowconstr - | @hasnothrowcopy - | @hastrivialassign - | @hastrivialconstr - | @hastrivialcopy - | @hastrivialdestructor - | @hasuserdestr - | @hasvirtualdestr - | @isabstractexpr - | @isbaseofexpr - | @isclassexpr - | @isconvtoexpr - | @isemptyexpr - | @isenumexpr - | @ispodexpr - | @ispolyexpr - | @isunionexpr - | @typescompexpr - | @builtinshufflevector - | @builtinconvertvector - | @builtinaddressof - | @istriviallyconstructibleexpr - | @isdestructibleexpr - | @isnothrowdestructibleexpr - | @istriviallydestructibleexpr - | @istriviallyassignableexpr - | @isnothrowassignableexpr - | @istrivialexpr - | @isstandardlayoutexpr - | @istriviallycopyableexpr - | @isliteraltypeexpr - | @hastrivialmoveconstructorexpr - | @hastrivialmoveassignexpr - | @hasnothrowmoveassignexpr - | @isconstructibleexpr - | @isnothrowconstructibleexpr - | @hasfinalizerexpr - | @isdelegateexpr - | @isinterfaceclassexpr - | @isrefarrayexpr - | @isrefclassexpr - | @issealedexpr - | @issimplevalueclassexpr - | @isvalueclassexpr - | @isfinalexpr - | @builtinchooseexpr - | @builtincomplex - | @isassignable - | @isaggregate - | @hasuniqueobjectrepresentations - | @builtinbitcast - | @builtinshuffle - | @issame - | @isfunction - | @islayoutcompatible - | @ispointerinterconvertiblebaseof - | @isarray - | @arrayrank - | @arrayextent - | @isarithmetic - | @iscompletetype - | @iscompound - | @isconst - | @isfloatingpoint - | @isfundamental - | @isintegral - | @islvaluereference - | @ismemberfunctionpointer - | @ismemberobjectpointer - | @ismemberpointer - | @isobject - | @ispointer - | @isreference - | @isrvaluereference - | @isscalar - | @issigned - | @isunsigned - | @isvoid - | @isvolatile - | @istriviallycopyassignable - | @isassignablenopreconditioncheck - | @referencebindstotemporary - | @issameas - | @builtinhasattribute - | @ispointerinterconvertiblewithclass - | @builtinispointerinterconvertiblewithclass - | @iscorrespondingmember - | @builtiniscorrespondingmember - | @isboundedarray - | @isunboundedarray - | @isreferenceable - | @isnothrowconvertible - | @referenceconstructsfromtemporary - | @referenceconvertsfromtemporary - | @isconvertible - | @isvalidwinrttype - | @iswinclass - | @iswininterface - | @istriviallyequalitycomparable - | @isscopedenum - | @istriviallyrelocatable - ; - -compound_requirement_is_noexcept( - int expr: @compound_requirement ref -); - -new_allocated_type( - unique int expr: @new_expr ref, - int type_id: @type ref -); - -new_array_allocated_type( - unique int expr: @new_array_expr ref, - int type_id: @type ref -); - -/** - * The field being initialized by an initializer expression within an aggregate - * initializer for a class/struct/union. Position is used to sort repeated initializers. - */ -#keyset[aggregate, position] -aggregate_field_init( - int aggregate: @aggregateliteral ref, - int initializer: @expr ref, - int field: @membervariable ref, - int position: int ref -); - -/** - * The index of the element being initialized by an initializer expression - * within an aggregate initializer for an array. Position is used to sort repeated initializers. - */ -#keyset[aggregate, position] -aggregate_array_init( - int aggregate: @aggregateliteral ref, - int initializer: @expr ref, - int element_index: int ref, - int position: int ref -); - -@ctorinit = @ctordirectinit - | @ctorvirtualinit - | @ctorfieldinit - | @ctordelegatinginit; -@dtordestruct = @dtordirectdestruct - | @dtorvirtualdestruct - | @dtorfielddestruct; - - -condition_decl_bind( - unique int expr: @condition_decl ref, - unique int decl: @declaration ref -); - -typeid_bind( - unique int expr: @type_id ref, - int type_id: @type ref -); - -uuidof_bind( - unique int expr: @uuidof ref, - int type_id: @type ref -); - -@runtime_sizeof_or_alignof = @runtime_sizeof | @runtime_alignof | @datasizeof; - -sizeof_bind( - unique int expr: @runtime_sizeof_or_alignof ref, - int type_id: @type ref -); - -code_block( - unique int block: @literal ref, - unique int routine: @function ref -); - -lambdas( - unique int expr: @lambdaexpr ref, - string default_capture: string ref, - boolean has_explicit_return_type: boolean ref -); - -lambda_capture( - unique int id: @lambdacapture, - int lambda: @lambdaexpr ref, - int index: int ref, - int field: @membervariable ref, - boolean captured_by_reference: boolean ref, - boolean is_implicit: boolean ref, - int location: @location_default ref -); - -@funbindexpr = @routineexpr - | @new_expr - | @delete_expr - | @delete_array_expr - | @ctordirectinit - | @ctorvirtualinit - | @ctordelegatinginit - | @dtordirectdestruct - | @dtorvirtualdestruct; - -@varbindexpr = @varaccess | @ctorfieldinit | @dtorfielddestruct; -@addressable = @function | @variable ; -@accessible = @addressable | @enumconstant ; - -@access = @varaccess | @routineexpr ; - -fold( - int expr: @foldexpr ref, - string operator: string ref, - boolean is_left_fold: boolean ref -); - -stmts( - unique int id: @stmt, - int kind: int ref, - int location: @location_stmt ref -); - -case @stmt.kind of - 1 = @stmt_expr -| 2 = @stmt_if -| 3 = @stmt_while -| 4 = @stmt_goto -| 5 = @stmt_label -| 6 = @stmt_return -| 7 = @stmt_block -| 8 = @stmt_end_test_while // do { ... } while ( ... ) -| 9 = @stmt_for -| 10 = @stmt_switch_case -| 11 = @stmt_switch -| 13 = @stmt_asm // "asm" statement or the body of an asm function -| 15 = @stmt_try_block -| 16 = @stmt_microsoft_try // Microsoft -| 17 = @stmt_decl -| 18 = @stmt_set_vla_size // C99 -| 19 = @stmt_vla_decl // C99 -| 25 = @stmt_assigned_goto // GNU -| 26 = @stmt_empty -| 27 = @stmt_continue -| 28 = @stmt_break -| 29 = @stmt_range_based_for // C++11 -// ... 30 @stmt_at_autoreleasepool_block deprecated -// ... 31 @stmt_objc_for_in deprecated -// ... 32 @stmt_at_synchronized deprecated -| 33 = @stmt_handler -// ... 34 @stmt_finally_end deprecated -| 35 = @stmt_constexpr_if -| 37 = @stmt_co_return -; - -type_vla( - int type_id: @type ref, - int decl: @stmt_vla_decl ref -); - -variable_vla( - int var: @variable ref, - int decl: @stmt_vla_decl ref -); - -if_initialization( - unique int if_stmt: @stmt_if ref, - int init_id: @stmt ref -); - -if_then( - unique int if_stmt: @stmt_if ref, - int then_id: @stmt ref -); - -if_else( - unique int if_stmt: @stmt_if ref, - int else_id: @stmt ref -); - -constexpr_if_initialization( - unique int constexpr_if_stmt: @stmt_constexpr_if ref, - int init_id: @stmt ref -); - -constexpr_if_then( - unique int constexpr_if_stmt: @stmt_constexpr_if ref, - int then_id: @stmt ref -); - -constexpr_if_else( - unique int constexpr_if_stmt: @stmt_constexpr_if ref, - int else_id: @stmt ref -); - -while_body( - unique int while_stmt: @stmt_while ref, - int body_id: @stmt ref -); - -do_body( - unique int do_stmt: @stmt_end_test_while ref, - int body_id: @stmt ref -); - -switch_initialization( - unique int switch_stmt: @stmt_switch ref, - int init_id: @stmt ref -); - -#keyset[switch_stmt, index] -switch_case( - int switch_stmt: @stmt_switch ref, - int index: int ref, - int case_id: @stmt_switch_case ref -); - -switch_body( - unique int switch_stmt: @stmt_switch ref, - int body_id: @stmt ref -); - -@stmt_for_or_range_based_for = @stmt_for - | @stmt_range_based_for; - -for_initialization( - unique int for_stmt: @stmt_for_or_range_based_for ref, - int init_id: @stmt ref -); - -for_condition( - unique int for_stmt: @stmt_for ref, - int condition_id: @expr ref -); - -for_update( - unique int for_stmt: @stmt_for ref, - int update_id: @expr ref -); - -for_body( - unique int for_stmt: @stmt_for ref, - int body_id: @stmt ref -); - -@stmtparent = @stmt | @expr_stmt ; -stmtparents( - unique int id: @stmt ref, - int index: int ref, - int parent: @stmtparent ref -); - -ishandler(unique int block: @stmt_block ref); - -@cfgnode = @stmt | @expr | @function | @initialiser ; - -stmt_decl_bind( - int stmt: @stmt_decl ref, - int num: int ref, - int decl: @declaration ref -); - -stmt_decl_entry_bind( - int stmt: @stmt_decl ref, - int num: int ref, - int decl_entry: @element ref -); - -@parameterized_element = @function | @stmt_block | @requires_expr; - -blockscope( - unique int block: @stmt_block ref, - int enclosing: @parameterized_element ref -); - -@jump = @stmt_goto | @stmt_break | @stmt_continue; - -@jumporlabel = @jump | @stmt_label | @literal; - -jumpinfo( - unique int id: @jumporlabel ref, - string str: string ref, - int target: @stmt ref -); - -preprocdirects( - unique int id: @preprocdirect, - int kind: int ref, - int location: @location_default ref -); -case @preprocdirect.kind of - 0 = @ppd_if -| 1 = @ppd_ifdef -| 2 = @ppd_ifndef -| 3 = @ppd_elif -| 4 = @ppd_else -| 5 = @ppd_endif -| 6 = @ppd_plain_include -| 7 = @ppd_define -| 8 = @ppd_undef -| 9 = @ppd_line -| 10 = @ppd_error -| 11 = @ppd_pragma -| 12 = @ppd_objc_import -| 13 = @ppd_include_next -| 18 = @ppd_warning -; - -@ppd_include = @ppd_plain_include | @ppd_objc_import | @ppd_include_next; - -@ppd_branch = @ppd_if | @ppd_ifdef | @ppd_ifndef | @ppd_elif; - -preprocpair( - int begin : @ppd_branch ref, - int elseelifend : @preprocdirect ref -); - -preproctrue(int branch : @ppd_branch ref); -preprocfalse(int branch : @ppd_branch ref); - -preproctext( - unique int id: @preprocdirect ref, - string head: string ref, - string body: string ref -); - -includes( - unique int id: @ppd_include ref, - int included: @file ref -); - -link_targets( - int id: @link_target, - int binary: @file ref -); - -link_parent( - int element : @element ref, - int link_target : @link_target ref -); - -/* XML Files */ - -xmlEncoding(unique int id: @file ref, string encoding: string ref); - -xmlDTDs( - unique int id: @xmldtd, - string root: string ref, - string publicId: string ref, - string systemId: string ref, - int fileid: @file ref -); - -xmlElements( - unique int id: @xmlelement, - string name: string ref, - int parentid: @xmlparent ref, - int idx: int ref, - int fileid: @file ref -); - -xmlAttrs( - unique int id: @xmlattribute, - int elementid: @xmlelement ref, - string name: string ref, - string value: string ref, - int idx: int ref, - int fileid: @file ref -); - -xmlNs( - int id: @xmlnamespace, - string prefixName: string ref, - string URI: string ref, - int fileid: @file ref -); - -xmlHasNs( - int elementId: @xmlnamespaceable ref, - int nsId: @xmlnamespace ref, - int fileid: @file ref -); - -xmlComments( - unique int id: @xmlcomment, - string text: string ref, - int parentid: @xmlparent ref, - int fileid: @file ref -); - -xmlChars( - unique int id: @xmlcharacters, - string text: string ref, - int parentid: @xmlparent ref, - int idx: int ref, - int isCDATA: int ref, - int fileid: @file ref -); - -@xmlparent = @file | @xmlelement; -@xmlnamespaceable = @xmlelement | @xmlattribute; - -xmllocations( - int xmlElement: @xmllocatable ref, - int location: @location_default ref -); - -@xmllocatable = @xmlcharacters - | @xmlelement - | @xmlcomment - | @xmlattribute - | @xmldtd - | @file - | @xmlnamespace; diff --git a/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties b/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties deleted file mode 100644 index cf362f384da..00000000000 --- a/cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties +++ /dev/null @@ -1,3 +0,0 @@ -description: Implement compilation_build_mode/2 -compatibility: full -compilation_build_mode.rel: delete diff --git a/cpp/ql/lib/semmle/code/cpp/Compilation.qll b/cpp/ql/lib/semmle/code/cpp/Compilation.qll index 407dc31e05f..1a8d90f991c 100644 --- a/cpp/ql/lib/semmle/code/cpp/Compilation.qll +++ b/cpp/ql/lib/semmle/code/cpp/Compilation.qll @@ -112,7 +112,4 @@ class Compilation extends @compilation { * termination, but crashing due to something like a segfault is not. */ predicate normalTermination() { compilation_finished(this, _, _) } - - /** Holds if this compilation was compiled using the "none" build mode. */ - predicate buildModeNone() { compilation_build_mode(this, 0) } } diff --git a/cpp/ql/lib/semmlecode.cpp.dbscheme b/cpp/ql/lib/semmlecode.cpp.dbscheme index f0156f5f88a..e51fad7a243 100644 --- a/cpp/ql/lib/semmlecode.cpp.dbscheme +++ b/cpp/ql/lib/semmlecode.cpp.dbscheme @@ -46,22 +46,6 @@ compilation_args( string arg : string ref ); -/** - * Optionally, record the build mode for each compilation. - */ -compilation_build_mode( - unique int id : @compilation ref, - int mode : int ref -); - -/* -case @compilation_build_mode.mode of - 0 = @build_mode_none -| 1 = @build_mode_manual -| 2 = @build_mode_auto -; -*/ - /** * The source files that are compiled by a compiler invocation. * If `id` is for the compiler invocation diff --git a/cpp/ql/lib/semmlecode.cpp.dbscheme.stats b/cpp/ql/lib/semmlecode.cpp.dbscheme.stats index 758aba34608..7f0d99272e7 100644 --- a/cpp/ql/lib/semmlecode.cpp.dbscheme.stats +++ b/cpp/ql/lib/semmlecode.cpp.dbscheme.stats @@ -18,7 +18,7 @@ @location_default - 29746763 + 29764890 @location_stmt @@ -34,11 +34,11 @@ @file - 123176 + 123251 @folder - 16330 + 16340 @macro_expansion @@ -46,23 +46,23 @@ @other_macro_reference - 858505 + 859029 @function - 4176817 + 4179363 @fun_decl - 4541216 + 4543516 @var_decl - 8034962 + 8039391 @type_decl - 3281452 + 3283451 @namespace_decl @@ -70,11 +70,11 @@ @using_declaration - 362998 + 363219 @using_directive - 6532 + 6536 @using_enum_declaration @@ -86,7 +86,7 @@ @parameter - 6186841 + 6190611 @membervariable @@ -98,7 +98,7 @@ @localvariable - 576952 + 576945 @enumconstant @@ -330,15 +330,15 @@ @pointer - 567827 + 568173 @type_with_specifiers - 851507 + 852026 @array - 110112 + 110179 @routineptr @@ -346,7 +346,7 @@ @reference - 1275627 + 1276405 @gnu_vector @@ -358,7 +358,7 @@ @rvalue_reference - 333137 + 333340 @block @@ -366,15 +366,15 @@ @decltype - 27061 + 27078 @usertype - 5230820 + 5234008 @mangledname - 6058065 + 6061757 @type_mention @@ -386,15 +386,15 @@ @ptrtomember - 37792 + 37815 @specifier - 24728 + 24743 @gnuattribute - 553363 + 553700 @stdattribute @@ -410,15 +410,15 @@ @alignas - 4665 + 4668 @attribute_arg_token - 25195 + 25210 @attribute_arg_constant_expr - 318207 + 318400 @attribute_arg_empty @@ -450,7 +450,7 @@ @namespace - 12131 + 12138 @specialnamequalifyingelement @@ -482,7 +482,7 @@ @parexpr - 3587464 + 3587463 @arithnegexpr @@ -582,11 +582,11 @@ @gtexpr - 104047 + 104110 @ltexpr - 101714 + 101776 @geexpr @@ -634,7 +634,7 @@ @assignorexpr - 23628 + 23627 @assignxorexpr @@ -662,11 +662,11 @@ @subscriptexpr - 364481 + 364477 @callexpr - 316340 + 316533 @vastartexpr @@ -678,7 +678,7 @@ @vaendexpr - 2799 + 2801 @vacopyexpr @@ -830,7 +830,7 @@ @sizeof_pack - 5598 + 5602 @hasassignexpr @@ -978,7 +978,7 @@ @lambdaexpr - 21462 + 21475 @param_ref @@ -1022,7 +1022,7 @@ @istriviallycopyableexpr - 3732 + 3734 @isliteraltypeexpr @@ -1374,7 +1374,7 @@ @lambdacapture - 27994 + 28011 @stmt_expr @@ -1398,11 +1398,11 @@ @stmt_return - 1279827 + 1280140 @stmt_block - 1418867 + 1419265 @stmt_end_test_while @@ -1430,7 +1430,7 @@ @stmt_empty - 192685 + 192682 @stmt_continue @@ -1462,7 +1462,7 @@ @stmt_range_based_for - 8398 + 8403 @stmt_handler @@ -1478,31 +1478,31 @@ @ppd_if - 666741 + 667148 @ppd_ifdef - 263150 + 263311 @ppd_ifndef - 266416 + 266579 @ppd_elif - 25195 + 25210 @ppd_else - 209027 + 209154 @ppd_endif - 1196309 + 1197038 @ppd_plain_include - 311208 + 311398 @ppd_define @@ -1510,15 +1510,15 @@ @ppd_undef - 258484 + 258642 @ppd_include_next - 1866 + 1867 @ppd_line - 27521 + 27520 @ppd_error @@ -1900,54 +1900,6 @@
    - - compilation_build_mode - 9742 - - - id - 9742 - - - mode - 11 - - - - - id - mode - - - 12 - - - 1 - 2 - 9742 - - - - - - - mode - id - - - 12 - - - 863 - 864 - 11 - - - - - - - compilation_compiling_files 11546 @@ -2212,7 +2164,7 @@ seconds - 8030 + 8429 @@ -2293,52 +2245,47 @@ 3 4 - 799 + 639 4 5 - 199 + 359 - 5 + 6 7 119 8 - 9 - 79 - - - 9 10 - 119 + 159 10 - 12 - 159 - - - 12 - 16 + 11 119 - 17 - 20 + 11 + 15 159 - 21 - 42 + 16 + 19 159 - 55 - 90 - 79 + 19 + 24 + 159 + + + 40 + 89 + 119 @@ -2421,7 +2368,7 @@ 6 7 - 399 + 439 7 @@ -2430,19 +2377,19 @@ 8 - 9 - 239 - - - 9 - 24 + 10 279 - 25 - 85 + 10 + 26 279 + + 28 + 81 + 199 + @@ -2492,8 +2439,8 @@ 79
    - 124 - 125 + 125 + 126 39 @@ -2515,37 +2462,27 @@ 1 2 - 3755 + 3635 2 3 - 1398 + 1917 3 4 - 998 + 1558 4 - 5 - 759 - - - 5 6 - 439 + 719 6 - 25 - 639 - - - 46 - 47 - 39 + 48 + 599 @@ -2561,27 +2498,27 @@ 1 2 - 3515 + 3595 2 3 - 1278 + 1438 3 4 - 599 + 1358 4 5 - 878 + 639 5 6 - 759 + 479 6 @@ -2590,8 +2527,8 @@ 8 - 76 - 319 + 73 + 239 @@ -2607,12 +2544,12 @@ 1 2 - 5753 + 6512 2 3 - 2277 + 1917 @@ -2956,7 +2893,7 @@ cpu_seconds - 7292 + 7507 elapsed_seconds @@ -3006,17 +2943,17 @@ 1 2 - 5937 + 6242 2 3 - 846 + 835 3 - 16 - 507 + 15 + 428 @@ -3032,12 +2969,12 @@ 1 2 - 6682 + 6976 2 3 - 609 + 530 @@ -3066,48 +3003,48 @@ 11 - 7 - 8 + 6 + 7 11 - 8 - 9 + 9 + 10 11 - 12 - 13 + 11 + 12 11 - 13 - 14 + 16 + 17 11 - 51 - 52 + 49 + 50 11 - 163 - 164 + 154 + 155 11 - 167 - 168 + 160 + 161 11 - 187 - 188 + 204 + 205 11 - 249 - 250 + 248 + 249 11 @@ -3137,48 +3074,48 @@ 11
    - 7 - 8 + 6 + 7 11 - 8 - 9 + 9 + 10 11 - 12 - 13 + 11 + 12 11 - 13 - 14 + 16 + 17 11 - 49 - 50 + 47 + 48 11 - 120 - 121 + 118 + 119 11 - 123 - 124 + 128 + 129 11 - 138 - 139 + 149 + 150 11 - 224 - 225 + 222 + 223 11 @@ -4951,31 +4888,31 @@ locations_default - 29746763 + 29764890 id - 29746763 + 29764890 container - 123176 + 123251 startLine - 2094007 + 2095283 startColumn - 36859 + 36882 endLine - 2098207 + 2099485 endColumn - 48057 + 48086 @@ -4989,7 +4926,7 @@ 1 2 - 29746763 + 29764890 @@ -5005,7 +4942,7 @@ 1 2 - 29746763 + 29764890 @@ -5021,7 +4958,7 @@ 1 2 - 29746763 + 29764890 @@ -5037,7 +4974,7 @@ 1 2 - 29746763 + 29764890 @@ -5053,7 +4990,7 @@ 1 2 - 29746763 + 29764890 @@ -5069,67 +5006,67 @@ 1 11 - 9798 + 9804 11 18 - 10264 + 10270 18 30 - 9331 + 9337 30 42 - 9798 + 9804 43 61 - 9798 + 9804 61 79 - 9331 + 9337 80 106 - 9798 + 9804 108 149 - 9331 + 9337 149 199 - 9331 + 9337 206 291 - 9331 + 9337 304 469 - 9331 + 9337 482 850 - 9331 + 9337 936 2380 - 8398 + 8403 @@ -5145,67 +5082,67 @@ 1 8 - 9331 + 9337 8 13 - 9331 + 9337 13 20 - 9798 + 9804 20 32 - 9331 + 9337 32 43 - 9798 + 9804 44 61 - 9331 + 9337 62 72 - 9331 + 9337 73 93 - 9331 + 9337 97 128 - 9331 + 9337 128 180 - 9331 + 9337 180 267 - 9331 + 9337 277 414 - 9331 + 9337 439 1465 - 9331 + 9337 1557 @@ -5226,67 +5163,67 @@ 1 4 - 8865 + 8870 4 5 - 7931 + 7936 5 6 - 7465 + 7469 6 8 - 11197 + 11204 8 10 - 9331 + 9337 10 15 - 10731 + 10737 15 23 - 9798 + 9804 23 28 - 11197 + 11204 28 34 - 9798 + 9804 34 44 - 9331 + 9337 44 55 - 9331 + 9337 55 66 - 9798 + 9804 66 77 - 8398 + 8403 @@ -5302,67 +5239,67 @@ 1 8 - 9331 + 9337 8 13 - 9331 + 9337 13 20 - 9798 + 9804 20 32 - 9331 + 9337 32 43 - 9798 + 9804 43 60 - 9331 + 9337 61 71 - 9331 + 9337 72 93 - 9331 + 9337 94 127 - 9331 + 9337 128 179 - 9331 + 9337 180 268 - 9331 + 9337 278 413 - 9331 + 9337 437 1465 - 9331 + 9337 1554 @@ -5383,67 +5320,67 @@ 1 9 - 9798 + 9804 9 13 - 9331 + 9337 13 18 - 9331 + 9337 18 26 - 10264 + 10270 27 33 - 9331 + 9337 33 39 - 9331 + 9337 39 47 - 10264 + 10270 47 53 - 9331 + 9337 53 60 - 10264 + 10270 60 66 - 9331 + 9337 66 74 - 9798 + 9804 74 78 - 9798 + 9804 78 90 - 6998 + 7002 @@ -5459,52 +5396,52 @@ 1 2 - 582757 + 583112 2 3 - 314007 + 314199 3 4 - 195496 + 195615 4 6 - 161903 + 162001 6 10 - 182899 + 183010 10 16 - 162836 + 162935 16 25 - 168901 + 169004 25 46 - 160969 + 161067 46 169 - 157237 + 157333 169 265 - 6998 + 7002 @@ -5520,42 +5457,42 @@ 1 2 - 870636 + 871167 2 3 - 273415 + 273582 3 5 - 193630 + 193748 5 8 - 173567 + 173673 8 13 - 188031 + 188146 13 20 - 160969 + 161067 20 51 - 159570 + 159667 51 265 - 74186 + 74231 @@ -5571,47 +5508,47 @@ 1 2 - 611685 + 612058 2 3 - 313074 + 313265 3 4 - 198296 + 198417 4 6 - 182899 + 183010 6 9 - 173100 + 173206 9 13 - 163302 + 163402 13 19 - 174500 + 174606 19 29 - 164702 + 164802 29 52 - 112445 + 112514 @@ -5627,22 +5564,22 @@ 1 2 - 1530846 + 1531779 2 3 - 348534 + 348747 3 5 - 161903 + 162001 5 16 - 52723 + 52755 @@ -5658,47 +5595,47 @@ 1 2 - 587423 + 587781 2 3 - 315874 + 316066 3 4 - 197363 + 197483 4 6 - 168435 + 168537 6 9 - 158170 + 158266 9 14 - 170768 + 170872 14 21 - 174967 + 175073 21 32 - 162369 + 162468 32 63 - 157703 + 157799 64 @@ -5719,67 +5656,67 @@ 1 31 - 2799 + 2801 42 85 - 2799 + 2801 86 128 - 2799 + 2801 129 229 - 2799 + 2801 247 286 - 2799 + 2801 291 360 - 2799 + 2801 373 457 - 2799 + 2801 473 565 - 2799 + 2801 566 619 - 2799 + 2801 619 689 - 2799 + 2801 696 807 - 2799 + 2801 819 1563 - 2799 + 2801 1634 5631 - 2799 + 2801 15295 @@ -5800,67 +5737,67 @@ 1 18 - 2799 + 2801 23 35 - 3266 + 3268 38 43 - 2799 + 2801 44 61 - 2799 + 2801 65 73 - 2799 + 2801 73 84 - 3266 + 3268 84 96 - 2799 + 2801 96 101 - 3266 + 3268 101 105 - 3266 + 3268 107 112 - 2799 + 2801 112 126 - 2799 + 2801 137 170 - 2799 + 2801 195 265 - 1399 + 1400 @@ -5876,67 +5813,67 @@ 1 19 - 2799 + 2801 30 72 - 2799 + 2801 83 122 - 2799 + 2801 122 205 - 2799 + 2801 214 261 - 2799 + 2801 265 322 - 2799 + 2801 322 379 - 2799 + 2801 404 430 - 2799 + 2801 453 474 - 2799 + 2801 478 505 - 2799 + 2801 511 583 - 2799 + 2801 585 836 - 2799 + 2801 1104 2196 - 2799 + 2801 2387 @@ -5957,67 +5894,67 @@ 1 19 - 2799 + 2801 30 72 - 2799 + 2801 83 122 - 2799 + 2801 122 205 - 2799 + 2801 214 261 - 2799 + 2801 265 322 - 2799 + 2801 322 380 - 2799 + 2801 404 430 - 2799 + 2801 453 474 - 2799 + 2801 477 504 - 2799 + 2801 514 582 - 2799 + 2801 585 835 - 2799 + 2801 1109 2203 - 2799 + 2801 2382 @@ -6038,67 +5975,67 @@ 1 7 - 2799 + 2801 7 11 - 3266 + 3268 11 16 - 3266 + 3268 16 22 - 2799 + 2801 22 24 - 3266 + 3268 24 28 - 2799 + 2801 29 34 - 3266 + 3268 34 41 - 3266 + 3268 41 46 - 2799 + 2801 47 49 - 1866 + 1867 49 54 - 2799 + 2801 54 74 - 2799 + 2801 75 86 - 1866 + 1867 @@ -6114,52 +6051,52 @@ 1 2 - 593022 + 593383 2 3 - 306076 + 306262 3 4 - 198296 + 198417 4 6 - 159570 + 159667 6 10 - 182432 + 182543 10 16 - 161903 + 162001 16 25 - 171234 + 171338 25 46 - 158636 + 158733 46 161 - 158170 + 158266 162 265 - 8865 + 8870 @@ -6175,47 +6112,47 @@ 1 2 - 886034 + 886574 2 3 - 259884 + 260043 3 4 - 125043 + 125119 4 6 - 140906 + 140992 6 10 - 184765 + 184877 10 15 - 168435 + 168537 15 26 - 163302 + 163402 26 120 - 158170 + 158266 121 265 - 11664 + 11671 @@ -6231,22 +6168,22 @@ 1 2 - 1528513 + 1529445 2 3 - 341536 + 341744 3 5 - 170768 + 170872 5 10 - 57389 + 57424 @@ -6262,47 +6199,47 @@ 1 2 - 622883 + 623262 2 3 - 303276 + 303461 3 4 - 201562 + 201685 4 6 - 183832 + 183944 6 9 - 169834 + 169938 9 13 - 166568 + 166670 13 19 - 174967 + 175073 19 29 - 160969 + 161067 29 52 - 114311 + 114381 @@ -6318,52 +6255,52 @@ 1 2 - 599554 + 599919 2 3 - 306076 + 306262 3 4 - 196896 + 197016 4 6 - 168901 + 169004 6 9 - 156304 + 156399 9 14 - 168901 + 169004 14 21 - 177766 + 177875 21 32 - 161903 + 162001 32 60 - 158170 + 158266 60 65 - 3732 + 3734 @@ -6379,67 +6316,67 @@ 1 2 - 5132 + 5135 2 8 - 3732 + 3734 9 186 - 3732 + 3734 193 288 - 3732 + 3734 294 495 - 3732 + 3734 503 555 - 3732 + 3734 561 633 - 3732 + 3734 640 758 - 3732 + 3734 758 869 - 3732 + 3734 875 1074 - 3732 + 3734 1074 1281 - 3732 + 3734 1289 1590 - 3732 + 3734 1685 2418 - 1866 + 1867 @@ -6455,62 +6392,62 @@ 1 2 - 5598 + 5602 2 5 - 3732 + 3734 5 65 - 3732 + 3734 70 100 - 3732 + 3734 100 111 - 3732 + 3734 112 122 - 4199 + 4201 122 140 - 3732 + 3734 143 153 - 3732 + 3734 153 161 - 4199 + 4201 161 173 - 4199 + 4201 173 178 - 3732 + 3734 188 265 - 3732 + 3734 @@ -6526,62 +6463,62 @@ 1 2 - 5598 + 5602 2 8 - 3732 + 3734 9 105 - 3732 + 3734 155 241 - 3732 + 3734 253 336 - 3732 + 3734 340 426 - 3732 + 3734 434 488 - 3732 + 3734 489 572 - 3732 + 3734 573 623 - 3732 + 3734 626 696 - 4199 + 4201 701 813 - 3732 + 3734 818 1095 - 3732 + 3734 1172 @@ -6602,67 +6539,67 @@ 1 2 - 6065 + 6069 2 4 - 3732 + 3734 4 8 - 4199 + 4201 8 15 - 3732 + 3734 15 23 - 3732 + 3734 23 29 - 3732 + 3734 29 35 - 4199 + 4201 35 39 - 3266 + 3268 39 42 - 3266 + 3268 42 44 - 3266 + 3268 44 46 - 3732 + 3734 46 49 - 3732 + 3734 49 53 - 1399 + 1400 @@ -6678,67 +6615,67 @@ 1 2 - 5598 + 5602 2 8 - 3732 + 3734 9 156 - 3732 + 3734 159 240 - 3732 + 3734 251 335 - 3732 + 3734 342 430 - 3732 + 3734 432 490 - 3732 + 3734 490 573 - 3732 + 3734 574 622 - 3732 + 3734 626 698 - 3732 + 3734 700 798 - 3732 + 3734 811 987 - 3732 + 3734 1096 1180 - 1399 + 1400 @@ -10662,23 +10599,23 @@ numlines - 1382941 + 1383783 element_id - 1375942 + 1376780 num_lines - 101714 + 101776 num_code - 84917 + 84969 num_comment - 59722 + 59758 @@ -10692,12 +10629,12 @@ 1 2 - 1368943 + 1369777 2 3 - 6998 + 7002 @@ -10713,12 +10650,12 @@ 1 2 - 1369876 + 1370711 2 3 - 6065 + 6069 @@ -10734,7 +10671,7 @@ 1 2 - 1375942 + 1376780 @@ -10750,27 +10687,27 @@ 1 2 - 68120 + 68162 2 3 - 12131 + 12138 3 4 - 7465 + 7469 4 21 - 7931 + 7936 29 921 - 6065 + 6069 @@ -10786,27 +10723,27 @@ 1 2 - 70453 + 70496 2 3 - 12131 + 12138 3 4 - 8398 + 8403 4 6 - 9331 + 9337 6 7 - 1399 + 1400 @@ -10822,22 +10759,22 @@ 1 2 - 69520 + 69562 2 3 - 14930 + 14939 3 4 - 10731 + 10737 4 7 - 6532 + 6536 @@ -10853,27 +10790,27 @@ 1 2 - 52723 + 52755 2 3 - 14463 + 14472 3 5 - 6532 + 6536 5 42 - 6532 + 6536 44 922 - 4665 + 4668 @@ -10889,27 +10826,27 @@ 1 2 - 52723 + 52755 2 3 - 16796 + 16807 3 5 - 6065 + 6069 5 8 - 6532 + 6536 8 12 - 2799 + 2801 @@ -10925,27 +10862,27 @@ 1 2 - 53190 + 53222 2 3 - 15863 + 15873 3 5 - 7465 + 7469 5 7 - 5132 + 5135 7 10 - 3266 + 3268 @@ -10961,32 +10898,32 @@ 1 2 - 34526 + 34547 2 3 - 9331 + 9337 3 4 - 4199 + 4201 4 6 - 4665 + 4668 6 11 - 5132 + 5135 17 2596 - 1866 + 1867 @@ -11002,32 +10939,32 @@ 1 2 - 34526 + 34547 2 3 - 9331 + 9337 3 4 - 4199 + 4201 4 6 - 4665 + 4668 6 8 - 4665 + 4668 10 38 - 2332 + 2334 @@ -11043,32 +10980,32 @@ 1 2 - 34526 + 34547 2 3 - 9331 + 9337 3 4 - 4199 + 4201 4 6 - 4665 + 4668 6 10 - 4665 + 4668 10 37 - 2332 + 2334 @@ -11710,15 +11647,15 @@ files - 123176 + 123251 id - 123176 + 123251 name - 123176 + 123251 @@ -11732,7 +11669,7 @@ 1 2 - 123176 + 123251 @@ -11748,7 +11685,7 @@ 1 2 - 123176 + 123251 @@ -11758,15 +11695,15 @@ folders - 16330 + 16340 id - 16330 + 16340 name - 16330 + 16340 @@ -11780,7 +11717,7 @@ 1 2 - 16330 + 16340 @@ -11796,7 +11733,7 @@ 1 2 - 16330 + 16340 @@ -11806,15 +11743,15 @@ containerparent - 138574 + 138658 parent - 16330 + 16340 child - 138574 + 138658 @@ -11828,32 +11765,32 @@ 1 2 - 7465 + 7469 2 3 - 3266 + 3268 3 4 - 1399 + 1400 4 12 - 1399 + 1400 23 28 - 1399 + 1400 40 67 - 1399 + 1400 @@ -11869,7 +11806,7 @@ 1 2 - 138574 + 138658 @@ -12455,15 +12392,15 @@ inmacroexpansion - 109779103 + 109779080 id - 18027697 + 18027694 inv - 2700159 + 2700160 @@ -12477,12 +12414,12 @@ 1 3 - 1582360 + 1582361 3 5 - 1077794 + 1077793 5 @@ -12492,17 +12429,17 @@ 6 7 - 4819904 + 4819903 7 8 - 6385934 + 6385932 8 9 - 2605243 + 2605242 9 @@ -12523,12 +12460,12 @@ 1 2 - 378422 + 378424 2 3 - 544105 + 544104 3 @@ -12563,7 +12500,7 @@ 11 337 - 224845 + 224847 339 @@ -12583,15 +12520,15 @@ affectedbymacroexpansion - 35689257 + 35689251 id - 5156948 + 5156949 inv - 2784761 + 2784762 @@ -12605,7 +12542,7 @@ 1 2 - 2816078 + 2816079 2 @@ -12651,7 +12588,7 @@ 1 4 - 229115 + 229116 4 @@ -12666,12 +12603,12 @@ 9 12 - 251120 + 251119 12 13 - 333985 + 333984 13 @@ -12691,7 +12628,7 @@ 16 17 - 276609 + 276608 17 @@ -13670,19 +13607,19 @@ functions - 4176817 + 4179363 id - 4176817 + 4179363 name - 1894311 + 1895466 kind - 3266 + 3268 @@ -13696,7 +13633,7 @@ 1 2 - 4176817 + 4179363 @@ -13712,7 +13649,7 @@ 1 2 - 4176817 + 4179363 @@ -13728,22 +13665,22 @@ 1 2 - 1497253 + 1498165 2 3 - 153038 + 153131 3 5 - 142773 + 142860 5 952 - 101247 + 101309 @@ -13759,7 +13696,7 @@ 1 2 - 1893845 + 1894999 2 @@ -13861,15 +13798,15 @@ function_entry_point - 1151517 + 1151752 id - 1141719 + 1141948 entry_point - 1151517 + 1151752 @@ -13883,12 +13820,12 @@ 1 2 - 1131921 + 1132144 2 3 - 9798 + 9804 @@ -13904,7 +13841,7 @@ 1 2 - 1151517 + 1151752 @@ -13914,15 +13851,15 @@ function_return_type - 4181950 + 4184498 id - 4176817 + 4179363 return_type - 817446 + 817945 @@ -13936,12 +13873,12 @@ 1 2 - 4171685 + 4174227 2 3 - 5132 + 5135 @@ -13957,22 +13894,22 @@ 1 2 - 505771 + 506080 2 3 - 211360 + 211489 3 7 - 66254 + 66294 7 2231 - 34060 + 34081 @@ -14263,33 +14200,33 @@ function_deleted - 96115 + 96173 id - 96115 + 96173 function_defaulted - 73719 + 73764 id - 73719 + 73764 function_prototyped - 4084901 + 4087391 id - 4084901 + 4087391 @@ -14442,27 +14379,27 @@ fun_decls - 4546348 + 4548652 id - 4541216 + 4543516 function - 4033111 + 4035569 type_id - 816047 + 816544 name - 1796796 + 1797891 location - 3368702 + 3370755 @@ -14476,7 +14413,7 @@ 1 2 - 4541216 + 4543516 @@ -14492,12 +14429,12 @@ 1 2 - 4536084 + 4538381 2 3 - 5132 + 5135 @@ -14513,7 +14450,7 @@ 1 2 - 4541216 + 4543516 @@ -14529,7 +14466,7 @@ 1 2 - 4541216 + 4543516 @@ -14545,17 +14482,17 @@ 1 2 - 3603858 + 3606521 2 3 - 356466 + 356216 3 7 - 72786 + 72830 @@ -14571,12 +14508,12 @@ 1 2 - 3993452 + 3995885 2 3 - 39659 + 39683 @@ -14592,7 +14529,7 @@ 1 2 - 4033111 + 4035569 @@ -14608,17 +14545,17 @@ 1 2 - 3660781 + 3663012 2 3 - 311674 + 311864 3 6 - 60655 + 60692 @@ -14634,22 +14571,22 @@ 1 2 - 431119 + 431381 2 3 - 273882 + 274048 3 6 - 63454 + 63493 6 - 2477 - 47591 + 2476 + 47620 @@ -14665,22 +14602,22 @@ 1 2 - 515103 + 515417 2 3 - 202961 + 203085 3 7 - 62988 + 63026 7 2192 - 34993 + 35014 @@ -14696,17 +14633,17 @@ 1 2 - 689604 + 690024 2 4 - 67187 + 67228 4 773 - 59255 + 59291 @@ -14722,22 +14659,22 @@ 1 2 - 594888 + 595251 2 3 - 121310 + 121384 3 7 - 63454 + 63493 7 1959 - 36393 + 36415 @@ -14753,27 +14690,27 @@ 1 2 - 1227570 + 1228318 2 3 - 266883 + 267045 3 4 - 77918 + 77966 4 7 - 146039 + 146128 7 986 - 78385 + 78433 @@ -14789,22 +14726,22 @@ 1 2 - 1406736 + 1407593 2 3 - 152104 + 152197 3 5 - 136707 + 136791 5 936 - 101247 + 101309 @@ -14820,17 +14757,17 @@ 1 2 - 1578437 + 1579399 2 4 - 134841 + 134923 4 562 - 83517 + 83568 @@ -14846,27 +14783,27 @@ 1 2 - 1235502 + 1236254 2 3 - 293011 + 293190 3 4 - 78851 + 78899 4 8 - 137174 + 137257 8 542 - 52256 + 52288 @@ -14882,17 +14819,17 @@ 1 2 - 2964644 + 2966451 2 4 - 277614 + 277783 4 55 - 126442 + 126520 @@ -14908,17 +14845,17 @@ 1 2 - 3031832 + 3033679 2 7 - 244020 + 244169 7 55 - 92849 + 92905 @@ -14934,12 +14871,12 @@ 1 2 - 3205399 + 3207353 2 18 - 163302 + 163402 @@ -14955,12 +14892,12 @@ 1 2 - 3230595 + 3232563 2 13 - 138107 + 138191 @@ -14970,22 +14907,22 @@ fun_def - 1888246 + 1888930 id - 1888246 + 1888930 fun_specialized - 26128 + 26144 id - 26128 + 26144 @@ -15003,15 +14940,15 @@ fun_decl_specifiers - 2904922 + 2906692 id - 1688550 + 1689579 name - 2799 + 2801 @@ -15025,17 +14962,17 @@ 1 2 - 490841 + 491140 2 3 - 1179045 + 1179764 3 4 - 18663 + 18674 @@ -15207,11 +15144,11 @@ fun_decl_empty_throws - 1471124 + 1472021 fun_decl - 1471124 + 1472021 @@ -15271,11 +15208,11 @@ fun_decl_empty_noexcept - 863171 + 863230 fun_decl - 863171 + 863230 @@ -15380,19 +15317,19 @@ param_decl_bind - 6991224 + 6995017 id - 6991224 + 6995017 index - 7931 + 7936 fun_decl - 3833415 + 3835284 @@ -15406,7 +15343,7 @@ 1 2 - 6991224 + 6995017 @@ -15422,7 +15359,7 @@ 1 2 - 6991224 + 6995017 @@ -15501,8 +15438,8 @@ 466 - 8216 - 8217 + 8215 + 8216 466 @@ -15582,8 +15519,8 @@ 466 - 8216 - 8217 + 8215 + 8216 466 @@ -15600,27 +15537,27 @@ 1 2 - 1973163 + 1973899 2 3 - 1061001 + 1061647 3 4 - 502505 + 502812 4 8 - 290678 + 290856 8 18 - 6065 + 6069 @@ -15636,27 +15573,27 @@ 1 2 - 1973163 + 1973899 2 3 - 1061001 + 1061647 3 4 - 502505 + 502812 4 8 - 290678 + 290856 8 18 - 6065 + 6069 @@ -15666,27 +15603,27 @@ var_decls - 8105882 + 8110354 id - 8034962 + 8039391 variable - 7022951 + 7027231 type_id - 2042217 + 2043462 name - 667208 + 667614 location - 5308739 + 5311974 @@ -15700,7 +15637,7 @@ 1 2 - 8034962 + 8039391 @@ -15716,12 +15653,12 @@ 1 2 - 7966841 + 7971229 2 3 - 68120 + 68162 @@ -15737,7 +15674,7 @@ 1 2 - 8034962 + 8039391 @@ -15753,12 +15690,12 @@ 1 2 - 8032162 + 8036590 2 3 - 2799 + 2801 @@ -15774,17 +15711,17 @@ 1 2 - 6170977 + 6175205 2 3 - 698469 + 698427 3 7 - 153504 + 153598 @@ -15800,12 +15737,12 @@ 1 2 - 6851717 + 6855892 2 4 - 171234 + 171338 @@ -15821,12 +15758,12 @@ 1 2 - 6907706 + 6911916 2 3 - 115245 + 115315 @@ -15842,17 +15779,17 @@ 1 2 - 6477987 + 6481934 2 3 - 542631 + 542962 3 4 - 2332 + 2334 @@ -15868,27 +15805,27 @@ 1 2 - 1165048 + 1165758 2 3 - 476377 + 477134 3 4 - 95182 + 94773 4 7 - 184765 + 184877 7 762 - 120844 + 120917 @@ -15904,22 +15841,22 @@ 1 2 - 1298490 + 1299281 2 3 - 452115 + 452390 3 6 - 155837 + 155932 6 724 - 135774 + 135857 @@ -15935,17 +15872,17 @@ 1 2 - 1538311 + 1539249 2 3 - 383061 + 383295 3 128 - 120844 + 120917 @@ -15961,22 +15898,22 @@ 1 2 - 1364744 + 1365576 2 3 - 404057 + 404303 3 7 - 173100 + 173206 7 592 - 100314 + 100375 @@ -15992,37 +15929,37 @@ 1 2 - 341069 + 341277 2 3 - 86783 + 86836 3 4 - 48524 + 48553 4 6 - 51790 + 51821 6 12 - 52256 + 52288 12 33 - 50390 + 50421 34 - 2385 - 36393 + 2384 + 36415 @@ -16038,37 +15975,37 @@ 1 2 - 368597 + 368822 2 3 - 77918 + 77966 3 4 - 45258 + 45285 4 6 - 49457 + 49487 6 14 - 53190 + 53222 14 56 - 50857 + 50888 56 2301 - 21929 + 21942 @@ -16084,27 +16021,27 @@ 1 2 - 456781 + 457059 2 3 - 93782 + 93839 3 5 - 46657 + 46686 5 19 - 50857 + 50888 19 1182 - 19129 + 19141 @@ -16120,32 +16057,32 @@ 1 2 - 378862 + 379093 2 3 - 90516 + 90571 3 5 - 59722 + 59758 5 9 - 51323 + 51354 9 21 - 50390 + 50421 21 1010 - 36393 + 36415 @@ -16161,17 +16098,17 @@ 1 2 - 4493625 + 4496363 2 3 - 531433 + 531757 3 - 897 - 283680 + 896 + 283853 @@ -16187,17 +16124,17 @@ 1 2 - 4882752 + 4885727 2 17 - 415255 + 415508 17 892 - 10731 + 10737 @@ -16213,12 +16150,12 @@ 1 2 - 4958804 + 4961826 2 759 - 349934 + 350147 @@ -16234,12 +16171,12 @@ 1 2 - 5299407 + 5302637 2 6 - 9331 + 9337 @@ -16249,26 +16186,26 @@ var_def - 3992985 + 3994952 id - 3992985 + 3994952 var_decl_specifiers - 378395 + 378626 id - 378395 + 378626 name - 1866 + 1867 @@ -16282,7 +16219,7 @@ 1 2 - 378395 + 378626 @@ -16334,19 +16271,19 @@ type_decls - 3281452 + 3283451 id - 3281452 + 3283451 type_id - 3231061 + 3233030 location - 3164340 + 3166269 @@ -16360,7 +16297,7 @@ 1 2 - 3281452 + 3283451 @@ -16376,7 +16313,7 @@ 1 2 - 3281452 + 3283451 @@ -16392,12 +16329,12 @@ 1 2 - 3189536 + 3191479 2 5 - 41525 + 41550 @@ -16413,12 +16350,12 @@ 1 2 - 3189536 + 3191479 2 5 - 41525 + 41550 @@ -16434,12 +16371,12 @@ 1 2 - 3112083 + 3113980 2 20 - 52256 + 52288 @@ -16455,12 +16392,12 @@ 1 2 - 3112083 + 3113980 2 20 - 52256 + 52288 @@ -16470,22 +16407,22 @@ type_def - 2640372 + 2641981 id - 2640372 + 2641981 type_decl_top - 743260 + 743713 type_decl - 743260 + 743713 @@ -16858,19 +16795,19 @@ usings - 369530 + 369755 id - 369530 + 369755 element_id - 315407 + 315599 location - 247753 + 247904 kind @@ -16888,7 +16825,7 @@ 1 2 - 369530 + 369755 @@ -16904,7 +16841,7 @@ 1 2 - 369530 + 369755 @@ -16920,7 +16857,7 @@ 1 2 - 369530 + 369755 @@ -16936,17 +16873,17 @@ 1 2 - 263150 + 263311 2 3 - 50857 + 50888 3 5 - 1399 + 1400 @@ -16962,17 +16899,17 @@ 1 2 - 263150 + 263311 2 3 - 50857 + 50888 3 5 - 1399 + 1400 @@ -16988,7 +16925,7 @@ 1 2 - 315407 + 315599 @@ -17004,22 +16941,22 @@ 1 2 - 202495 + 202618 2 4 - 10731 + 10737 4 5 - 31260 + 31279 5 11 - 3266 + 3268 @@ -17035,22 +16972,22 @@ 1 2 - 202495 + 202618 2 4 - 10731 + 10737 4 5 - 31260 + 31279 5 11 - 3266 + 3268 @@ -17066,7 +17003,7 @@ 1 2 - 247753 + 247904 @@ -17850,23 +17787,23 @@ params - 6350610 + 6354480 id - 6186841 + 6190611 function - 3489546 + 3491673 index - 7931 + 7936 type_id - 1845321 + 1846445 @@ -17880,7 +17817,7 @@ 1 2 - 6186841 + 6190611 @@ -17896,7 +17833,7 @@ 1 2 - 6186841 + 6190611 @@ -17912,12 +17849,12 @@ 1 2 - 6063198 + 6066892 2 4 - 123643 + 123718 @@ -17933,22 +17870,22 @@ 1 2 - 1866317 + 1867454 2 3 - 952288 + 952868 3 4 - 429719 + 429981 4 18 - 241221 + 241368 @@ -17964,22 +17901,22 @@ 1 2 - 1866317 + 1867454 2 3 - 952288 + 952868 3 4 - 429719 + 429981 4 18 - 241221 + 241368 @@ -17995,22 +17932,22 @@ 1 2 - 2164461 + 2165780 2 3 - 826311 + 826815 3 4 - 346201 + 346412 4 12 - 152571 + 152664 @@ -18208,7 +18145,7 @@ 6 7 - 1399 + 1400 7 @@ -18264,22 +18201,22 @@ 1 2 - 1183245 + 1183966 2 3 - 405923 + 406171 3 7 - 153971 + 154064 7 518 - 102180 + 102243 @@ -18295,22 +18232,22 @@ 1 2 - 1403937 + 1404792 2 3 - 212293 + 212422 3 7 - 147439 + 147528 7 502 - 81651 + 81701 @@ -18326,17 +18263,17 @@ 1 2 - 1419334 + 1420199 2 3 - 347135 + 347346 3 13 - 78851 + 78899 @@ -18346,11 +18283,11 @@ overrides - 125735 + 125725 new - 122762 + 122752 old @@ -18368,7 +18305,7 @@ 1 2 - 119797 + 119788 2 @@ -18776,11 +18713,11 @@ localvariables - 576952 + 576945 id - 576952 + 576945 type_id @@ -18788,7 +18725,7 @@ name - 90549 + 90547 @@ -18802,7 +18739,7 @@ 1 2 - 576952 + 576945 @@ -18818,7 +18755,7 @@ 1 2 - 576952 + 576945 @@ -18875,7 +18812,7 @@ 1 2 - 26913 + 26912 2 @@ -18911,12 +18848,12 @@ 1 2 - 57032 + 57031 2 3 - 14285 + 14284 3 @@ -18947,7 +18884,7 @@ 1 2 - 76492 + 76491 2 @@ -18957,7 +18894,7 @@ 3 1486 - 6645 + 6644 @@ -19985,31 +19922,31 @@ builtintypes - 26128 + 26144 id - 26128 + 26144 name - 26128 + 26144 kind - 26128 + 26144 size - 3266 + 3268 sign - 1399 + 1400 alignment - 2332 + 2334 @@ -20023,7 +19960,7 @@ 1 2 - 26128 + 26144 @@ -20039,7 +19976,7 @@ 1 2 - 26128 + 26144 @@ -20055,7 +19992,7 @@ 1 2 - 26128 + 26144 @@ -20071,7 +20008,7 @@ 1 2 - 26128 + 26144 @@ -20087,7 +20024,7 @@ 1 2 - 26128 + 26144 @@ -20103,7 +20040,7 @@ 1 2 - 26128 + 26144 @@ -20119,7 +20056,7 @@ 1 2 - 26128 + 26144 @@ -20135,7 +20072,7 @@ 1 2 - 26128 + 26144 @@ -20151,7 +20088,7 @@ 1 2 - 26128 + 26144 @@ -20167,7 +20104,7 @@ 1 2 - 26128 + 26144 @@ -20183,7 +20120,7 @@ 1 2 - 26128 + 26144 @@ -20199,7 +20136,7 @@ 1 2 - 26128 + 26144 @@ -20215,7 +20152,7 @@ 1 2 - 26128 + 26144 @@ -20231,7 +20168,7 @@ 1 2 - 26128 + 26144 @@ -20247,7 +20184,7 @@ 1 2 - 26128 + 26144 @@ -20406,7 +20343,7 @@ 3 4 - 2332 + 2334 @@ -20422,12 +20359,12 @@ 1 2 - 1866 + 1867 2 3 - 1399 + 1400 @@ -20542,7 +20479,7 @@ 5 6 - 1399 + 1400 @@ -20666,7 +20603,7 @@ 2 3 - 2332 + 2334 @@ -20682,7 +20619,7 @@ 3 4 - 2332 + 2334 @@ -20692,23 +20629,23 @@ derivedtypes - 3667313 + 3669548 id - 3667313 + 3669548 name - 1551842 + 1552788 kind - 2799 + 2801 type_id - 2361357 + 2362796 @@ -20722,7 +20659,7 @@ 1 2 - 3667313 + 3669548 @@ -20738,7 +20675,7 @@ 1 2 - 3667313 + 3669548 @@ -20754,7 +20691,7 @@ 1 2 - 3667313 + 3669548 @@ -20770,17 +20707,17 @@ 1 2 - 1323218 + 1324025 2 4 - 120377 + 120450 4 1153 - 108246 + 108312 @@ -20796,7 +20733,7 @@ 1 2 - 1550909 + 1551854 2 @@ -20817,17 +20754,17 @@ 1 2 - 1323218 + 1324025 2 4 - 120377 + 120450 4 1135 - 108246 + 108312 @@ -20966,22 +20903,22 @@ 1 2 - 1514516 + 1515439 2 3 - 545897 + 546230 3 4 - 218359 + 218492 4 72 - 82584 + 82634 @@ -20997,22 +20934,22 @@ 1 2 - 1525714 + 1526644 2 3 - 538432 + 538760 3 4 - 215559 + 215690 4 72 - 81651 + 81701 @@ -21028,22 +20965,22 @@ 1 2 - 1518715 + 1519641 2 3 - 549630 + 549965 3 4 - 217425 + 217558 4 6 - 75585 + 75631 @@ -21053,11 +20990,11 @@ pointerishsize - 2705693 + 2707342 id - 2705693 + 2707342 size @@ -21079,7 +21016,7 @@ 1 2 - 2705693 + 2707342 @@ -21095,7 +21032,7 @@ 1 2 - 2705693 + 2707342 @@ -21169,23 +21106,23 @@ arraysizes - 88183 + 88237 id - 88183 + 88237 num_elements - 31727 + 31746 bytesize - 33127 + 33147 alignment - 1866 + 1867 @@ -21199,7 +21136,7 @@ 1 2 - 88183 + 88237 @@ -21215,7 +21152,7 @@ 1 2 - 88183 + 88237 @@ -21231,7 +21168,7 @@ 1 2 - 88183 + 88237 @@ -21247,22 +21184,22 @@ 1 2 - 1866 + 1867 2 3 - 23795 + 23810 3 5 - 2799 + 2801 5 13 - 2799 + 2801 13 @@ -21283,17 +21220,17 @@ 1 2 - 26595 + 26611 2 3 - 2332 + 2334 3 7 - 2799 + 2801 @@ -21309,17 +21246,17 @@ 1 2 - 26595 + 26611 2 3 - 2799 + 2801 3 5 - 2332 + 2334 @@ -21335,27 +21272,27 @@ 1 2 - 1866 + 1867 2 3 - 23795 + 23810 3 4 - 3266 + 3268 4 6 - 2332 + 2334 7 16 - 1866 + 1867 @@ -21371,17 +21308,17 @@ 1 2 - 27528 + 27544 2 3 - 3732 + 3734 3 5 - 1866 + 1867 @@ -21397,12 +21334,12 @@ 1 2 - 27528 + 27544 2 3 - 4665 + 4668 4 @@ -21854,19 +21791,19 @@ usertypes - 5230820 + 5234008 id - 5230820 + 5234008 name - 1351680 + 1352503 kind - 5132 + 5135 @@ -21880,7 +21817,7 @@ 1 2 - 5230820 + 5234008 @@ -21896,7 +21833,7 @@ 1 2 - 5230820 + 5234008 @@ -21912,27 +21849,27 @@ 1 2 - 983082 + 983681 2 3 - 153504 + 153598 3 7 - 104513 + 104577 7 61 - 101714 + 101776 65 874 - 8865 + 8870 @@ -21948,17 +21885,17 @@ 1 2 - 1211239 + 1211977 2 3 - 125509 + 125586 3 7 - 14930 + 14939 @@ -22100,19 +22037,19 @@ usertypesize - 1705347 + 1706386 id - 1705347 + 1706386 size - 13530 + 13539 alignment - 2332 + 2334 @@ -22126,7 +22063,7 @@ 1 2 - 1705347 + 1706386 @@ -22142,7 +22079,7 @@ 1 2 - 1705347 + 1706386 @@ -22158,12 +22095,12 @@ 1 2 - 3266 + 3268 2 3 - 4199 + 4201 3 @@ -22214,12 +22151,12 @@ 1 2 - 10264 + 10270 2 3 - 2799 + 2801 3 @@ -22370,15 +22307,15 @@ mangled_name - 9013845 + 9019338 id - 9013845 + 9019338 mangled_name - 6058065 + 6061757 is_complete @@ -22396,7 +22333,7 @@ 1 2 - 9013845 + 9019338 @@ -22412,7 +22349,7 @@ 1 2 - 9013845 + 9019338 @@ -22428,12 +22365,12 @@ 1 2 - 5785583 + 5789108 2 874 - 272482 + 272648 @@ -22449,7 +22386,7 @@ 1 2 - 6058065 + 6061757 @@ -22502,48 +22439,48 @@ is_standard_layout_class - 1253232 + 1253995 id - 1253232 + 1253995 is_complete - 1644692 + 1645694 id - 1644692 + 1645694 is_class_template - 397992 + 398234 id - 397992 + 398234 class_instantiation - 1088996 + 1089659 to - 1088996 + 1089659 from - 168435 + 168537 @@ -22557,7 +22494,7 @@ 1 2 - 1088996 + 1089659 @@ -22573,47 +22510,47 @@ 1 2 - 59722 + 59758 2 3 - 29394 + 29412 3 4 - 15863 + 15873 4 5 - 13064 + 13072 5 6 - 9798 + 9804 6 10 - 12597 + 12605 10 16 - 13064 + 13072 16 70 - 13530 + 13539 70 84 - 1399 + 1400 @@ -22864,19 +22801,19 @@ class_template_argument_value - 495040 + 495342 type_id - 304676 + 304861 index - 1866 + 1867 arg_value - 495040 + 495342 @@ -22890,17 +22827,17 @@ 1 2 - 249619 + 249772 2 3 - 53190 + 53222 3 4 - 1866 + 1867 @@ -22916,22 +22853,22 @@ 1 2 - 189431 + 189546 2 3 - 81184 + 81234 3 4 - 12131 + 12138 4 9 - 21929 + 21942 @@ -23009,7 +22946,7 @@ 1 2 - 495040 + 495342 @@ -23025,7 +22962,7 @@ 1 2 - 495040 + 495342 @@ -23035,15 +22972,15 @@ is_proxy_class_for - 62055 + 62092 id - 62055 + 62092 templ_param_id - 62055 + 62092 @@ -23057,7 +22994,7 @@ 1 2 - 62055 + 62092 @@ -23073,7 +23010,7 @@ 1 2 - 62055 + 62092 @@ -23379,11 +23316,11 @@ is_function_template - 1402070 + 1402925 id - 1402070 + 1402925 @@ -24514,19 +24451,19 @@ routinetypeargs - 982616 + 983214 routine - 423187 + 423445 index - 7931 + 7936 type_id - 226757 + 226895 @@ -24540,27 +24477,27 @@ 1 2 - 152571 + 152664 2 3 - 133908 + 133989 3 4 - 63454 + 63493 4 5 - 45724 + 45752 5 18 - 27528 + 27544 @@ -24576,27 +24513,27 @@ 1 2 - 182432 + 182543 2 3 - 133441 + 133522 3 4 - 58788 + 58824 4 5 - 33593 + 33614 5 11 - 14930 + 14939 @@ -24637,7 +24574,7 @@ 10 11 - 1399 + 1400 13 @@ -24698,7 +24635,7 @@ 4 5 - 1399 + 1400 5 @@ -24754,27 +24691,27 @@ 1 2 - 146505 + 146595 2 3 - 30794 + 30812 3 5 - 16796 + 16807 5 12 - 18196 + 18207 12 110 - 14463 + 14472 @@ -24790,22 +24727,22 @@ 1 2 - 172634 + 172739 2 3 - 30794 + 30812 3 6 - 18663 + 18674 6 14 - 4665 + 4668 @@ -24815,19 +24752,19 @@ ptrtomembers - 37792 + 37815 id - 37792 + 37815 type_id - 37792 + 37815 class_id - 15397 + 15406 @@ -24841,7 +24778,7 @@ 1 2 - 37792 + 37815 @@ -24857,7 +24794,7 @@ 1 2 - 37792 + 37815 @@ -24873,7 +24810,7 @@ 1 2 - 37792 + 37815 @@ -24889,7 +24826,7 @@ 1 2 - 37792 + 37815 @@ -24905,12 +24842,12 @@ 1 2 - 13530 + 13539 8 9 - 1399 + 1400 28 @@ -24931,12 +24868,12 @@ 1 2 - 13530 + 13539 8 9 - 1399 + 1400 28 @@ -24951,15 +24888,15 @@ specifiers - 24728 + 24743 id - 24728 + 24743 str - 24728 + 24743 @@ -24973,7 +24910,7 @@ 1 2 - 24728 + 24743 @@ -24989,7 +24926,7 @@ 1 2 - 24728 + 24743 @@ -24999,15 +24936,15 @@ typespecifiers - 1131454 + 1132144 type_id - 1113258 + 1113936 spec_id - 3732 + 3734 @@ -25021,12 +24958,12 @@ 1 2 - 1095061 + 1095728 2 3 - 18196 + 18207 @@ -25082,15 +25019,15 @@ funspecifiers - 10298338 + 10305080 func_id - 4065772 + 4068249 spec_id - 8398 + 8403 @@ -25104,27 +25041,27 @@ 1 2 - 1356812 + 1357639 2 3 - 640613 + 640536 3 4 - 984482 + 985549 4 5 - 779654 + 780129 5 8 - 304209 + 304395 @@ -25223,8 +25160,8 @@ 466 - 6434 - 6435 + 6435 + 6436 466 @@ -25235,15 +25172,15 @@ varspecifiers - 2244713 + 2246080 var_id - 1224304 + 1225050 spec_id - 3732 + 3734 @@ -25257,22 +25194,22 @@ 1 2 - 729730 + 730174 2 3 - 202495 + 202618 3 4 - 58322 + 58357 4 5 - 233756 + 233898 @@ -25381,19 +25318,19 @@ attributes - 561294 + 561636 id - 561294 + 561636 kind - 1399 + 1400 name - 11197 + 11204 name_space @@ -25401,7 +25338,7 @@ location - 481043 + 481336 @@ -25415,7 +25352,7 @@ 1 2 - 561294 + 561636 @@ -25431,7 +25368,7 @@ 1 2 - 561294 + 561636 @@ -25447,7 +25384,7 @@ 1 2 - 561294 + 561636 @@ -25463,7 +25400,7 @@ 1 2 - 561294 + 561636 @@ -25654,7 +25591,7 @@ 1 2 - 10264 + 10270 2 @@ -25675,7 +25612,7 @@ 1 2 - 11197 + 11204 @@ -25846,17 +25783,17 @@ 1 2 - 431585 + 431848 2 3 - 20062 + 20075 3 7 - 29394 + 29412 @@ -25872,7 +25809,7 @@ 1 2 - 481043 + 481336 @@ -25888,17 +25825,17 @@ 1 2 - 432985 + 433249 2 3 - 19596 + 19608 3 4 - 28461 + 28478 @@ -25914,7 +25851,7 @@ 1 2 - 481043 + 481336 @@ -25924,27 +25861,27 @@ attribute_args - 343868 + 344078 id - 343868 + 344078 kind - 1399 + 1400 attribute - 262684 + 262844 index - 1399 + 1400 location - 327538 + 327738 @@ -25958,7 +25895,7 @@ 1 2 - 343868 + 344078 @@ -25974,7 +25911,7 @@ 1 2 - 343868 + 344078 @@ -25990,7 +25927,7 @@ 1 2 - 343868 + 344078 @@ -26006,7 +25943,7 @@ 1 2 - 343868 + 344078 @@ -26121,17 +26058,17 @@ 1 2 - 197363 + 197483 2 3 - 49457 + 49487 3 4 - 15863 + 15873 @@ -26147,12 +26084,12 @@ 1 2 - 252419 + 252573 2 3 - 10264 + 10270 @@ -26168,17 +26105,17 @@ 1 2 - 197363 + 197483 2 3 - 49457 + 49487 3 4 - 15863 + 15873 @@ -26194,17 +26131,17 @@ 1 2 - 197363 + 197483 2 3 - 49457 + 49487 3 4 - 15863 + 15873 @@ -26319,12 +26256,12 @@ 1 2 - 313541 + 313732 2 7 - 13997 + 14005 @@ -26340,12 +26277,12 @@ 1 2 - 314941 + 315132 2 3 - 12597 + 12605 @@ -26361,12 +26298,12 @@ 1 2 - 313541 + 313732 2 7 - 13997 + 14005 @@ -26382,7 +26319,7 @@ 1 2 - 327538 + 327738 @@ -26392,15 +26329,15 @@ attribute_arg_value - 25195 + 25210 arg - 25195 + 25210 value - 15863 + 15873 @@ -26414,7 +26351,7 @@ 1 2 - 25195 + 25210 @@ -26430,12 +26367,12 @@ 1 2 - 14463 + 14472 2 16 - 1399 + 1400 @@ -26493,15 +26430,15 @@ attribute_arg_constant - 318207 + 318400 arg - 318207 + 318400 constant - 318207 + 318400 @@ -26515,7 +26452,7 @@ 1 2 - 318207 + 318400 @@ -26531,7 +26468,7 @@ 1 2 - 318207 + 318400 @@ -26710,15 +26647,15 @@ funcattributes - 629882 + 630265 func_id - 443250 + 443520 spec_id - 524435 + 524754 @@ -26732,17 +26669,17 @@ 1 2 - 338269 + 338476 2 3 - 64387 + 64427 3 6 - 39659 + 39683 6 @@ -26763,12 +26700,12 @@ 1 2 - 505771 + 506080 2 17 - 18663 + 18674 @@ -26904,15 +26841,15 @@ unspecifiedtype - 9482291 + 9488069 type_id - 9482291 + 9488069 unspecified_type_id - 6486385 + 6490338 @@ -26926,7 +26863,7 @@ 1 2 - 9482291 + 9488069 @@ -26942,17 +26879,17 @@ 1 2 - 4556146 + 4558923 2 3 - 1714678 + 1715723 3 145 - 215559 + 215690 @@ -26962,19 +26899,19 @@ member - 3878673 + 3881037 parent - 545431 + 545763 index - 92849 + 92905 child - 3807287 + 3809607 @@ -26988,47 +26925,47 @@ 1 2 - 129709 + 129788 2 3 - 64854 + 64894 3 4 - 73252 + 73297 4 5 - 75119 + 75165 5 6 - 40592 + 40617 6 8 - 46657 + 46686 8 14 - 45724 + 45752 14 30 - 41525 + 41550 30 200 - 27994 + 28011 @@ -27044,52 +26981,52 @@ 1 2 - 129709 + 129788 2 3 - 64854 + 64894 3 4 - 73252 + 73297 4 5 - 76052 + 76098 5 6 - 39659 + 39683 6 7 - 24262 + 24276 7 9 - 41992 + 42017 9 17 - 43858 + 43885 17 41 - 41525 + 41550 41 200 - 10264 + 10270 @@ -27105,62 +27042,62 @@ 1 2 - 26128 + 26144 2 3 - 6998 + 7002 3 4 - 3732 + 3734 4 5 - 7931 + 7936 5 6 - 5598 + 5602 6 7 - 5598 + 5602 7 9 - 7465 + 7469 9 16 - 6998 + 7002 16 52 - 6998 + 7002 52 107 - 6998 + 7002 108 577 - 6998 + 7002 737 1162 - 1399 + 1400 @@ -27176,62 +27113,62 @@ 1 2 - 26128 + 26144 2 3 - 6998 + 7002 3 4 - 3732 + 3734 4 5 - 7931 + 7936 5 6 - 5598 + 5602 6 7 - 5598 + 5602 7 9 - 7465 + 7469 9 16 - 6998 + 7002 16 52 - 6998 + 7002 52 107 - 6998 + 7002 108 577 - 6998 + 7002 738 1163 - 1399 + 1400 @@ -27247,7 +27184,7 @@ 1 2 - 3807287 + 3809607 @@ -27263,12 +27200,12 @@ 1 2 - 3735900 + 3738177 2 3 - 71386 + 71430 @@ -28798,15 +28735,15 @@ commentbinding - 3089221 + 3091104 id - 2443942 + 2445431 element - 3012702 + 3014538 @@ -28820,12 +28757,12 @@ 1 2 - 2366956 + 2368399 2 97 - 76985 + 77032 @@ -28841,12 +28778,12 @@ 1 2 - 2936183 + 2937972 2 3 - 76519 + 76565 @@ -28856,15 +28793,15 @@ exprconv - 7032993 + 7032991 converted - 7032993 + 7032991 conversion - 7032993 + 7032991 @@ -28878,7 +28815,7 @@ 1 2 - 7032993 + 7032991 @@ -28894,7 +28831,7 @@ 1 2 - 7032993 + 7032991 @@ -29251,15 +29188,15 @@ namespaces - 12131 + 12138 id - 12131 + 12138 name - 9798 + 9804 @@ -29273,7 +29210,7 @@ 1 2 - 12131 + 12138 @@ -29289,7 +29226,7 @@ 1 2 - 8398 + 8403 2 @@ -29309,26 +29246,26 @@ namespace_inline - 1399 + 1400 id - 1399 + 1400 namespacembrs - 2386553 + 2388007 parentid - 10264 + 10270 memberid - 2386553 + 2388007 @@ -29342,7 +29279,7 @@ 1 2 - 1866 + 1867 2 @@ -29403,7 +29340,7 @@ 1 2 - 2386553 + 2388007 @@ -29899,7 +29836,7 @@ qualifyingelement - 97537 + 97518 location @@ -30013,7 +29950,7 @@ 1 2 - 58420 + 58401 2 @@ -30049,7 +29986,7 @@ 1 2 - 58420 + 58401 2 @@ -30085,7 +30022,7 @@ 1 2 - 63834 + 63815 2 @@ -30198,12 +30135,12 @@ 1 2 - 137054 + 137073 2 3 - 55703 + 55684 3 @@ -32144,7 +32081,7 @@ expr_types - 18451397 + 18451442 id @@ -32170,12 +32107,12 @@ 1 2 - 18188166 + 18188121 2 3 - 131615 + 131660 @@ -32212,17 +32149,17 @@ 2 3 - 249345 + 249334 3 4 - 102817 + 102840 4 5 - 81877 + 81865 5 @@ -32237,12 +32174,12 @@ 14 41 - 91653 + 91664 41 125325 - 44590 + 44579 @@ -33769,11 +33706,11 @@ lambdas - 21462 + 21475 expr - 21462 + 21475 default_capture @@ -33795,7 +33732,7 @@ 1 2 - 21462 + 21475 @@ -33811,7 +33748,7 @@ 1 2 - 21462 + 21475 @@ -33885,15 +33822,15 @@ lambda_capture - 27994 + 28011 id - 27994 + 28011 lambda - 20529 + 20541 index @@ -33901,7 +33838,7 @@ field - 27994 + 28011 captured_by_reference @@ -33913,7 +33850,7 @@ location - 2799 + 2801 @@ -33927,7 +33864,7 @@ 1 2 - 27994 + 28011 @@ -33943,7 +33880,7 @@ 1 2 - 27994 + 28011 @@ -33959,7 +33896,7 @@ 1 2 - 27994 + 28011 @@ -33975,7 +33912,7 @@ 1 2 - 27994 + 28011 @@ -33991,7 +33928,7 @@ 1 2 - 27994 + 28011 @@ -34007,7 +33944,7 @@ 1 2 - 27994 + 28011 @@ -34023,12 +33960,12 @@ 1 2 - 13064 + 13072 2 3 - 7465 + 7469 @@ -34044,12 +33981,12 @@ 1 2 - 13064 + 13072 2 3 - 7465 + 7469 @@ -34065,12 +34002,12 @@ 1 2 - 13064 + 13072 2 3 - 7465 + 7469 @@ -34086,7 +34023,7 @@ 1 2 - 20529 + 20541 @@ -34102,7 +34039,7 @@ 1 2 - 20529 + 20541 @@ -34118,12 +34055,12 @@ 1 2 - 13064 + 13072 2 3 - 7465 + 7469 @@ -34255,7 +34192,7 @@ 1 2 - 27994 + 28011 @@ -34271,7 +34208,7 @@ 1 2 - 27994 + 28011 @@ -34287,7 +34224,7 @@ 1 2 - 27994 + 28011 @@ -34303,7 +34240,7 @@ 1 2 - 27994 + 28011 @@ -34319,7 +34256,7 @@ 1 2 - 27994 + 28011 @@ -34335,7 +34272,7 @@ 1 2 - 27994 + 28011 @@ -34543,7 +34480,7 @@ 8 9 - 1866 + 1867 14 @@ -34564,7 +34501,7 @@ 8 9 - 1866 + 1867 14 @@ -34585,7 +34522,7 @@ 1 2 - 2799 + 2801 @@ -34601,7 +34538,7 @@ 8 9 - 1866 + 1867 14 @@ -34622,7 +34559,7 @@ 1 2 - 2799 + 2801 @@ -34638,7 +34575,7 @@ 1 2 - 2799 + 2801 @@ -36381,11 +36318,11 @@ stmt_decl_bind - 580849 + 580842 stmt - 541066 + 541060 num @@ -36393,7 +36330,7 @@ decl - 580745 + 580738 @@ -36407,7 +36344,7 @@ 1 2 - 520377 + 520371 2 @@ -36428,7 +36365,7 @@ 1 2 - 520377 + 520371 2 @@ -36631,7 +36568,7 @@ 1 2 - 580707 + 580700 2 @@ -36652,7 +36589,7 @@ 1 2 - 580745 + 580738 @@ -36662,11 +36599,11 @@ stmt_decl_entry_bind - 580849 + 580842 stmt - 541066 + 541060 num @@ -36674,7 +36611,7 @@ decl_entry - 580791 + 580784 @@ -36688,7 +36625,7 @@ 1 2 - 520377 + 520371 2 @@ -36709,7 +36646,7 @@ 1 2 - 520377 + 520371 2 @@ -36912,7 +36849,7 @@ 1 2 - 580770 + 580763 3 @@ -36933,7 +36870,7 @@ 1 2 - 580791 + 580784 @@ -36943,15 +36880,15 @@ blockscope - 1410469 + 1410861 block - 1410469 + 1410861 enclosing - 1295224 + 1295546 @@ -36965,7 +36902,7 @@ 1 2 - 1410469 + 1410861 @@ -36981,12 +36918,12 @@ 1 2 - 1229903 + 1230185 2 13 - 65321 + 65360 @@ -37182,19 +37119,19 @@ preprocdirects - 4188015 + 4190567 id - 4188015 + 4190567 kind - 5132 + 5135 location - 4147423 + 4149950 @@ -37208,7 +37145,7 @@ 1 2 - 4188015 + 4190567 @@ -37224,7 +37161,7 @@ 1 2 - 4188015 + 4190567 @@ -37372,7 +37309,7 @@ 1 2 - 4146956 + 4149483 88 @@ -37393,7 +37330,7 @@ 1 2 - 4147423 + 4149950 @@ -37403,15 +37340,15 @@ preprocpair - 1430532 + 1431403 begin - 1196309 + 1197038 elseelifend - 1430532 + 1431403 @@ -37425,17 +37362,17 @@ 1 2 - 977950 + 978546 2 3 - 208094 + 208221 3 11 - 10264 + 10270 @@ -37451,7 +37388,7 @@ 1 2 - 1430532 + 1431403 @@ -37461,22 +37398,22 @@ preproctrue - 766589 + 767056 branch - 766589 + 767056 preprocfalse - 331271 + 331473 branch - 331271 + 331473 @@ -37629,15 +37566,15 @@ includes - 313074 + 313265 id - 313074 + 313265 included - 117111 + 117182 @@ -37651,7 +37588,7 @@ 1 2 - 313074 + 313265 @@ -37667,32 +37604,32 @@ 1 2 - 61121 + 61159 2 3 - 21929 + 21942 3 4 - 12597 + 12605 4 6 - 10264 + 10270 6 14 - 8865 + 8870 14 47 - 2332 + 2334 diff --git a/cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/old.dbscheme b/cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/old.dbscheme deleted file mode 100644 index e51fad7a243..00000000000 --- a/cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/old.dbscheme +++ /dev/null @@ -1,2323 +0,0 @@ - -/** - * An invocation of the compiler. Note that more than one file may be - * compiled per invocation. For example, this command compiles three - * source files: - * - * gcc -c f1.c f2.c f3.c - * - * The `id` simply identifies the invocation, while `cwd` is the working - * directory from which the compiler was invoked. - */ -compilations( - /** - * An invocation of the compiler. Note that more than one file may - * be compiled per invocation. For example, this command compiles - * three source files: - * - * gcc -c f1.c f2.c f3.c - */ - unique int id : @compilation, - string cwd : string ref -); - -/** - * The arguments that were passed to the extractor for a compiler - * invocation. If `id` is for the compiler invocation - * - * gcc -c f1.c f2.c f3.c - * - * then typically there will be rows for - * - * num | arg - * --- | --- - * 0 | *path to extractor* - * 1 | `--mimic` - * 2 | `/usr/bin/gcc` - * 3 | `-c` - * 4 | f1.c - * 5 | f2.c - * 6 | f3.c - */ -#keyset[id, num] -compilation_args( - int id : @compilation ref, - int num : int ref, - string arg : string ref -); - -/** - * The source files that are compiled by a compiler invocation. - * If `id` is for the compiler invocation - * - * gcc -c f1.c f2.c f3.c - * - * then there will be rows for - * - * num | arg - * --- | --- - * 0 | f1.c - * 1 | f2.c - * 2 | f3.c - * - * Note that even if those files `#include` headers, those headers - * do not appear as rows. - */ -#keyset[id, num] -compilation_compiling_files( - int id : @compilation ref, - int num : int ref, - int file : @file ref -); - -/** - * The time taken by the extractor for a compiler invocation. - * - * For each file `num`, there will be rows for - * - * kind | seconds - * ---- | --- - * 1 | CPU seconds used by the extractor frontend - * 2 | Elapsed seconds during the extractor frontend - * 3 | CPU seconds used by the extractor backend - * 4 | Elapsed seconds during the extractor backend - */ -#keyset[id, num, kind] -compilation_time( - int id : @compilation ref, - int num : int ref, - /* kind: - 1 = frontend_cpu_seconds - 2 = frontend_elapsed_seconds - 3 = extractor_cpu_seconds - 4 = extractor_elapsed_seconds - */ - int kind : int ref, - float seconds : float ref -); - -/** - * An error or warning generated by the extractor. - * The diagnostic message `diagnostic` was generated during compiler - * invocation `compilation`, and is the `file_number_diagnostic_number`th - * message generated while extracting the `file_number`th file of that - * invocation. - */ -#keyset[compilation, file_number, file_number_diagnostic_number] -diagnostic_for( - int diagnostic : @diagnostic ref, - int compilation : @compilation ref, - int file_number : int ref, - int file_number_diagnostic_number : int ref -); - -/** - * If extraction was successful, then `cpu_seconds` and - * `elapsed_seconds` are the CPU time and elapsed time (respectively) - * that extraction took for compiler invocation `id`. - */ -compilation_finished( - unique int id : @compilation ref, - float cpu_seconds : float ref, - float elapsed_seconds : float ref -); - - -/** - * External data, loaded from CSV files during snapshot creation. See - * [Tutorial: Incorporating external data](https://help.semmle.com/wiki/display/SD/Tutorial%3A+Incorporating+external+data) - * for more information. - */ -externalData( - int id : @externalDataElement, - string path : string ref, - int column: int ref, - string value : string ref -); - -/** - * The source location of the snapshot. - */ -sourceLocationPrefix(string prefix : string ref); - -/** - * Information about packages that provide code used during compilation. - * The `id` is just a unique identifier. - * The `namespace` is typically the name of the package manager that - * provided the package (e.g. "dpkg" or "yum"). - * The `package_name` is the name of the package, and `version` is its - * version (as a string). - */ -external_packages( - unique int id: @external_package, - string namespace : string ref, - string package_name : string ref, - string version : string ref -); - -/** - * Holds if File `fileid` was provided by package `package`. - */ -header_to_external_package( - int fileid : @file ref, - int package : @external_package ref -); - -/* - * Version history - */ - -svnentries( - unique int id : @svnentry, - string revision : string ref, - string author : string ref, - date revisionDate : date ref, - int changeSize : int ref -) - -svnaffectedfiles( - int id : @svnentry ref, - int file : @file ref, - string action : string ref -) - -svnentrymsg( - unique int id : @svnentry ref, - string message : string ref -) - -svnchurn( - int commit : @svnentry ref, - int file : @file ref, - int addedLines : int ref, - int deletedLines : int ref -) - -/* - * C++ dbscheme - */ - -extractor_version( - string codeql_version: string ref, - string frontend_version: string ref -) - -@location = @location_stmt | @location_expr | @location_default ; - -/** - * The location of an element that is not an expression or a statement. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `file`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ -locations_default( - /** The location of an element that is not an expression or a statement. */ - unique int id: @location_default, - int container: @container ref, - int startLine: int ref, - int startColumn: int ref, - int endLine: int ref, - int endColumn: int ref -); - -/** - * The location of a statement. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `file`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ -locations_stmt( - /** The location of a statement. */ - unique int id: @location_stmt, - int container: @container ref, - int startLine: int ref, - int startColumn: int ref, - int endLine: int ref, - int endColumn: int ref -); - -/** - * The location of an expression. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `file`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ -locations_expr( - /** The location of an expression. */ - unique int id: @location_expr, - int container: @container ref, - int startLine: int ref, - int startColumn: int ref, - int endLine: int ref, - int endColumn: int ref -); - -/** An element for which line-count information is available. */ -@sourceline = @file | @function | @variable | @enumconstant | @xmllocatable; - -numlines( - int element_id: @sourceline ref, - int num_lines: int ref, - int num_code: int ref, - int num_comment: int ref -); - -diagnostics( - unique int id: @diagnostic, - int severity: int ref, - string error_tag: string ref, - string error_message: string ref, - string full_error_message: string ref, - int location: @location_default ref -); - -files( - unique int id: @file, - string name: string ref -); - -folders( - unique int id: @folder, - string name: string ref -); - -@container = @folder | @file - -containerparent( - int parent: @container ref, - unique int child: @container ref -); - -fileannotations( - int id: @file ref, - int kind: int ref, - string name: string ref, - string value: string ref -); - -inmacroexpansion( - int id: @element ref, - int inv: @macroinvocation ref -); - -affectedbymacroexpansion( - int id: @element ref, - int inv: @macroinvocation ref -); - -case @macroinvocation.kind of - 1 = @macro_expansion -| 2 = @other_macro_reference -; - -macroinvocations( - unique int id: @macroinvocation, - int macro_id: @ppd_define ref, - int location: @location_default ref, - int kind: int ref -); - -macroparent( - unique int id: @macroinvocation ref, - int parent_id: @macroinvocation ref -); - -// a macroinvocation may be part of another location -// the way to find a constant expression that uses a macro -// is thus to find a constant expression that has a location -// to which a macro invocation is bound -macrolocationbind( - int id: @macroinvocation ref, - int location: @location ref -); - -#keyset[invocation, argument_index] -macro_argument_unexpanded( - int invocation: @macroinvocation ref, - int argument_index: int ref, - string text: string ref -); - -#keyset[invocation, argument_index] -macro_argument_expanded( - int invocation: @macroinvocation ref, - int argument_index: int ref, - string text: string ref -); - -/* -case @function.kind of - 1 = @normal_function -| 2 = @constructor -| 3 = @destructor -| 4 = @conversion_function -| 5 = @operator -| 6 = @builtin_function // GCC built-in functions, e.g. __builtin___memcpy_chk -| 7 = @user_defined_literal -| 8 = @deduction_guide -; -*/ - -functions( - unique int id: @function, - string name: string ref, - int kind: int ref -); - -function_entry_point( - int id: @function ref, - unique int entry_point: @stmt ref -); - -function_return_type( - int id: @function ref, - int return_type: @type ref -); - -/** - * If `function` is a coroutine, then this gives the `std::experimental::resumable_traits` - * instance associated with it, and the variables representing the `handle` and `promise` - * for it. - */ -coroutine( - unique int function: @function ref, - int traits: @type ref -); - -/* -case @coroutine_placeholder_variable.kind of - 1 = @handle -| 2 = @promise -| 3 = @init_await_resume -; -*/ - -coroutine_placeholder_variable( - unique int placeholder_variable: @variable ref, - int kind: int ref, - int function: @function ref -) - -/** The `new` function used for allocating the coroutine state, if any. */ -coroutine_new( - unique int function: @function ref, - int new: @function ref -); - -/** The `delete` function used for deallocating the coroutine state, if any. */ -coroutine_delete( - unique int function: @function ref, - int delete: @function ref -); - -purefunctions(unique int id: @function ref); - -function_deleted(unique int id: @function ref); - -function_defaulted(unique int id: @function ref); - -function_prototyped(unique int id: @function ref) - -deduction_guide_for_class( - int id: @function ref, - int class_template: @usertype ref -) - -member_function_this_type( - unique int id: @function ref, - int this_type: @type ref -); - -#keyset[id, type_id] -fun_decls( - int id: @fun_decl, - int function: @function ref, - int type_id: @type ref, - string name: string ref, - int location: @location_default ref -); -fun_def(unique int id: @fun_decl ref); -fun_specialized(unique int id: @fun_decl ref); -fun_implicit(unique int id: @fun_decl ref); -fun_decl_specifiers( - int id: @fun_decl ref, - string name: string ref -) -#keyset[fun_decl, index] -fun_decl_throws( - int fun_decl: @fun_decl ref, - int index: int ref, - int type_id: @type ref -); -/* an empty throw specification is different from none */ -fun_decl_empty_throws(unique int fun_decl: @fun_decl ref); -fun_decl_noexcept( - int fun_decl: @fun_decl ref, - int constant: @expr ref -); -fun_decl_empty_noexcept(int fun_decl: @fun_decl ref); -fun_decl_typedef_type( - unique int fun_decl: @fun_decl ref, - int typedeftype_id: @usertype ref -); - -param_decl_bind( - unique int id: @var_decl ref, - int index: int ref, - int fun_decl: @fun_decl ref -); - -#keyset[id, type_id] -var_decls( - int id: @var_decl, - int variable: @variable ref, - int type_id: @type ref, - string name: string ref, - int location: @location_default ref -); -var_def(unique int id: @var_decl ref); -var_decl_specifiers( - int id: @var_decl ref, - string name: string ref -) -is_structured_binding(unique int id: @variable ref); - -type_decls( - unique int id: @type_decl, - int type_id: @type ref, - int location: @location_default ref -); -type_def(unique int id: @type_decl ref); -type_decl_top( - unique int type_decl: @type_decl ref -); - -namespace_decls( - unique int id: @namespace_decl, - int namespace_id: @namespace ref, - int location: @location_default ref, - int bodylocation: @location_default ref -); - -case @using.kind of - 1 = @using_declaration -| 2 = @using_directive -| 3 = @using_enum_declaration -; - -usings( - unique int id: @using, - int element_id: @element ref, - int location: @location_default ref, - int kind: int ref -); - -/** The element which contains the `using` declaration. */ -using_container( - int parent: @element ref, - int child: @using ref -); - -static_asserts( - unique int id: @static_assert, - int condition : @expr ref, - string message : string ref, - int location: @location_default ref, - int enclosing : @element ref -); - -// each function has an ordered list of parameters -#keyset[id, type_id] -#keyset[function, index, type_id] -params( - int id: @parameter, - int function: @parameterized_element ref, - int index: int ref, - int type_id: @type ref -); - -overrides( - int new: @function ref, - int old: @function ref -); - -#keyset[id, type_id] -membervariables( - int id: @membervariable, - int type_id: @type ref, - string name: string ref -); - -#keyset[id, type_id] -globalvariables( - int id: @globalvariable, - int type_id: @type ref, - string name: string ref -); - -#keyset[id, type_id] -localvariables( - int id: @localvariable, - int type_id: @type ref, - string name: string ref -); - -autoderivation( - unique int var: @variable ref, - int derivation_type: @type ref -); - -orphaned_variables( - int var: @localvariable ref, - int function: @function ref -) - -enumconstants( - unique int id: @enumconstant, - int parent: @usertype ref, - int index: int ref, - int type_id: @type ref, - string name: string ref, - int location: @location_default ref -); - -@variable = @localscopevariable | @globalvariable | @membervariable; - -@localscopevariable = @localvariable | @parameter; - -/** - * Built-in types are the fundamental types, e.g., integral, floating, and void. - */ -case @builtintype.kind of - 1 = @errortype -| 2 = @unknowntype -| 3 = @void -| 4 = @boolean -| 5 = @char -| 6 = @unsigned_char -| 7 = @signed_char -| 8 = @short -| 9 = @unsigned_short -| 10 = @signed_short -| 11 = @int -| 12 = @unsigned_int -| 13 = @signed_int -| 14 = @long -| 15 = @unsigned_long -| 16 = @signed_long -| 17 = @long_long -| 18 = @unsigned_long_long -| 19 = @signed_long_long -// ... 20 Microsoft-specific __int8 -// ... 21 Microsoft-specific __int16 -// ... 22 Microsoft-specific __int32 -// ... 23 Microsoft-specific __int64 -| 24 = @float -| 25 = @double -| 26 = @long_double -| 27 = @complex_float // C99-specific _Complex float -| 28 = @complex_double // C99-specific _Complex double -| 29 = @complex_long_double // C99-specific _Complex long double -| 30 = @imaginary_float // C99-specific _Imaginary float -| 31 = @imaginary_double // C99-specific _Imaginary double -| 32 = @imaginary_long_double // C99-specific _Imaginary long double -| 33 = @wchar_t // Microsoft-specific -| 34 = @decltype_nullptr // C++11 -| 35 = @int128 // __int128 -| 36 = @unsigned_int128 // unsigned __int128 -| 37 = @signed_int128 // signed __int128 -| 38 = @float128 // __float128 -| 39 = @complex_float128 // _Complex __float128 -| 40 = @decimal32 // _Decimal32 -| 41 = @decimal64 // _Decimal64 -| 42 = @decimal128 // _Decimal128 -| 43 = @char16_t -| 44 = @char32_t -| 45 = @std_float32 // _Float32 -| 46 = @float32x // _Float32x -| 47 = @std_float64 // _Float64 -| 48 = @float64x // _Float64x -| 49 = @std_float128 // _Float128 -// ... 50 _Float128x -| 51 = @char8_t -| 52 = @float16 // _Float16 -| 53 = @complex_float16 // _Complex _Float16 -| 54 = @fp16 // __fp16 -| 55 = @std_bfloat16 // __bf16 -| 56 = @std_float16 // std::float16_t -| 57 = @complex_std_float32 // _Complex _Float32 -| 58 = @complex_float32x // _Complex _Float32x -| 59 = @complex_std_float64 // _Complex _Float64 -| 60 = @complex_float64x // _Complex _Float64x -| 61 = @complex_std_float128 // _Complex _Float128 -; - -builtintypes( - unique int id: @builtintype, - string name: string ref, - int kind: int ref, - int size: int ref, - int sign: int ref, - int alignment: int ref -); - -/** - * Derived types are types that are directly derived from existing types and - * point to, refer to, transform type data to return a new type. - */ -case @derivedtype.kind of - 1 = @pointer -| 2 = @reference -| 3 = @type_with_specifiers -| 4 = @array -| 5 = @gnu_vector -| 6 = @routineptr -| 7 = @routinereference -| 8 = @rvalue_reference // C++11 -// ... 9 type_conforming_to_protocols deprecated -| 10 = @block -; - -derivedtypes( - unique int id: @derivedtype, - string name: string ref, - int kind: int ref, - int type_id: @type ref -); - -pointerishsize(unique int id: @derivedtype ref, - int size: int ref, - int alignment: int ref); - -arraysizes( - unique int id: @derivedtype ref, - int num_elements: int ref, - int bytesize: int ref, - int alignment: int ref -); - -typedefbase( - unique int id: @usertype ref, - int type_id: @type ref -); - -/** - * An instance of the C++11 `decltype` operator. For example: - * ``` - * int a; - * decltype(1+a) b; - * ``` - * Here `expr` is `1+a`. - * - * Sometimes an additional pair of parentheses around the expression - * would change the semantics of this decltype, e.g. - * ``` - * struct A { double x; }; - * const A* a = new A(); - * decltype( a->x ); // type is double - * decltype((a->x)); // type is const double& - * ``` - * (Please consult the C++11 standard for more details). - * `parentheses_would_change_meaning` is `true` iff that is the case. - */ -#keyset[id, expr] -decltypes( - int id: @decltype, - int expr: @expr ref, - int base_type: @type ref, - boolean parentheses_would_change_meaning: boolean ref -); - -/* -case @usertype.kind of - 1 = @struct -| 2 = @class -| 3 = @union -| 4 = @enum -| 5 = @typedef // classic C: typedef typedef type name -| 6 = @template -| 7 = @template_parameter -| 8 = @template_template_parameter -| 9 = @proxy_class // a proxy class associated with a template parameter -// ... 10 objc_class deprecated -// ... 11 objc_protocol deprecated -// ... 12 objc_category deprecated -| 13 = @scoped_enum -| 14 = @using_alias // a using name = type style typedef -; -*/ - -usertypes( - unique int id: @usertype, - string name: string ref, - int kind: int ref -); - -usertypesize( - unique int id: @usertype ref, - int size: int ref, - int alignment: int ref -); - -usertype_final(unique int id: @usertype ref); - -usertype_uuid( - unique int id: @usertype ref, - string uuid: string ref -); - -mangled_name( - unique int id: @declaration ref, - int mangled_name : @mangledname, - boolean is_complete: boolean ref -); - -is_pod_class(unique int id: @usertype ref); -is_standard_layout_class(unique int id: @usertype ref); - -is_complete(unique int id: @usertype ref); - -is_class_template(unique int id: @usertype ref); -class_instantiation( - int to: @usertype ref, - int from: @usertype ref -); -class_template_argument( - int type_id: @usertype ref, - int index: int ref, - int arg_type: @type ref -); -class_template_argument_value( - int type_id: @usertype ref, - int index: int ref, - int arg_value: @expr ref -); - -is_proxy_class_for( - unique int id: @usertype ref, - unique int templ_param_id: @usertype ref -); - -type_mentions( - unique int id: @type_mention, - int type_id: @type ref, - int location: @location ref, - // a_symbol_reference_kind from the frontend. - int kind: int ref -); - -is_function_template(unique int id: @function ref); -function_instantiation( - unique int to: @function ref, - int from: @function ref -); -function_template_argument( - int function_id: @function ref, - int index: int ref, - int arg_type: @type ref -); -function_template_argument_value( - int function_id: @function ref, - int index: int ref, - int arg_value: @expr ref -); - -is_variable_template(unique int id: @variable ref); -variable_instantiation( - unique int to: @variable ref, - int from: @variable ref -); -variable_template_argument( - int variable_id: @variable ref, - int index: int ref, - int arg_type: @type ref -); -variable_template_argument_value( - int variable_id: @variable ref, - int index: int ref, - int arg_value: @expr ref -); - -routinetypes( - unique int id: @routinetype, - int return_type: @type ref -); - -routinetypeargs( - int routine: @routinetype ref, - int index: int ref, - int type_id: @type ref -); - -ptrtomembers( - unique int id: @ptrtomember, - int type_id: @type ref, - int class_id: @type ref -); - -/* - specifiers for types, functions, and variables - - "public", - "protected", - "private", - - "const", - "volatile", - "static", - - "pure", - "virtual", - "sealed", // Microsoft - "__interface", // Microsoft - "inline", - "explicit", - - "near", // near far extension - "far", // near far extension - "__ptr32", // Microsoft - "__ptr64", // Microsoft - "__sptr", // Microsoft - "__uptr", // Microsoft - "dllimport", // Microsoft - "dllexport", // Microsoft - "thread", // Microsoft - "naked", // Microsoft - "microsoft_inline", // Microsoft - "forceinline", // Microsoft - "selectany", // Microsoft - "nothrow", // Microsoft - "novtable", // Microsoft - "noreturn", // Microsoft - "noinline", // Microsoft - "noalias", // Microsoft - "restrict", // Microsoft -*/ - -specifiers( - unique int id: @specifier, - unique string str: string ref -); - -typespecifiers( - int type_id: @type ref, - int spec_id: @specifier ref -); - -funspecifiers( - int func_id: @function ref, - int spec_id: @specifier ref -); - -varspecifiers( - int var_id: @accessible ref, - int spec_id: @specifier ref -); - -explicit_specifier_exprs( - unique int func_id: @function ref, - int constant: @expr ref -) - -attributes( - unique int id: @attribute, - int kind: int ref, - string name: string ref, - string name_space: string ref, - int location: @location_default ref -); - -case @attribute.kind of - 0 = @gnuattribute -| 1 = @stdattribute -| 2 = @declspec -| 3 = @msattribute -| 4 = @alignas -// ... 5 @objc_propertyattribute deprecated -; - -attribute_args( - unique int id: @attribute_arg, - int kind: int ref, - int attribute: @attribute ref, - int index: int ref, - int location: @location_default ref -); - -case @attribute_arg.kind of - 0 = @attribute_arg_empty -| 1 = @attribute_arg_token -| 2 = @attribute_arg_constant -| 3 = @attribute_arg_type -| 4 = @attribute_arg_constant_expr -| 5 = @attribute_arg_expr -; - -attribute_arg_value( - unique int arg: @attribute_arg ref, - string value: string ref -); -attribute_arg_type( - unique int arg: @attribute_arg ref, - int type_id: @type ref -); -attribute_arg_constant( - unique int arg: @attribute_arg ref, - int constant: @expr ref -) -attribute_arg_expr( - unique int arg: @attribute_arg ref, - int expr: @expr ref -) -attribute_arg_name( - unique int arg: @attribute_arg ref, - string name: string ref -); - -typeattributes( - int type_id: @type ref, - int spec_id: @attribute ref -); - -funcattributes( - int func_id: @function ref, - int spec_id: @attribute ref -); - -varattributes( - int var_id: @accessible ref, - int spec_id: @attribute ref -); - -stmtattributes( - int stmt_id: @stmt ref, - int spec_id: @attribute ref -); - -@type = @builtintype - | @derivedtype - | @usertype - /* TODO | @fixedpointtype */ - | @routinetype - | @ptrtomember - | @decltype; - -unspecifiedtype( - unique int type_id: @type ref, - int unspecified_type_id: @type ref -); - -member( - int parent: @type ref, - int index: int ref, - int child: @member ref -); - -@enclosingfunction_child = @usertype | @variable | @namespace - -enclosingfunction( - unique int child: @enclosingfunction_child ref, - int parent: @function ref -); - -derivations( - unique int derivation: @derivation, - int sub: @type ref, - int index: int ref, - int super: @type ref, - int location: @location_default ref -); - -derspecifiers( - int der_id: @derivation ref, - int spec_id: @specifier ref -); - -/** - * Contains the byte offset of the base class subobject within the derived - * class. Only holds for non-virtual base classes, but see table - * `virtual_base_offsets` for offsets of virtual base class subobjects. - */ -direct_base_offsets( - unique int der_id: @derivation ref, - int offset: int ref -); - -/** - * Contains the byte offset of the virtual base class subobject for class - * `super` within a most-derived object of class `sub`. `super` can be either a - * direct or indirect base class. - */ -#keyset[sub, super] -virtual_base_offsets( - int sub: @usertype ref, - int super: @usertype ref, - int offset: int ref -); - -frienddecls( - unique int id: @frienddecl, - int type_id: @type ref, - int decl_id: @declaration ref, - int location: @location_default ref -); - -@declaredtype = @usertype ; - -@declaration = @function - | @declaredtype - | @variable - | @enumconstant - | @frienddecl; - -@member = @membervariable - | @function - | @declaredtype - | @enumconstant; - -@locatable = @diagnostic - | @declaration - | @ppd_include - | @ppd_define - | @macroinvocation - /*| @funcall*/ - | @xmllocatable - | @attribute - | @attribute_arg; - -@namedscope = @namespace | @usertype; - -@element = @locatable - | @file - | @folder - | @specifier - | @type - | @expr - | @namespace - | @initialiser - | @stmt - | @derivation - | @comment - | @preprocdirect - | @fun_decl - | @var_decl - | @type_decl - | @namespace_decl - | @using - | @namequalifier - | @specialnamequalifyingelement - | @static_assert - | @type_mention - | @lambdacapture; - -@exprparent = @element; - -comments( - unique int id: @comment, - string contents: string ref, - int location: @location_default ref -); - -commentbinding( - int id: @comment ref, - int element: @element ref -); - -exprconv( - int converted: @expr ref, - unique int conversion: @expr ref -); - -compgenerated(unique int id: @element ref); - -/** - * `destructor_call` destructs the `i`'th entity that should be - * destructed following `element`. Note that entities should be - * destructed in reverse construction order, so for a given `element` - * these should be called from highest to lowest `i`. - */ -#keyset[element, destructor_call] -#keyset[element, i] -synthetic_destructor_call( - int element: @element ref, - int i: int ref, - int destructor_call: @routineexpr ref -); - -namespaces( - unique int id: @namespace, - string name: string ref -); - -namespace_inline( - unique int id: @namespace ref -); - -namespacembrs( - int parentid: @namespace ref, - unique int memberid: @namespacembr ref -); - -@namespacembr = @declaration | @namespace; - -exprparents( - int expr_id: @expr ref, - int child_index: int ref, - int parent_id: @exprparent ref -); - -expr_isload(unique int expr_id: @expr ref); - -@cast = @c_style_cast - | @const_cast - | @dynamic_cast - | @reinterpret_cast - | @static_cast - ; - -/* -case @conversion.kind of - 0 = @simple_conversion // a numeric conversion, qualification conversion, or a reinterpret_cast -| 1 = @bool_conversion // conversion to 'bool' -| 2 = @base_class_conversion // a derived-to-base conversion -| 3 = @derived_class_conversion // a base-to-derived conversion -| 4 = @pm_base_class_conversion // a derived-to-base conversion of a pointer to member -| 5 = @pm_derived_class_conversion // a base-to-derived conversion of a pointer to member -| 6 = @glvalue_adjust // an adjustment of the type of a glvalue -| 7 = @prvalue_adjust // an adjustment of the type of a prvalue -; -*/ -/** - * Describes the semantics represented by a cast expression. This is largely - * independent of the source syntax of the cast, so it is separate from the - * regular expression kind. - */ -conversionkinds( - unique int expr_id: @cast ref, - int kind: int ref -); - -@conversion = @cast - | @array_to_pointer - | @parexpr - | @reference_to - | @ref_indirect - | @temp_init - | @c11_generic - ; - -/* -case @funbindexpr.kind of - 0 = @normal_call // a normal call -| 1 = @virtual_call // a virtual call -| 2 = @adl_call // a call whose target is only found by ADL -; -*/ -iscall( - unique int caller: @funbindexpr ref, - int kind: int ref -); - -numtemplatearguments( - unique int expr_id: @expr ref, - int num: int ref -); - -specialnamequalifyingelements( - unique int id: @specialnamequalifyingelement, - unique string name: string ref -); - -@namequalifiableelement = @expr | @namequalifier; -@namequalifyingelement = @namespace - | @specialnamequalifyingelement - | @usertype; - -namequalifiers( - unique int id: @namequalifier, - unique int qualifiableelement: @namequalifiableelement ref, - int qualifyingelement: @namequalifyingelement ref, - int location: @location_default ref -); - -varbind( - int expr: @varbindexpr ref, - int var: @accessible ref -); - -funbind( - int expr: @funbindexpr ref, - int fun: @function ref -); - -@any_new_expr = @new_expr - | @new_array_expr; - -@new_or_delete_expr = @any_new_expr - | @delete_expr - | @delete_array_expr; - -@prefix_crement_expr = @preincrexpr | @predecrexpr; - -@postfix_crement_expr = @postincrexpr | @postdecrexpr; - -@increment_expr = @preincrexpr | @postincrexpr; - -@decrement_expr = @predecrexpr | @postdecrexpr; - -@crement_expr = @increment_expr | @decrement_expr; - -@un_arith_op_expr = @arithnegexpr - | @unaryplusexpr - | @conjugation - | @realpartexpr - | @imagpartexpr - | @crement_expr - ; - -@un_bitwise_op_expr = @complementexpr; - -@un_log_op_expr = @notexpr; - -@un_op_expr = @address_of - | @indirect - | @un_arith_op_expr - | @un_bitwise_op_expr - | @builtinaddressof - | @vec_fill - | @un_log_op_expr - | @co_await - | @co_yield - ; - -@bin_log_op_expr = @andlogicalexpr | @orlogicalexpr; - -@cmp_op_expr = @eq_op_expr | @rel_op_expr; - -@eq_op_expr = @eqexpr | @neexpr; - -@rel_op_expr = @gtexpr - | @ltexpr - | @geexpr - | @leexpr - | @spaceshipexpr - ; - -@bin_bitwise_op_expr = @lshiftexpr - | @rshiftexpr - | @andexpr - | @orexpr - | @xorexpr - ; - -@p_arith_op_expr = @paddexpr - | @psubexpr - | @pdiffexpr - ; - -@bin_arith_op_expr = @addexpr - | @subexpr - | @mulexpr - | @divexpr - | @remexpr - | @jmulexpr - | @jdivexpr - | @fjaddexpr - | @jfaddexpr - | @fjsubexpr - | @jfsubexpr - | @minexpr - | @maxexpr - | @p_arith_op_expr - ; - -@bin_op_expr = @bin_arith_op_expr - | @bin_bitwise_op_expr - | @cmp_op_expr - | @bin_log_op_expr - ; - -@op_expr = @un_op_expr - | @bin_op_expr - | @assign_expr - | @conditionalexpr - ; - -@assign_arith_expr = @assignaddexpr - | @assignsubexpr - | @assignmulexpr - | @assigndivexpr - | @assignremexpr - ; - -@assign_bitwise_expr = @assignandexpr - | @assignorexpr - | @assignxorexpr - | @assignlshiftexpr - | @assignrshiftexpr - ; - -@assign_pointer_expr = @assignpaddexpr - | @assignpsubexpr - ; - -@assign_op_expr = @assign_arith_expr - | @assign_bitwise_expr - | @assign_pointer_expr - ; - -@assign_expr = @assignexpr | @assign_op_expr | @blockassignexpr - -/* - Binary encoding of the allocator form. - - case @allocator.form of - 0 = plain - | 1 = alignment - ; -*/ - -/** - * The allocator function associated with a `new` or `new[]` expression. - * The `form` column specified whether the allocation call contains an alignment - * argument. - */ -expr_allocator( - unique int expr: @any_new_expr ref, - int func: @function ref, - int form: int ref -); - -/* - Binary encoding of the deallocator form. - - case @deallocator.form of - 0 = plain - | 1 = size - | 2 = alignment - | 4 = destroying_delete - ; -*/ - -/** - * The deallocator function associated with a `delete`, `delete[]`, `new`, or - * `new[]` expression. For a `new` or `new[]` expression, the deallocator is the - * one used to free memory if the initialization throws an exception. - * The `form` column specifies whether the deallocation call contains a size - * argument, and alignment argument, or both. - */ -expr_deallocator( - unique int expr: @new_or_delete_expr ref, - int func: @function ref, - int form: int ref -); - -/** - * Holds if the `@conditionalexpr` is of the two operand form - * `guard ? : false`. - */ -expr_cond_two_operand( - unique int cond: @conditionalexpr ref -); - -/** - * The guard of `@conditionalexpr` `guard ? true : false` - */ -expr_cond_guard( - unique int cond: @conditionalexpr ref, - int guard: @expr ref -); - -/** - * The expression used when the guard of `@conditionalexpr` - * `guard ? true : false` holds. For the two operand form - * `guard ?: false` consider using `expr_cond_guard` instead. - */ -expr_cond_true( - unique int cond: @conditionalexpr ref, - int true: @expr ref -); - -/** - * The expression used when the guard of `@conditionalexpr` - * `guard ? true : false` does not hold. - */ -expr_cond_false( - unique int cond: @conditionalexpr ref, - int false: @expr ref -); - -/** A string representation of the value. */ -values( - unique int id: @value, - string str: string ref -); - -/** The actual text in the source code for the value, if any. */ -valuetext( - unique int id: @value ref, - string text: string ref -); - -valuebind( - int val: @value ref, - unique int expr: @expr ref -); - -fieldoffsets( - unique int id: @variable ref, - int byteoffset: int ref, - int bitoffset: int ref -); - -bitfield( - unique int id: @variable ref, - int bits: int ref, - int declared_bits: int ref -); - -/* TODO -memberprefix( - int member: @expr ref, - int prefix: @expr ref -); -*/ - -/* - kind(1) = mbrcallexpr - kind(2) = mbrptrcallexpr - kind(3) = mbrptrmbrcallexpr - kind(4) = ptrmbrptrmbrcallexpr - kind(5) = mbrreadexpr // x.y - kind(6) = mbrptrreadexpr // p->y - kind(7) = mbrptrmbrreadexpr // x.*pm - kind(8) = mbrptrmbrptrreadexpr // x->*pm - kind(9) = staticmbrreadexpr // static x.y - kind(10) = staticmbrptrreadexpr // static p->y -*/ -/* TODO -memberaccess( - int member: @expr ref, - int kind: int ref -); -*/ - -initialisers( - unique int init: @initialiser, - int var: @accessible ref, - unique int expr: @expr ref, - int location: @location_expr ref -); - -braced_initialisers( - int init: @initialiser ref -); - -/** - * An ancestor for the expression, for cases in which we cannot - * otherwise find the expression's parent. - */ -expr_ancestor( - int exp: @expr ref, - int ancestor: @element ref -); - -exprs( - unique int id: @expr, - int kind: int ref, - int location: @location_expr ref -); - -expr_reuse( - int reuse: @expr ref, - int original: @expr ref, - int value_category: int ref -) - -/* - case @value.category of - 1 = prval - | 2 = xval - | 3 = lval - ; -*/ -expr_types( - int id: @expr ref, - int typeid: @type ref, - int value_category: int ref -); - -case @expr.kind of - 1 = @errorexpr -| 2 = @address_of // & AddressOfExpr -| 3 = @reference_to // ReferenceToExpr (implicit?) -| 4 = @indirect // * PointerDereferenceExpr -| 5 = @ref_indirect // ReferenceDereferenceExpr (implicit?) -// ... -| 8 = @array_to_pointer // (???) -| 9 = @vacuous_destructor_call // VacuousDestructorCall -// ... -| 11 = @assume // Microsoft -| 12 = @parexpr -| 13 = @arithnegexpr -| 14 = @unaryplusexpr -| 15 = @complementexpr -| 16 = @notexpr -| 17 = @conjugation // GNU ~ operator -| 18 = @realpartexpr // GNU __real -| 19 = @imagpartexpr // GNU __imag -| 20 = @postincrexpr -| 21 = @postdecrexpr -| 22 = @preincrexpr -| 23 = @predecrexpr -| 24 = @conditionalexpr -| 25 = @addexpr -| 26 = @subexpr -| 27 = @mulexpr -| 28 = @divexpr -| 29 = @remexpr -| 30 = @jmulexpr // C99 mul imaginary -| 31 = @jdivexpr // C99 div imaginary -| 32 = @fjaddexpr // C99 add real + imaginary -| 33 = @jfaddexpr // C99 add imaginary + real -| 34 = @fjsubexpr // C99 sub real - imaginary -| 35 = @jfsubexpr // C99 sub imaginary - real -| 36 = @paddexpr // pointer add (pointer + int or int + pointer) -| 37 = @psubexpr // pointer sub (pointer - integer) -| 38 = @pdiffexpr // difference between two pointers -| 39 = @lshiftexpr -| 40 = @rshiftexpr -| 41 = @andexpr -| 42 = @orexpr -| 43 = @xorexpr -| 44 = @eqexpr -| 45 = @neexpr -| 46 = @gtexpr -| 47 = @ltexpr -| 48 = @geexpr -| 49 = @leexpr -| 50 = @minexpr // GNU minimum -| 51 = @maxexpr // GNU maximum -| 52 = @assignexpr -| 53 = @assignaddexpr -| 54 = @assignsubexpr -| 55 = @assignmulexpr -| 56 = @assigndivexpr -| 57 = @assignremexpr -| 58 = @assignlshiftexpr -| 59 = @assignrshiftexpr -| 60 = @assignandexpr -| 61 = @assignorexpr -| 62 = @assignxorexpr -| 63 = @assignpaddexpr // assign pointer add -| 64 = @assignpsubexpr // assign pointer sub -| 65 = @andlogicalexpr -| 66 = @orlogicalexpr -| 67 = @commaexpr -| 68 = @subscriptexpr // access to member of an array, e.g., a[5] -// ... 69 @objc_subscriptexpr deprecated -// ... 70 @cmdaccess deprecated -// ... -| 73 = @virtfunptrexpr -| 74 = @callexpr -// ... 75 @msgexpr_normal deprecated -// ... 76 @msgexpr_super deprecated -// ... 77 @atselectorexpr deprecated -// ... 78 @atprotocolexpr deprecated -| 79 = @vastartexpr -| 80 = @vaargexpr -| 81 = @vaendexpr -| 82 = @vacopyexpr -// ... 83 @atencodeexpr deprecated -| 84 = @varaccess -| 85 = @thisaccess -// ... 86 @objc_box_expr deprecated -| 87 = @new_expr -| 88 = @delete_expr -| 89 = @throw_expr -| 90 = @condition_decl // a variable declared in a condition, e.g., if(int x = y > 2) -| 91 = @braced_init_list -| 92 = @type_id -| 93 = @runtime_sizeof -| 94 = @runtime_alignof -| 95 = @sizeof_pack -| 96 = @expr_stmt // GNU extension -| 97 = @routineexpr -| 98 = @type_operand // used to access a type in certain contexts (haven't found any examples yet....) -| 99 = @offsetofexpr // offsetof ::= type and field -| 100 = @hasassignexpr // __has_assign ::= type -| 101 = @hascopyexpr // __has_copy ::= type -| 102 = @hasnothrowassign // __has_nothrow_assign ::= type -| 103 = @hasnothrowconstr // __has_nothrow_constructor ::= type -| 104 = @hasnothrowcopy // __has_nothrow_copy ::= type -| 105 = @hastrivialassign // __has_trivial_assign ::= type -| 106 = @hastrivialconstr // __has_trivial_constructor ::= type -| 107 = @hastrivialcopy // __has_trivial_copy ::= type -| 108 = @hasuserdestr // __has_user_destructor ::= type -| 109 = @hasvirtualdestr // __has_virtual_destructor ::= type -| 110 = @isabstractexpr // __is_abstract ::= type -| 111 = @isbaseofexpr // __is_base_of ::= type type -| 112 = @isclassexpr // __is_class ::= type -| 113 = @isconvtoexpr // __is_convertible_to ::= type type -| 114 = @isemptyexpr // __is_empty ::= type -| 115 = @isenumexpr // __is_enum ::= type -| 116 = @ispodexpr // __is_pod ::= type -| 117 = @ispolyexpr // __is_polymorphic ::= type -| 118 = @isunionexpr // __is_union ::= type -| 119 = @typescompexpr // GNU __builtin_types_compatible ::= type type -| 120 = @intaddrexpr // frontend internal builtin, used to implement offsetof -// ... -| 122 = @hastrivialdestructor // __has_trivial_destructor ::= type -| 123 = @literal -| 124 = @uuidof -| 127 = @aggregateliteral -| 128 = @delete_array_expr -| 129 = @new_array_expr -// ... 130 @objc_array_literal deprecated -// ... 131 @objc_dictionary_literal deprecated -| 132 = @foldexpr -// ... -| 200 = @ctordirectinit -| 201 = @ctorvirtualinit -| 202 = @ctorfieldinit -| 203 = @ctordelegatinginit -| 204 = @dtordirectdestruct -| 205 = @dtorvirtualdestruct -| 206 = @dtorfielddestruct -// ... -| 210 = @static_cast -| 211 = @reinterpret_cast -| 212 = @const_cast -| 213 = @dynamic_cast -| 214 = @c_style_cast -| 215 = @lambdaexpr -| 216 = @param_ref -| 217 = @noopexpr -// ... -| 294 = @istriviallyconstructibleexpr -| 295 = @isdestructibleexpr -| 296 = @isnothrowdestructibleexpr -| 297 = @istriviallydestructibleexpr -| 298 = @istriviallyassignableexpr -| 299 = @isnothrowassignableexpr -| 300 = @istrivialexpr -| 301 = @isstandardlayoutexpr -| 302 = @istriviallycopyableexpr -| 303 = @isliteraltypeexpr -| 304 = @hastrivialmoveconstructorexpr -| 305 = @hastrivialmoveassignexpr -| 306 = @hasnothrowmoveassignexpr -| 307 = @isconstructibleexpr -| 308 = @isnothrowconstructibleexpr -| 309 = @hasfinalizerexpr -| 310 = @isdelegateexpr -| 311 = @isinterfaceclassexpr -| 312 = @isrefarrayexpr -| 313 = @isrefclassexpr -| 314 = @issealedexpr -| 315 = @issimplevalueclassexpr -| 316 = @isvalueclassexpr -| 317 = @isfinalexpr -| 319 = @noexceptexpr -| 320 = @builtinshufflevector -| 321 = @builtinchooseexpr -| 322 = @builtinaddressof -| 323 = @vec_fill -| 324 = @builtinconvertvector -| 325 = @builtincomplex -| 326 = @spaceshipexpr -| 327 = @co_await -| 328 = @co_yield -| 329 = @temp_init -| 330 = @isassignable -| 331 = @isaggregate -| 332 = @hasuniqueobjectrepresentations -| 333 = @builtinbitcast -| 334 = @builtinshuffle -| 335 = @blockassignexpr -| 336 = @issame -| 337 = @isfunction -| 338 = @islayoutcompatible -| 339 = @ispointerinterconvertiblebaseof -| 340 = @isarray -| 341 = @arrayrank -| 342 = @arrayextent -| 343 = @isarithmetic -| 344 = @iscompletetype -| 345 = @iscompound -| 346 = @isconst -| 347 = @isfloatingpoint -| 348 = @isfundamental -| 349 = @isintegral -| 350 = @islvaluereference -| 351 = @ismemberfunctionpointer -| 352 = @ismemberobjectpointer -| 353 = @ismemberpointer -| 354 = @isobject -| 355 = @ispointer -| 356 = @isreference -| 357 = @isrvaluereference -| 358 = @isscalar -| 359 = @issigned -| 360 = @isunsigned -| 361 = @isvoid -| 362 = @isvolatile -| 363 = @reuseexpr -| 364 = @istriviallycopyassignable -| 365 = @isassignablenopreconditioncheck -| 366 = @referencebindstotemporary -| 367 = @issameas -| 368 = @builtinhasattribute -| 369 = @ispointerinterconvertiblewithclass -| 370 = @builtinispointerinterconvertiblewithclass -| 371 = @iscorrespondingmember -| 372 = @builtiniscorrespondingmember -| 373 = @isboundedarray -| 374 = @isunboundedarray -| 375 = @isreferenceable -| 378 = @isnothrowconvertible -| 379 = @referenceconstructsfromtemporary -| 380 = @referenceconvertsfromtemporary -| 381 = @isconvertible -| 382 = @isvalidwinrttype -| 383 = @iswinclass -| 384 = @iswininterface -| 385 = @istriviallyequalitycomparable -| 386 = @isscopedenum -| 387 = @istriviallyrelocatable -| 388 = @datasizeof -| 389 = @c11_generic -| 390 = @requires_expr -| 391 = @nested_requirement -| 392 = @compound_requirement -| 393 = @concept_id -; - -@var_args_expr = @vastartexpr - | @vaendexpr - | @vaargexpr - | @vacopyexpr - ; - -@builtin_op = @var_args_expr - | @noopexpr - | @offsetofexpr - | @intaddrexpr - | @hasassignexpr - | @hascopyexpr - | @hasnothrowassign - | @hasnothrowconstr - | @hasnothrowcopy - | @hastrivialassign - | @hastrivialconstr - | @hastrivialcopy - | @hastrivialdestructor - | @hasuserdestr - | @hasvirtualdestr - | @isabstractexpr - | @isbaseofexpr - | @isclassexpr - | @isconvtoexpr - | @isemptyexpr - | @isenumexpr - | @ispodexpr - | @ispolyexpr - | @isunionexpr - | @typescompexpr - | @builtinshufflevector - | @builtinconvertvector - | @builtinaddressof - | @istriviallyconstructibleexpr - | @isdestructibleexpr - | @isnothrowdestructibleexpr - | @istriviallydestructibleexpr - | @istriviallyassignableexpr - | @isnothrowassignableexpr - | @istrivialexpr - | @isstandardlayoutexpr - | @istriviallycopyableexpr - | @isliteraltypeexpr - | @hastrivialmoveconstructorexpr - | @hastrivialmoveassignexpr - | @hasnothrowmoveassignexpr - | @isconstructibleexpr - | @isnothrowconstructibleexpr - | @hasfinalizerexpr - | @isdelegateexpr - | @isinterfaceclassexpr - | @isrefarrayexpr - | @isrefclassexpr - | @issealedexpr - | @issimplevalueclassexpr - | @isvalueclassexpr - | @isfinalexpr - | @builtinchooseexpr - | @builtincomplex - | @isassignable - | @isaggregate - | @hasuniqueobjectrepresentations - | @builtinbitcast - | @builtinshuffle - | @issame - | @isfunction - | @islayoutcompatible - | @ispointerinterconvertiblebaseof - | @isarray - | @arrayrank - | @arrayextent - | @isarithmetic - | @iscompletetype - | @iscompound - | @isconst - | @isfloatingpoint - | @isfundamental - | @isintegral - | @islvaluereference - | @ismemberfunctionpointer - | @ismemberobjectpointer - | @ismemberpointer - | @isobject - | @ispointer - | @isreference - | @isrvaluereference - | @isscalar - | @issigned - | @isunsigned - | @isvoid - | @isvolatile - | @istriviallycopyassignable - | @isassignablenopreconditioncheck - | @referencebindstotemporary - | @issameas - | @builtinhasattribute - | @ispointerinterconvertiblewithclass - | @builtinispointerinterconvertiblewithclass - | @iscorrespondingmember - | @builtiniscorrespondingmember - | @isboundedarray - | @isunboundedarray - | @isreferenceable - | @isnothrowconvertible - | @referenceconstructsfromtemporary - | @referenceconvertsfromtemporary - | @isconvertible - | @isvalidwinrttype - | @iswinclass - | @iswininterface - | @istriviallyequalitycomparable - | @isscopedenum - | @istriviallyrelocatable - ; - -compound_requirement_is_noexcept( - int expr: @compound_requirement ref -); - -new_allocated_type( - unique int expr: @new_expr ref, - int type_id: @type ref -); - -new_array_allocated_type( - unique int expr: @new_array_expr ref, - int type_id: @type ref -); - -/** - * The field being initialized by an initializer expression within an aggregate - * initializer for a class/struct/union. Position is used to sort repeated initializers. - */ -#keyset[aggregate, position] -aggregate_field_init( - int aggregate: @aggregateliteral ref, - int initializer: @expr ref, - int field: @membervariable ref, - int position: int ref -); - -/** - * The index of the element being initialized by an initializer expression - * within an aggregate initializer for an array. Position is used to sort repeated initializers. - */ -#keyset[aggregate, position] -aggregate_array_init( - int aggregate: @aggregateliteral ref, - int initializer: @expr ref, - int element_index: int ref, - int position: int ref -); - -@ctorinit = @ctordirectinit - | @ctorvirtualinit - | @ctorfieldinit - | @ctordelegatinginit; -@dtordestruct = @dtordirectdestruct - | @dtorvirtualdestruct - | @dtorfielddestruct; - - -condition_decl_bind( - unique int expr: @condition_decl ref, - unique int decl: @declaration ref -); - -typeid_bind( - unique int expr: @type_id ref, - int type_id: @type ref -); - -uuidof_bind( - unique int expr: @uuidof ref, - int type_id: @type ref -); - -@runtime_sizeof_or_alignof = @runtime_sizeof | @runtime_alignof | @datasizeof; - -sizeof_bind( - unique int expr: @runtime_sizeof_or_alignof ref, - int type_id: @type ref -); - -code_block( - unique int block: @literal ref, - unique int routine: @function ref -); - -lambdas( - unique int expr: @lambdaexpr ref, - string default_capture: string ref, - boolean has_explicit_return_type: boolean ref -); - -lambda_capture( - unique int id: @lambdacapture, - int lambda: @lambdaexpr ref, - int index: int ref, - int field: @membervariable ref, - boolean captured_by_reference: boolean ref, - boolean is_implicit: boolean ref, - int location: @location_default ref -); - -@funbindexpr = @routineexpr - | @new_expr - | @delete_expr - | @delete_array_expr - | @ctordirectinit - | @ctorvirtualinit - | @ctordelegatinginit - | @dtordirectdestruct - | @dtorvirtualdestruct; - -@varbindexpr = @varaccess | @ctorfieldinit | @dtorfielddestruct; -@addressable = @function | @variable ; -@accessible = @addressable | @enumconstant ; - -@access = @varaccess | @routineexpr ; - -fold( - int expr: @foldexpr ref, - string operator: string ref, - boolean is_left_fold: boolean ref -); - -stmts( - unique int id: @stmt, - int kind: int ref, - int location: @location_stmt ref -); - -case @stmt.kind of - 1 = @stmt_expr -| 2 = @stmt_if -| 3 = @stmt_while -| 4 = @stmt_goto -| 5 = @stmt_label -| 6 = @stmt_return -| 7 = @stmt_block -| 8 = @stmt_end_test_while // do { ... } while ( ... ) -| 9 = @stmt_for -| 10 = @stmt_switch_case -| 11 = @stmt_switch -| 13 = @stmt_asm // "asm" statement or the body of an asm function -| 15 = @stmt_try_block -| 16 = @stmt_microsoft_try // Microsoft -| 17 = @stmt_decl -| 18 = @stmt_set_vla_size // C99 -| 19 = @stmt_vla_decl // C99 -| 25 = @stmt_assigned_goto // GNU -| 26 = @stmt_empty -| 27 = @stmt_continue -| 28 = @stmt_break -| 29 = @stmt_range_based_for // C++11 -// ... 30 @stmt_at_autoreleasepool_block deprecated -// ... 31 @stmt_objc_for_in deprecated -// ... 32 @stmt_at_synchronized deprecated -| 33 = @stmt_handler -// ... 34 @stmt_finally_end deprecated -| 35 = @stmt_constexpr_if -| 37 = @stmt_co_return -; - -type_vla( - int type_id: @type ref, - int decl: @stmt_vla_decl ref -); - -variable_vla( - int var: @variable ref, - int decl: @stmt_vla_decl ref -); - -if_initialization( - unique int if_stmt: @stmt_if ref, - int init_id: @stmt ref -); - -if_then( - unique int if_stmt: @stmt_if ref, - int then_id: @stmt ref -); - -if_else( - unique int if_stmt: @stmt_if ref, - int else_id: @stmt ref -); - -constexpr_if_initialization( - unique int constexpr_if_stmt: @stmt_constexpr_if ref, - int init_id: @stmt ref -); - -constexpr_if_then( - unique int constexpr_if_stmt: @stmt_constexpr_if ref, - int then_id: @stmt ref -); - -constexpr_if_else( - unique int constexpr_if_stmt: @stmt_constexpr_if ref, - int else_id: @stmt ref -); - -while_body( - unique int while_stmt: @stmt_while ref, - int body_id: @stmt ref -); - -do_body( - unique int do_stmt: @stmt_end_test_while ref, - int body_id: @stmt ref -); - -switch_initialization( - unique int switch_stmt: @stmt_switch ref, - int init_id: @stmt ref -); - -#keyset[switch_stmt, index] -switch_case( - int switch_stmt: @stmt_switch ref, - int index: int ref, - int case_id: @stmt_switch_case ref -); - -switch_body( - unique int switch_stmt: @stmt_switch ref, - int body_id: @stmt ref -); - -@stmt_for_or_range_based_for = @stmt_for - | @stmt_range_based_for; - -for_initialization( - unique int for_stmt: @stmt_for_or_range_based_for ref, - int init_id: @stmt ref -); - -for_condition( - unique int for_stmt: @stmt_for ref, - int condition_id: @expr ref -); - -for_update( - unique int for_stmt: @stmt_for ref, - int update_id: @expr ref -); - -for_body( - unique int for_stmt: @stmt_for ref, - int body_id: @stmt ref -); - -@stmtparent = @stmt | @expr_stmt ; -stmtparents( - unique int id: @stmt ref, - int index: int ref, - int parent: @stmtparent ref -); - -ishandler(unique int block: @stmt_block ref); - -@cfgnode = @stmt | @expr | @function | @initialiser ; - -stmt_decl_bind( - int stmt: @stmt_decl ref, - int num: int ref, - int decl: @declaration ref -); - -stmt_decl_entry_bind( - int stmt: @stmt_decl ref, - int num: int ref, - int decl_entry: @element ref -); - -@parameterized_element = @function | @stmt_block | @requires_expr; - -blockscope( - unique int block: @stmt_block ref, - int enclosing: @parameterized_element ref -); - -@jump = @stmt_goto | @stmt_break | @stmt_continue; - -@jumporlabel = @jump | @stmt_label | @literal; - -jumpinfo( - unique int id: @jumporlabel ref, - string str: string ref, - int target: @stmt ref -); - -preprocdirects( - unique int id: @preprocdirect, - int kind: int ref, - int location: @location_default ref -); -case @preprocdirect.kind of - 0 = @ppd_if -| 1 = @ppd_ifdef -| 2 = @ppd_ifndef -| 3 = @ppd_elif -| 4 = @ppd_else -| 5 = @ppd_endif -| 6 = @ppd_plain_include -| 7 = @ppd_define -| 8 = @ppd_undef -| 9 = @ppd_line -| 10 = @ppd_error -| 11 = @ppd_pragma -| 12 = @ppd_objc_import -| 13 = @ppd_include_next -| 18 = @ppd_warning -; - -@ppd_include = @ppd_plain_include | @ppd_objc_import | @ppd_include_next; - -@ppd_branch = @ppd_if | @ppd_ifdef | @ppd_ifndef | @ppd_elif; - -preprocpair( - int begin : @ppd_branch ref, - int elseelifend : @preprocdirect ref -); - -preproctrue(int branch : @ppd_branch ref); -preprocfalse(int branch : @ppd_branch ref); - -preproctext( - unique int id: @preprocdirect ref, - string head: string ref, - string body: string ref -); - -includes( - unique int id: @ppd_include ref, - int included: @file ref -); - -link_targets( - int id: @link_target, - int binary: @file ref -); - -link_parent( - int element : @element ref, - int link_target : @link_target ref -); - -/* XML Files */ - -xmlEncoding(unique int id: @file ref, string encoding: string ref); - -xmlDTDs( - unique int id: @xmldtd, - string root: string ref, - string publicId: string ref, - string systemId: string ref, - int fileid: @file ref -); - -xmlElements( - unique int id: @xmlelement, - string name: string ref, - int parentid: @xmlparent ref, - int idx: int ref, - int fileid: @file ref -); - -xmlAttrs( - unique int id: @xmlattribute, - int elementid: @xmlelement ref, - string name: string ref, - string value: string ref, - int idx: int ref, - int fileid: @file ref -); - -xmlNs( - int id: @xmlnamespace, - string prefixName: string ref, - string URI: string ref, - int fileid: @file ref -); - -xmlHasNs( - int elementId: @xmlnamespaceable ref, - int nsId: @xmlnamespace ref, - int fileid: @file ref -); - -xmlComments( - unique int id: @xmlcomment, - string text: string ref, - int parentid: @xmlparent ref, - int fileid: @file ref -); - -xmlChars( - unique int id: @xmlcharacters, - string text: string ref, - int parentid: @xmlparent ref, - int idx: int ref, - int isCDATA: int ref, - int fileid: @file ref -); - -@xmlparent = @file | @xmlelement; -@xmlnamespaceable = @xmlelement | @xmlattribute; - -xmllocations( - int xmlElement: @xmllocatable ref, - int location: @location_default ref -); - -@xmllocatable = @xmlcharacters - | @xmlelement - | @xmlcomment - | @xmlattribute - | @xmldtd - | @file - | @xmlnamespace; diff --git a/cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/semmlecode.cpp.dbscheme b/cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/semmlecode.cpp.dbscheme deleted file mode 100644 index f0156f5f88a..00000000000 --- a/cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/semmlecode.cpp.dbscheme +++ /dev/null @@ -1,2339 +0,0 @@ - -/** - * An invocation of the compiler. Note that more than one file may be - * compiled per invocation. For example, this command compiles three - * source files: - * - * gcc -c f1.c f2.c f3.c - * - * The `id` simply identifies the invocation, while `cwd` is the working - * directory from which the compiler was invoked. - */ -compilations( - /** - * An invocation of the compiler. Note that more than one file may - * be compiled per invocation. For example, this command compiles - * three source files: - * - * gcc -c f1.c f2.c f3.c - */ - unique int id : @compilation, - string cwd : string ref -); - -/** - * The arguments that were passed to the extractor for a compiler - * invocation. If `id` is for the compiler invocation - * - * gcc -c f1.c f2.c f3.c - * - * then typically there will be rows for - * - * num | arg - * --- | --- - * 0 | *path to extractor* - * 1 | `--mimic` - * 2 | `/usr/bin/gcc` - * 3 | `-c` - * 4 | f1.c - * 5 | f2.c - * 6 | f3.c - */ -#keyset[id, num] -compilation_args( - int id : @compilation ref, - int num : int ref, - string arg : string ref -); - -/** - * Optionally, record the build mode for each compilation. - */ -compilation_build_mode( - unique int id : @compilation ref, - int mode : int ref -); - -/* -case @compilation_build_mode.mode of - 0 = @build_mode_none -| 1 = @build_mode_manual -| 2 = @build_mode_auto -; -*/ - -/** - * The source files that are compiled by a compiler invocation. - * If `id` is for the compiler invocation - * - * gcc -c f1.c f2.c f3.c - * - * then there will be rows for - * - * num | arg - * --- | --- - * 0 | f1.c - * 1 | f2.c - * 2 | f3.c - * - * Note that even if those files `#include` headers, those headers - * do not appear as rows. - */ -#keyset[id, num] -compilation_compiling_files( - int id : @compilation ref, - int num : int ref, - int file : @file ref -); - -/** - * The time taken by the extractor for a compiler invocation. - * - * For each file `num`, there will be rows for - * - * kind | seconds - * ---- | --- - * 1 | CPU seconds used by the extractor frontend - * 2 | Elapsed seconds during the extractor frontend - * 3 | CPU seconds used by the extractor backend - * 4 | Elapsed seconds during the extractor backend - */ -#keyset[id, num, kind] -compilation_time( - int id : @compilation ref, - int num : int ref, - /* kind: - 1 = frontend_cpu_seconds - 2 = frontend_elapsed_seconds - 3 = extractor_cpu_seconds - 4 = extractor_elapsed_seconds - */ - int kind : int ref, - float seconds : float ref -); - -/** - * An error or warning generated by the extractor. - * The diagnostic message `diagnostic` was generated during compiler - * invocation `compilation`, and is the `file_number_diagnostic_number`th - * message generated while extracting the `file_number`th file of that - * invocation. - */ -#keyset[compilation, file_number, file_number_diagnostic_number] -diagnostic_for( - int diagnostic : @diagnostic ref, - int compilation : @compilation ref, - int file_number : int ref, - int file_number_diagnostic_number : int ref -); - -/** - * If extraction was successful, then `cpu_seconds` and - * `elapsed_seconds` are the CPU time and elapsed time (respectively) - * that extraction took for compiler invocation `id`. - */ -compilation_finished( - unique int id : @compilation ref, - float cpu_seconds : float ref, - float elapsed_seconds : float ref -); - - -/** - * External data, loaded from CSV files during snapshot creation. See - * [Tutorial: Incorporating external data](https://help.semmle.com/wiki/display/SD/Tutorial%3A+Incorporating+external+data) - * for more information. - */ -externalData( - int id : @externalDataElement, - string path : string ref, - int column: int ref, - string value : string ref -); - -/** - * The source location of the snapshot. - */ -sourceLocationPrefix(string prefix : string ref); - -/** - * Information about packages that provide code used during compilation. - * The `id` is just a unique identifier. - * The `namespace` is typically the name of the package manager that - * provided the package (e.g. "dpkg" or "yum"). - * The `package_name` is the name of the package, and `version` is its - * version (as a string). - */ -external_packages( - unique int id: @external_package, - string namespace : string ref, - string package_name : string ref, - string version : string ref -); - -/** - * Holds if File `fileid` was provided by package `package`. - */ -header_to_external_package( - int fileid : @file ref, - int package : @external_package ref -); - -/* - * Version history - */ - -svnentries( - unique int id : @svnentry, - string revision : string ref, - string author : string ref, - date revisionDate : date ref, - int changeSize : int ref -) - -svnaffectedfiles( - int id : @svnentry ref, - int file : @file ref, - string action : string ref -) - -svnentrymsg( - unique int id : @svnentry ref, - string message : string ref -) - -svnchurn( - int commit : @svnentry ref, - int file : @file ref, - int addedLines : int ref, - int deletedLines : int ref -) - -/* - * C++ dbscheme - */ - -extractor_version( - string codeql_version: string ref, - string frontend_version: string ref -) - -@location = @location_stmt | @location_expr | @location_default ; - -/** - * The location of an element that is not an expression or a statement. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `file`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ -locations_default( - /** The location of an element that is not an expression or a statement. */ - unique int id: @location_default, - int container: @container ref, - int startLine: int ref, - int startColumn: int ref, - int endLine: int ref, - int endColumn: int ref -); - -/** - * The location of a statement. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `file`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ -locations_stmt( - /** The location of a statement. */ - unique int id: @location_stmt, - int container: @container ref, - int startLine: int ref, - int startColumn: int ref, - int endLine: int ref, - int endColumn: int ref -); - -/** - * The location of an expression. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `file`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ -locations_expr( - /** The location of an expression. */ - unique int id: @location_expr, - int container: @container ref, - int startLine: int ref, - int startColumn: int ref, - int endLine: int ref, - int endColumn: int ref -); - -/** An element for which line-count information is available. */ -@sourceline = @file | @function | @variable | @enumconstant | @xmllocatable; - -numlines( - int element_id: @sourceline ref, - int num_lines: int ref, - int num_code: int ref, - int num_comment: int ref -); - -diagnostics( - unique int id: @diagnostic, - int severity: int ref, - string error_tag: string ref, - string error_message: string ref, - string full_error_message: string ref, - int location: @location_default ref -); - -files( - unique int id: @file, - string name: string ref -); - -folders( - unique int id: @folder, - string name: string ref -); - -@container = @folder | @file - -containerparent( - int parent: @container ref, - unique int child: @container ref -); - -fileannotations( - int id: @file ref, - int kind: int ref, - string name: string ref, - string value: string ref -); - -inmacroexpansion( - int id: @element ref, - int inv: @macroinvocation ref -); - -affectedbymacroexpansion( - int id: @element ref, - int inv: @macroinvocation ref -); - -case @macroinvocation.kind of - 1 = @macro_expansion -| 2 = @other_macro_reference -; - -macroinvocations( - unique int id: @macroinvocation, - int macro_id: @ppd_define ref, - int location: @location_default ref, - int kind: int ref -); - -macroparent( - unique int id: @macroinvocation ref, - int parent_id: @macroinvocation ref -); - -// a macroinvocation may be part of another location -// the way to find a constant expression that uses a macro -// is thus to find a constant expression that has a location -// to which a macro invocation is bound -macrolocationbind( - int id: @macroinvocation ref, - int location: @location ref -); - -#keyset[invocation, argument_index] -macro_argument_unexpanded( - int invocation: @macroinvocation ref, - int argument_index: int ref, - string text: string ref -); - -#keyset[invocation, argument_index] -macro_argument_expanded( - int invocation: @macroinvocation ref, - int argument_index: int ref, - string text: string ref -); - -/* -case @function.kind of - 1 = @normal_function -| 2 = @constructor -| 3 = @destructor -| 4 = @conversion_function -| 5 = @operator -| 6 = @builtin_function // GCC built-in functions, e.g. __builtin___memcpy_chk -| 7 = @user_defined_literal -| 8 = @deduction_guide -; -*/ - -functions( - unique int id: @function, - string name: string ref, - int kind: int ref -); - -function_entry_point( - int id: @function ref, - unique int entry_point: @stmt ref -); - -function_return_type( - int id: @function ref, - int return_type: @type ref -); - -/** - * If `function` is a coroutine, then this gives the `std::experimental::resumable_traits` - * instance associated with it, and the variables representing the `handle` and `promise` - * for it. - */ -coroutine( - unique int function: @function ref, - int traits: @type ref -); - -/* -case @coroutine_placeholder_variable.kind of - 1 = @handle -| 2 = @promise -| 3 = @init_await_resume -; -*/ - -coroutine_placeholder_variable( - unique int placeholder_variable: @variable ref, - int kind: int ref, - int function: @function ref -) - -/** The `new` function used for allocating the coroutine state, if any. */ -coroutine_new( - unique int function: @function ref, - int new: @function ref -); - -/** The `delete` function used for deallocating the coroutine state, if any. */ -coroutine_delete( - unique int function: @function ref, - int delete: @function ref -); - -purefunctions(unique int id: @function ref); - -function_deleted(unique int id: @function ref); - -function_defaulted(unique int id: @function ref); - -function_prototyped(unique int id: @function ref) - -deduction_guide_for_class( - int id: @function ref, - int class_template: @usertype ref -) - -member_function_this_type( - unique int id: @function ref, - int this_type: @type ref -); - -#keyset[id, type_id] -fun_decls( - int id: @fun_decl, - int function: @function ref, - int type_id: @type ref, - string name: string ref, - int location: @location_default ref -); -fun_def(unique int id: @fun_decl ref); -fun_specialized(unique int id: @fun_decl ref); -fun_implicit(unique int id: @fun_decl ref); -fun_decl_specifiers( - int id: @fun_decl ref, - string name: string ref -) -#keyset[fun_decl, index] -fun_decl_throws( - int fun_decl: @fun_decl ref, - int index: int ref, - int type_id: @type ref -); -/* an empty throw specification is different from none */ -fun_decl_empty_throws(unique int fun_decl: @fun_decl ref); -fun_decl_noexcept( - int fun_decl: @fun_decl ref, - int constant: @expr ref -); -fun_decl_empty_noexcept(int fun_decl: @fun_decl ref); -fun_decl_typedef_type( - unique int fun_decl: @fun_decl ref, - int typedeftype_id: @usertype ref -); - -param_decl_bind( - unique int id: @var_decl ref, - int index: int ref, - int fun_decl: @fun_decl ref -); - -#keyset[id, type_id] -var_decls( - int id: @var_decl, - int variable: @variable ref, - int type_id: @type ref, - string name: string ref, - int location: @location_default ref -); -var_def(unique int id: @var_decl ref); -var_decl_specifiers( - int id: @var_decl ref, - string name: string ref -) -is_structured_binding(unique int id: @variable ref); - -type_decls( - unique int id: @type_decl, - int type_id: @type ref, - int location: @location_default ref -); -type_def(unique int id: @type_decl ref); -type_decl_top( - unique int type_decl: @type_decl ref -); - -namespace_decls( - unique int id: @namespace_decl, - int namespace_id: @namespace ref, - int location: @location_default ref, - int bodylocation: @location_default ref -); - -case @using.kind of - 1 = @using_declaration -| 2 = @using_directive -| 3 = @using_enum_declaration -; - -usings( - unique int id: @using, - int element_id: @element ref, - int location: @location_default ref, - int kind: int ref -); - -/** The element which contains the `using` declaration. */ -using_container( - int parent: @element ref, - int child: @using ref -); - -static_asserts( - unique int id: @static_assert, - int condition : @expr ref, - string message : string ref, - int location: @location_default ref, - int enclosing : @element ref -); - -// each function has an ordered list of parameters -#keyset[id, type_id] -#keyset[function, index, type_id] -params( - int id: @parameter, - int function: @parameterized_element ref, - int index: int ref, - int type_id: @type ref -); - -overrides( - int new: @function ref, - int old: @function ref -); - -#keyset[id, type_id] -membervariables( - int id: @membervariable, - int type_id: @type ref, - string name: string ref -); - -#keyset[id, type_id] -globalvariables( - int id: @globalvariable, - int type_id: @type ref, - string name: string ref -); - -#keyset[id, type_id] -localvariables( - int id: @localvariable, - int type_id: @type ref, - string name: string ref -); - -autoderivation( - unique int var: @variable ref, - int derivation_type: @type ref -); - -orphaned_variables( - int var: @localvariable ref, - int function: @function ref -) - -enumconstants( - unique int id: @enumconstant, - int parent: @usertype ref, - int index: int ref, - int type_id: @type ref, - string name: string ref, - int location: @location_default ref -); - -@variable = @localscopevariable | @globalvariable | @membervariable; - -@localscopevariable = @localvariable | @parameter; - -/** - * Built-in types are the fundamental types, e.g., integral, floating, and void. - */ -case @builtintype.kind of - 1 = @errortype -| 2 = @unknowntype -| 3 = @void -| 4 = @boolean -| 5 = @char -| 6 = @unsigned_char -| 7 = @signed_char -| 8 = @short -| 9 = @unsigned_short -| 10 = @signed_short -| 11 = @int -| 12 = @unsigned_int -| 13 = @signed_int -| 14 = @long -| 15 = @unsigned_long -| 16 = @signed_long -| 17 = @long_long -| 18 = @unsigned_long_long -| 19 = @signed_long_long -// ... 20 Microsoft-specific __int8 -// ... 21 Microsoft-specific __int16 -// ... 22 Microsoft-specific __int32 -// ... 23 Microsoft-specific __int64 -| 24 = @float -| 25 = @double -| 26 = @long_double -| 27 = @complex_float // C99-specific _Complex float -| 28 = @complex_double // C99-specific _Complex double -| 29 = @complex_long_double // C99-specific _Complex long double -| 30 = @imaginary_float // C99-specific _Imaginary float -| 31 = @imaginary_double // C99-specific _Imaginary double -| 32 = @imaginary_long_double // C99-specific _Imaginary long double -| 33 = @wchar_t // Microsoft-specific -| 34 = @decltype_nullptr // C++11 -| 35 = @int128 // __int128 -| 36 = @unsigned_int128 // unsigned __int128 -| 37 = @signed_int128 // signed __int128 -| 38 = @float128 // __float128 -| 39 = @complex_float128 // _Complex __float128 -| 40 = @decimal32 // _Decimal32 -| 41 = @decimal64 // _Decimal64 -| 42 = @decimal128 // _Decimal128 -| 43 = @char16_t -| 44 = @char32_t -| 45 = @std_float32 // _Float32 -| 46 = @float32x // _Float32x -| 47 = @std_float64 // _Float64 -| 48 = @float64x // _Float64x -| 49 = @std_float128 // _Float128 -// ... 50 _Float128x -| 51 = @char8_t -| 52 = @float16 // _Float16 -| 53 = @complex_float16 // _Complex _Float16 -| 54 = @fp16 // __fp16 -| 55 = @std_bfloat16 // __bf16 -| 56 = @std_float16 // std::float16_t -| 57 = @complex_std_float32 // _Complex _Float32 -| 58 = @complex_float32x // _Complex _Float32x -| 59 = @complex_std_float64 // _Complex _Float64 -| 60 = @complex_float64x // _Complex _Float64x -| 61 = @complex_std_float128 // _Complex _Float128 -; - -builtintypes( - unique int id: @builtintype, - string name: string ref, - int kind: int ref, - int size: int ref, - int sign: int ref, - int alignment: int ref -); - -/** - * Derived types are types that are directly derived from existing types and - * point to, refer to, transform type data to return a new type. - */ -case @derivedtype.kind of - 1 = @pointer -| 2 = @reference -| 3 = @type_with_specifiers -| 4 = @array -| 5 = @gnu_vector -| 6 = @routineptr -| 7 = @routinereference -| 8 = @rvalue_reference // C++11 -// ... 9 type_conforming_to_protocols deprecated -| 10 = @block -; - -derivedtypes( - unique int id: @derivedtype, - string name: string ref, - int kind: int ref, - int type_id: @type ref -); - -pointerishsize(unique int id: @derivedtype ref, - int size: int ref, - int alignment: int ref); - -arraysizes( - unique int id: @derivedtype ref, - int num_elements: int ref, - int bytesize: int ref, - int alignment: int ref -); - -typedefbase( - unique int id: @usertype ref, - int type_id: @type ref -); - -/** - * An instance of the C++11 `decltype` operator. For example: - * ``` - * int a; - * decltype(1+a) b; - * ``` - * Here `expr` is `1+a`. - * - * Sometimes an additional pair of parentheses around the expression - * would change the semantics of this decltype, e.g. - * ``` - * struct A { double x; }; - * const A* a = new A(); - * decltype( a->x ); // type is double - * decltype((a->x)); // type is const double& - * ``` - * (Please consult the C++11 standard for more details). - * `parentheses_would_change_meaning` is `true` iff that is the case. - */ -#keyset[id, expr] -decltypes( - int id: @decltype, - int expr: @expr ref, - int base_type: @type ref, - boolean parentheses_would_change_meaning: boolean ref -); - -/* -case @usertype.kind of - 1 = @struct -| 2 = @class -| 3 = @union -| 4 = @enum -| 5 = @typedef // classic C: typedef typedef type name -| 6 = @template -| 7 = @template_parameter -| 8 = @template_template_parameter -| 9 = @proxy_class // a proxy class associated with a template parameter -// ... 10 objc_class deprecated -// ... 11 objc_protocol deprecated -// ... 12 objc_category deprecated -| 13 = @scoped_enum -| 14 = @using_alias // a using name = type style typedef -; -*/ - -usertypes( - unique int id: @usertype, - string name: string ref, - int kind: int ref -); - -usertypesize( - unique int id: @usertype ref, - int size: int ref, - int alignment: int ref -); - -usertype_final(unique int id: @usertype ref); - -usertype_uuid( - unique int id: @usertype ref, - string uuid: string ref -); - -mangled_name( - unique int id: @declaration ref, - int mangled_name : @mangledname, - boolean is_complete: boolean ref -); - -is_pod_class(unique int id: @usertype ref); -is_standard_layout_class(unique int id: @usertype ref); - -is_complete(unique int id: @usertype ref); - -is_class_template(unique int id: @usertype ref); -class_instantiation( - int to: @usertype ref, - int from: @usertype ref -); -class_template_argument( - int type_id: @usertype ref, - int index: int ref, - int arg_type: @type ref -); -class_template_argument_value( - int type_id: @usertype ref, - int index: int ref, - int arg_value: @expr ref -); - -is_proxy_class_for( - unique int id: @usertype ref, - unique int templ_param_id: @usertype ref -); - -type_mentions( - unique int id: @type_mention, - int type_id: @type ref, - int location: @location ref, - // a_symbol_reference_kind from the frontend. - int kind: int ref -); - -is_function_template(unique int id: @function ref); -function_instantiation( - unique int to: @function ref, - int from: @function ref -); -function_template_argument( - int function_id: @function ref, - int index: int ref, - int arg_type: @type ref -); -function_template_argument_value( - int function_id: @function ref, - int index: int ref, - int arg_value: @expr ref -); - -is_variable_template(unique int id: @variable ref); -variable_instantiation( - unique int to: @variable ref, - int from: @variable ref -); -variable_template_argument( - int variable_id: @variable ref, - int index: int ref, - int arg_type: @type ref -); -variable_template_argument_value( - int variable_id: @variable ref, - int index: int ref, - int arg_value: @expr ref -); - -routinetypes( - unique int id: @routinetype, - int return_type: @type ref -); - -routinetypeargs( - int routine: @routinetype ref, - int index: int ref, - int type_id: @type ref -); - -ptrtomembers( - unique int id: @ptrtomember, - int type_id: @type ref, - int class_id: @type ref -); - -/* - specifiers for types, functions, and variables - - "public", - "protected", - "private", - - "const", - "volatile", - "static", - - "pure", - "virtual", - "sealed", // Microsoft - "__interface", // Microsoft - "inline", - "explicit", - - "near", // near far extension - "far", // near far extension - "__ptr32", // Microsoft - "__ptr64", // Microsoft - "__sptr", // Microsoft - "__uptr", // Microsoft - "dllimport", // Microsoft - "dllexport", // Microsoft - "thread", // Microsoft - "naked", // Microsoft - "microsoft_inline", // Microsoft - "forceinline", // Microsoft - "selectany", // Microsoft - "nothrow", // Microsoft - "novtable", // Microsoft - "noreturn", // Microsoft - "noinline", // Microsoft - "noalias", // Microsoft - "restrict", // Microsoft -*/ - -specifiers( - unique int id: @specifier, - unique string str: string ref -); - -typespecifiers( - int type_id: @type ref, - int spec_id: @specifier ref -); - -funspecifiers( - int func_id: @function ref, - int spec_id: @specifier ref -); - -varspecifiers( - int var_id: @accessible ref, - int spec_id: @specifier ref -); - -explicit_specifier_exprs( - unique int func_id: @function ref, - int constant: @expr ref -) - -attributes( - unique int id: @attribute, - int kind: int ref, - string name: string ref, - string name_space: string ref, - int location: @location_default ref -); - -case @attribute.kind of - 0 = @gnuattribute -| 1 = @stdattribute -| 2 = @declspec -| 3 = @msattribute -| 4 = @alignas -// ... 5 @objc_propertyattribute deprecated -; - -attribute_args( - unique int id: @attribute_arg, - int kind: int ref, - int attribute: @attribute ref, - int index: int ref, - int location: @location_default ref -); - -case @attribute_arg.kind of - 0 = @attribute_arg_empty -| 1 = @attribute_arg_token -| 2 = @attribute_arg_constant -| 3 = @attribute_arg_type -| 4 = @attribute_arg_constant_expr -| 5 = @attribute_arg_expr -; - -attribute_arg_value( - unique int arg: @attribute_arg ref, - string value: string ref -); -attribute_arg_type( - unique int arg: @attribute_arg ref, - int type_id: @type ref -); -attribute_arg_constant( - unique int arg: @attribute_arg ref, - int constant: @expr ref -) -attribute_arg_expr( - unique int arg: @attribute_arg ref, - int expr: @expr ref -) -attribute_arg_name( - unique int arg: @attribute_arg ref, - string name: string ref -); - -typeattributes( - int type_id: @type ref, - int spec_id: @attribute ref -); - -funcattributes( - int func_id: @function ref, - int spec_id: @attribute ref -); - -varattributes( - int var_id: @accessible ref, - int spec_id: @attribute ref -); - -stmtattributes( - int stmt_id: @stmt ref, - int spec_id: @attribute ref -); - -@type = @builtintype - | @derivedtype - | @usertype - /* TODO | @fixedpointtype */ - | @routinetype - | @ptrtomember - | @decltype; - -unspecifiedtype( - unique int type_id: @type ref, - int unspecified_type_id: @type ref -); - -member( - int parent: @type ref, - int index: int ref, - int child: @member ref -); - -@enclosingfunction_child = @usertype | @variable | @namespace - -enclosingfunction( - unique int child: @enclosingfunction_child ref, - int parent: @function ref -); - -derivations( - unique int derivation: @derivation, - int sub: @type ref, - int index: int ref, - int super: @type ref, - int location: @location_default ref -); - -derspecifiers( - int der_id: @derivation ref, - int spec_id: @specifier ref -); - -/** - * Contains the byte offset of the base class subobject within the derived - * class. Only holds for non-virtual base classes, but see table - * `virtual_base_offsets` for offsets of virtual base class subobjects. - */ -direct_base_offsets( - unique int der_id: @derivation ref, - int offset: int ref -); - -/** - * Contains the byte offset of the virtual base class subobject for class - * `super` within a most-derived object of class `sub`. `super` can be either a - * direct or indirect base class. - */ -#keyset[sub, super] -virtual_base_offsets( - int sub: @usertype ref, - int super: @usertype ref, - int offset: int ref -); - -frienddecls( - unique int id: @frienddecl, - int type_id: @type ref, - int decl_id: @declaration ref, - int location: @location_default ref -); - -@declaredtype = @usertype ; - -@declaration = @function - | @declaredtype - | @variable - | @enumconstant - | @frienddecl; - -@member = @membervariable - | @function - | @declaredtype - | @enumconstant; - -@locatable = @diagnostic - | @declaration - | @ppd_include - | @ppd_define - | @macroinvocation - /*| @funcall*/ - | @xmllocatable - | @attribute - | @attribute_arg; - -@namedscope = @namespace | @usertype; - -@element = @locatable - | @file - | @folder - | @specifier - | @type - | @expr - | @namespace - | @initialiser - | @stmt - | @derivation - | @comment - | @preprocdirect - | @fun_decl - | @var_decl - | @type_decl - | @namespace_decl - | @using - | @namequalifier - | @specialnamequalifyingelement - | @static_assert - | @type_mention - | @lambdacapture; - -@exprparent = @element; - -comments( - unique int id: @comment, - string contents: string ref, - int location: @location_default ref -); - -commentbinding( - int id: @comment ref, - int element: @element ref -); - -exprconv( - int converted: @expr ref, - unique int conversion: @expr ref -); - -compgenerated(unique int id: @element ref); - -/** - * `destructor_call` destructs the `i`'th entity that should be - * destructed following `element`. Note that entities should be - * destructed in reverse construction order, so for a given `element` - * these should be called from highest to lowest `i`. - */ -#keyset[element, destructor_call] -#keyset[element, i] -synthetic_destructor_call( - int element: @element ref, - int i: int ref, - int destructor_call: @routineexpr ref -); - -namespaces( - unique int id: @namespace, - string name: string ref -); - -namespace_inline( - unique int id: @namespace ref -); - -namespacembrs( - int parentid: @namespace ref, - unique int memberid: @namespacembr ref -); - -@namespacembr = @declaration | @namespace; - -exprparents( - int expr_id: @expr ref, - int child_index: int ref, - int parent_id: @exprparent ref -); - -expr_isload(unique int expr_id: @expr ref); - -@cast = @c_style_cast - | @const_cast - | @dynamic_cast - | @reinterpret_cast - | @static_cast - ; - -/* -case @conversion.kind of - 0 = @simple_conversion // a numeric conversion, qualification conversion, or a reinterpret_cast -| 1 = @bool_conversion // conversion to 'bool' -| 2 = @base_class_conversion // a derived-to-base conversion -| 3 = @derived_class_conversion // a base-to-derived conversion -| 4 = @pm_base_class_conversion // a derived-to-base conversion of a pointer to member -| 5 = @pm_derived_class_conversion // a base-to-derived conversion of a pointer to member -| 6 = @glvalue_adjust // an adjustment of the type of a glvalue -| 7 = @prvalue_adjust // an adjustment of the type of a prvalue -; -*/ -/** - * Describes the semantics represented by a cast expression. This is largely - * independent of the source syntax of the cast, so it is separate from the - * regular expression kind. - */ -conversionkinds( - unique int expr_id: @cast ref, - int kind: int ref -); - -@conversion = @cast - | @array_to_pointer - | @parexpr - | @reference_to - | @ref_indirect - | @temp_init - | @c11_generic - ; - -/* -case @funbindexpr.kind of - 0 = @normal_call // a normal call -| 1 = @virtual_call // a virtual call -| 2 = @adl_call // a call whose target is only found by ADL -; -*/ -iscall( - unique int caller: @funbindexpr ref, - int kind: int ref -); - -numtemplatearguments( - unique int expr_id: @expr ref, - int num: int ref -); - -specialnamequalifyingelements( - unique int id: @specialnamequalifyingelement, - unique string name: string ref -); - -@namequalifiableelement = @expr | @namequalifier; -@namequalifyingelement = @namespace - | @specialnamequalifyingelement - | @usertype; - -namequalifiers( - unique int id: @namequalifier, - unique int qualifiableelement: @namequalifiableelement ref, - int qualifyingelement: @namequalifyingelement ref, - int location: @location_default ref -); - -varbind( - int expr: @varbindexpr ref, - int var: @accessible ref -); - -funbind( - int expr: @funbindexpr ref, - int fun: @function ref -); - -@any_new_expr = @new_expr - | @new_array_expr; - -@new_or_delete_expr = @any_new_expr - | @delete_expr - | @delete_array_expr; - -@prefix_crement_expr = @preincrexpr | @predecrexpr; - -@postfix_crement_expr = @postincrexpr | @postdecrexpr; - -@increment_expr = @preincrexpr | @postincrexpr; - -@decrement_expr = @predecrexpr | @postdecrexpr; - -@crement_expr = @increment_expr | @decrement_expr; - -@un_arith_op_expr = @arithnegexpr - | @unaryplusexpr - | @conjugation - | @realpartexpr - | @imagpartexpr - | @crement_expr - ; - -@un_bitwise_op_expr = @complementexpr; - -@un_log_op_expr = @notexpr; - -@un_op_expr = @address_of - | @indirect - | @un_arith_op_expr - | @un_bitwise_op_expr - | @builtinaddressof - | @vec_fill - | @un_log_op_expr - | @co_await - | @co_yield - ; - -@bin_log_op_expr = @andlogicalexpr | @orlogicalexpr; - -@cmp_op_expr = @eq_op_expr | @rel_op_expr; - -@eq_op_expr = @eqexpr | @neexpr; - -@rel_op_expr = @gtexpr - | @ltexpr - | @geexpr - | @leexpr - | @spaceshipexpr - ; - -@bin_bitwise_op_expr = @lshiftexpr - | @rshiftexpr - | @andexpr - | @orexpr - | @xorexpr - ; - -@p_arith_op_expr = @paddexpr - | @psubexpr - | @pdiffexpr - ; - -@bin_arith_op_expr = @addexpr - | @subexpr - | @mulexpr - | @divexpr - | @remexpr - | @jmulexpr - | @jdivexpr - | @fjaddexpr - | @jfaddexpr - | @fjsubexpr - | @jfsubexpr - | @minexpr - | @maxexpr - | @p_arith_op_expr - ; - -@bin_op_expr = @bin_arith_op_expr - | @bin_bitwise_op_expr - | @cmp_op_expr - | @bin_log_op_expr - ; - -@op_expr = @un_op_expr - | @bin_op_expr - | @assign_expr - | @conditionalexpr - ; - -@assign_arith_expr = @assignaddexpr - | @assignsubexpr - | @assignmulexpr - | @assigndivexpr - | @assignremexpr - ; - -@assign_bitwise_expr = @assignandexpr - | @assignorexpr - | @assignxorexpr - | @assignlshiftexpr - | @assignrshiftexpr - ; - -@assign_pointer_expr = @assignpaddexpr - | @assignpsubexpr - ; - -@assign_op_expr = @assign_arith_expr - | @assign_bitwise_expr - | @assign_pointer_expr - ; - -@assign_expr = @assignexpr | @assign_op_expr | @blockassignexpr - -/* - Binary encoding of the allocator form. - - case @allocator.form of - 0 = plain - | 1 = alignment - ; -*/ - -/** - * The allocator function associated with a `new` or `new[]` expression. - * The `form` column specified whether the allocation call contains an alignment - * argument. - */ -expr_allocator( - unique int expr: @any_new_expr ref, - int func: @function ref, - int form: int ref -); - -/* - Binary encoding of the deallocator form. - - case @deallocator.form of - 0 = plain - | 1 = size - | 2 = alignment - | 4 = destroying_delete - ; -*/ - -/** - * The deallocator function associated with a `delete`, `delete[]`, `new`, or - * `new[]` expression. For a `new` or `new[]` expression, the deallocator is the - * one used to free memory if the initialization throws an exception. - * The `form` column specifies whether the deallocation call contains a size - * argument, and alignment argument, or both. - */ -expr_deallocator( - unique int expr: @new_or_delete_expr ref, - int func: @function ref, - int form: int ref -); - -/** - * Holds if the `@conditionalexpr` is of the two operand form - * `guard ? : false`. - */ -expr_cond_two_operand( - unique int cond: @conditionalexpr ref -); - -/** - * The guard of `@conditionalexpr` `guard ? true : false` - */ -expr_cond_guard( - unique int cond: @conditionalexpr ref, - int guard: @expr ref -); - -/** - * The expression used when the guard of `@conditionalexpr` - * `guard ? true : false` holds. For the two operand form - * `guard ?: false` consider using `expr_cond_guard` instead. - */ -expr_cond_true( - unique int cond: @conditionalexpr ref, - int true: @expr ref -); - -/** - * The expression used when the guard of `@conditionalexpr` - * `guard ? true : false` does not hold. - */ -expr_cond_false( - unique int cond: @conditionalexpr ref, - int false: @expr ref -); - -/** A string representation of the value. */ -values( - unique int id: @value, - string str: string ref -); - -/** The actual text in the source code for the value, if any. */ -valuetext( - unique int id: @value ref, - string text: string ref -); - -valuebind( - int val: @value ref, - unique int expr: @expr ref -); - -fieldoffsets( - unique int id: @variable ref, - int byteoffset: int ref, - int bitoffset: int ref -); - -bitfield( - unique int id: @variable ref, - int bits: int ref, - int declared_bits: int ref -); - -/* TODO -memberprefix( - int member: @expr ref, - int prefix: @expr ref -); -*/ - -/* - kind(1) = mbrcallexpr - kind(2) = mbrptrcallexpr - kind(3) = mbrptrmbrcallexpr - kind(4) = ptrmbrptrmbrcallexpr - kind(5) = mbrreadexpr // x.y - kind(6) = mbrptrreadexpr // p->y - kind(7) = mbrptrmbrreadexpr // x.*pm - kind(8) = mbrptrmbrptrreadexpr // x->*pm - kind(9) = staticmbrreadexpr // static x.y - kind(10) = staticmbrptrreadexpr // static p->y -*/ -/* TODO -memberaccess( - int member: @expr ref, - int kind: int ref -); -*/ - -initialisers( - unique int init: @initialiser, - int var: @accessible ref, - unique int expr: @expr ref, - int location: @location_expr ref -); - -braced_initialisers( - int init: @initialiser ref -); - -/** - * An ancestor for the expression, for cases in which we cannot - * otherwise find the expression's parent. - */ -expr_ancestor( - int exp: @expr ref, - int ancestor: @element ref -); - -exprs( - unique int id: @expr, - int kind: int ref, - int location: @location_expr ref -); - -expr_reuse( - int reuse: @expr ref, - int original: @expr ref, - int value_category: int ref -) - -/* - case @value.category of - 1 = prval - | 2 = xval - | 3 = lval - ; -*/ -expr_types( - int id: @expr ref, - int typeid: @type ref, - int value_category: int ref -); - -case @expr.kind of - 1 = @errorexpr -| 2 = @address_of // & AddressOfExpr -| 3 = @reference_to // ReferenceToExpr (implicit?) -| 4 = @indirect // * PointerDereferenceExpr -| 5 = @ref_indirect // ReferenceDereferenceExpr (implicit?) -// ... -| 8 = @array_to_pointer // (???) -| 9 = @vacuous_destructor_call // VacuousDestructorCall -// ... -| 11 = @assume // Microsoft -| 12 = @parexpr -| 13 = @arithnegexpr -| 14 = @unaryplusexpr -| 15 = @complementexpr -| 16 = @notexpr -| 17 = @conjugation // GNU ~ operator -| 18 = @realpartexpr // GNU __real -| 19 = @imagpartexpr // GNU __imag -| 20 = @postincrexpr -| 21 = @postdecrexpr -| 22 = @preincrexpr -| 23 = @predecrexpr -| 24 = @conditionalexpr -| 25 = @addexpr -| 26 = @subexpr -| 27 = @mulexpr -| 28 = @divexpr -| 29 = @remexpr -| 30 = @jmulexpr // C99 mul imaginary -| 31 = @jdivexpr // C99 div imaginary -| 32 = @fjaddexpr // C99 add real + imaginary -| 33 = @jfaddexpr // C99 add imaginary + real -| 34 = @fjsubexpr // C99 sub real - imaginary -| 35 = @jfsubexpr // C99 sub imaginary - real -| 36 = @paddexpr // pointer add (pointer + int or int + pointer) -| 37 = @psubexpr // pointer sub (pointer - integer) -| 38 = @pdiffexpr // difference between two pointers -| 39 = @lshiftexpr -| 40 = @rshiftexpr -| 41 = @andexpr -| 42 = @orexpr -| 43 = @xorexpr -| 44 = @eqexpr -| 45 = @neexpr -| 46 = @gtexpr -| 47 = @ltexpr -| 48 = @geexpr -| 49 = @leexpr -| 50 = @minexpr // GNU minimum -| 51 = @maxexpr // GNU maximum -| 52 = @assignexpr -| 53 = @assignaddexpr -| 54 = @assignsubexpr -| 55 = @assignmulexpr -| 56 = @assigndivexpr -| 57 = @assignremexpr -| 58 = @assignlshiftexpr -| 59 = @assignrshiftexpr -| 60 = @assignandexpr -| 61 = @assignorexpr -| 62 = @assignxorexpr -| 63 = @assignpaddexpr // assign pointer add -| 64 = @assignpsubexpr // assign pointer sub -| 65 = @andlogicalexpr -| 66 = @orlogicalexpr -| 67 = @commaexpr -| 68 = @subscriptexpr // access to member of an array, e.g., a[5] -// ... 69 @objc_subscriptexpr deprecated -// ... 70 @cmdaccess deprecated -// ... -| 73 = @virtfunptrexpr -| 74 = @callexpr -// ... 75 @msgexpr_normal deprecated -// ... 76 @msgexpr_super deprecated -// ... 77 @atselectorexpr deprecated -// ... 78 @atprotocolexpr deprecated -| 79 = @vastartexpr -| 80 = @vaargexpr -| 81 = @vaendexpr -| 82 = @vacopyexpr -// ... 83 @atencodeexpr deprecated -| 84 = @varaccess -| 85 = @thisaccess -// ... 86 @objc_box_expr deprecated -| 87 = @new_expr -| 88 = @delete_expr -| 89 = @throw_expr -| 90 = @condition_decl // a variable declared in a condition, e.g., if(int x = y > 2) -| 91 = @braced_init_list -| 92 = @type_id -| 93 = @runtime_sizeof -| 94 = @runtime_alignof -| 95 = @sizeof_pack -| 96 = @expr_stmt // GNU extension -| 97 = @routineexpr -| 98 = @type_operand // used to access a type in certain contexts (haven't found any examples yet....) -| 99 = @offsetofexpr // offsetof ::= type and field -| 100 = @hasassignexpr // __has_assign ::= type -| 101 = @hascopyexpr // __has_copy ::= type -| 102 = @hasnothrowassign // __has_nothrow_assign ::= type -| 103 = @hasnothrowconstr // __has_nothrow_constructor ::= type -| 104 = @hasnothrowcopy // __has_nothrow_copy ::= type -| 105 = @hastrivialassign // __has_trivial_assign ::= type -| 106 = @hastrivialconstr // __has_trivial_constructor ::= type -| 107 = @hastrivialcopy // __has_trivial_copy ::= type -| 108 = @hasuserdestr // __has_user_destructor ::= type -| 109 = @hasvirtualdestr // __has_virtual_destructor ::= type -| 110 = @isabstractexpr // __is_abstract ::= type -| 111 = @isbaseofexpr // __is_base_of ::= type type -| 112 = @isclassexpr // __is_class ::= type -| 113 = @isconvtoexpr // __is_convertible_to ::= type type -| 114 = @isemptyexpr // __is_empty ::= type -| 115 = @isenumexpr // __is_enum ::= type -| 116 = @ispodexpr // __is_pod ::= type -| 117 = @ispolyexpr // __is_polymorphic ::= type -| 118 = @isunionexpr // __is_union ::= type -| 119 = @typescompexpr // GNU __builtin_types_compatible ::= type type -| 120 = @intaddrexpr // frontend internal builtin, used to implement offsetof -// ... -| 122 = @hastrivialdestructor // __has_trivial_destructor ::= type -| 123 = @literal -| 124 = @uuidof -| 127 = @aggregateliteral -| 128 = @delete_array_expr -| 129 = @new_array_expr -// ... 130 @objc_array_literal deprecated -// ... 131 @objc_dictionary_literal deprecated -| 132 = @foldexpr -// ... -| 200 = @ctordirectinit -| 201 = @ctorvirtualinit -| 202 = @ctorfieldinit -| 203 = @ctordelegatinginit -| 204 = @dtordirectdestruct -| 205 = @dtorvirtualdestruct -| 206 = @dtorfielddestruct -// ... -| 210 = @static_cast -| 211 = @reinterpret_cast -| 212 = @const_cast -| 213 = @dynamic_cast -| 214 = @c_style_cast -| 215 = @lambdaexpr -| 216 = @param_ref -| 217 = @noopexpr -// ... -| 294 = @istriviallyconstructibleexpr -| 295 = @isdestructibleexpr -| 296 = @isnothrowdestructibleexpr -| 297 = @istriviallydestructibleexpr -| 298 = @istriviallyassignableexpr -| 299 = @isnothrowassignableexpr -| 300 = @istrivialexpr -| 301 = @isstandardlayoutexpr -| 302 = @istriviallycopyableexpr -| 303 = @isliteraltypeexpr -| 304 = @hastrivialmoveconstructorexpr -| 305 = @hastrivialmoveassignexpr -| 306 = @hasnothrowmoveassignexpr -| 307 = @isconstructibleexpr -| 308 = @isnothrowconstructibleexpr -| 309 = @hasfinalizerexpr -| 310 = @isdelegateexpr -| 311 = @isinterfaceclassexpr -| 312 = @isrefarrayexpr -| 313 = @isrefclassexpr -| 314 = @issealedexpr -| 315 = @issimplevalueclassexpr -| 316 = @isvalueclassexpr -| 317 = @isfinalexpr -| 319 = @noexceptexpr -| 320 = @builtinshufflevector -| 321 = @builtinchooseexpr -| 322 = @builtinaddressof -| 323 = @vec_fill -| 324 = @builtinconvertvector -| 325 = @builtincomplex -| 326 = @spaceshipexpr -| 327 = @co_await -| 328 = @co_yield -| 329 = @temp_init -| 330 = @isassignable -| 331 = @isaggregate -| 332 = @hasuniqueobjectrepresentations -| 333 = @builtinbitcast -| 334 = @builtinshuffle -| 335 = @blockassignexpr -| 336 = @issame -| 337 = @isfunction -| 338 = @islayoutcompatible -| 339 = @ispointerinterconvertiblebaseof -| 340 = @isarray -| 341 = @arrayrank -| 342 = @arrayextent -| 343 = @isarithmetic -| 344 = @iscompletetype -| 345 = @iscompound -| 346 = @isconst -| 347 = @isfloatingpoint -| 348 = @isfundamental -| 349 = @isintegral -| 350 = @islvaluereference -| 351 = @ismemberfunctionpointer -| 352 = @ismemberobjectpointer -| 353 = @ismemberpointer -| 354 = @isobject -| 355 = @ispointer -| 356 = @isreference -| 357 = @isrvaluereference -| 358 = @isscalar -| 359 = @issigned -| 360 = @isunsigned -| 361 = @isvoid -| 362 = @isvolatile -| 363 = @reuseexpr -| 364 = @istriviallycopyassignable -| 365 = @isassignablenopreconditioncheck -| 366 = @referencebindstotemporary -| 367 = @issameas -| 368 = @builtinhasattribute -| 369 = @ispointerinterconvertiblewithclass -| 370 = @builtinispointerinterconvertiblewithclass -| 371 = @iscorrespondingmember -| 372 = @builtiniscorrespondingmember -| 373 = @isboundedarray -| 374 = @isunboundedarray -| 375 = @isreferenceable -| 378 = @isnothrowconvertible -| 379 = @referenceconstructsfromtemporary -| 380 = @referenceconvertsfromtemporary -| 381 = @isconvertible -| 382 = @isvalidwinrttype -| 383 = @iswinclass -| 384 = @iswininterface -| 385 = @istriviallyequalitycomparable -| 386 = @isscopedenum -| 387 = @istriviallyrelocatable -| 388 = @datasizeof -| 389 = @c11_generic -| 390 = @requires_expr -| 391 = @nested_requirement -| 392 = @compound_requirement -| 393 = @concept_id -; - -@var_args_expr = @vastartexpr - | @vaendexpr - | @vaargexpr - | @vacopyexpr - ; - -@builtin_op = @var_args_expr - | @noopexpr - | @offsetofexpr - | @intaddrexpr - | @hasassignexpr - | @hascopyexpr - | @hasnothrowassign - | @hasnothrowconstr - | @hasnothrowcopy - | @hastrivialassign - | @hastrivialconstr - | @hastrivialcopy - | @hastrivialdestructor - | @hasuserdestr - | @hasvirtualdestr - | @isabstractexpr - | @isbaseofexpr - | @isclassexpr - | @isconvtoexpr - | @isemptyexpr - | @isenumexpr - | @ispodexpr - | @ispolyexpr - | @isunionexpr - | @typescompexpr - | @builtinshufflevector - | @builtinconvertvector - | @builtinaddressof - | @istriviallyconstructibleexpr - | @isdestructibleexpr - | @isnothrowdestructibleexpr - | @istriviallydestructibleexpr - | @istriviallyassignableexpr - | @isnothrowassignableexpr - | @istrivialexpr - | @isstandardlayoutexpr - | @istriviallycopyableexpr - | @isliteraltypeexpr - | @hastrivialmoveconstructorexpr - | @hastrivialmoveassignexpr - | @hasnothrowmoveassignexpr - | @isconstructibleexpr - | @isnothrowconstructibleexpr - | @hasfinalizerexpr - | @isdelegateexpr - | @isinterfaceclassexpr - | @isrefarrayexpr - | @isrefclassexpr - | @issealedexpr - | @issimplevalueclassexpr - | @isvalueclassexpr - | @isfinalexpr - | @builtinchooseexpr - | @builtincomplex - | @isassignable - | @isaggregate - | @hasuniqueobjectrepresentations - | @builtinbitcast - | @builtinshuffle - | @issame - | @isfunction - | @islayoutcompatible - | @ispointerinterconvertiblebaseof - | @isarray - | @arrayrank - | @arrayextent - | @isarithmetic - | @iscompletetype - | @iscompound - | @isconst - | @isfloatingpoint - | @isfundamental - | @isintegral - | @islvaluereference - | @ismemberfunctionpointer - | @ismemberobjectpointer - | @ismemberpointer - | @isobject - | @ispointer - | @isreference - | @isrvaluereference - | @isscalar - | @issigned - | @isunsigned - | @isvoid - | @isvolatile - | @istriviallycopyassignable - | @isassignablenopreconditioncheck - | @referencebindstotemporary - | @issameas - | @builtinhasattribute - | @ispointerinterconvertiblewithclass - | @builtinispointerinterconvertiblewithclass - | @iscorrespondingmember - | @builtiniscorrespondingmember - | @isboundedarray - | @isunboundedarray - | @isreferenceable - | @isnothrowconvertible - | @referenceconstructsfromtemporary - | @referenceconvertsfromtemporary - | @isconvertible - | @isvalidwinrttype - | @iswinclass - | @iswininterface - | @istriviallyequalitycomparable - | @isscopedenum - | @istriviallyrelocatable - ; - -compound_requirement_is_noexcept( - int expr: @compound_requirement ref -); - -new_allocated_type( - unique int expr: @new_expr ref, - int type_id: @type ref -); - -new_array_allocated_type( - unique int expr: @new_array_expr ref, - int type_id: @type ref -); - -/** - * The field being initialized by an initializer expression within an aggregate - * initializer for a class/struct/union. Position is used to sort repeated initializers. - */ -#keyset[aggregate, position] -aggregate_field_init( - int aggregate: @aggregateliteral ref, - int initializer: @expr ref, - int field: @membervariable ref, - int position: int ref -); - -/** - * The index of the element being initialized by an initializer expression - * within an aggregate initializer for an array. Position is used to sort repeated initializers. - */ -#keyset[aggregate, position] -aggregate_array_init( - int aggregate: @aggregateliteral ref, - int initializer: @expr ref, - int element_index: int ref, - int position: int ref -); - -@ctorinit = @ctordirectinit - | @ctorvirtualinit - | @ctorfieldinit - | @ctordelegatinginit; -@dtordestruct = @dtordirectdestruct - | @dtorvirtualdestruct - | @dtorfielddestruct; - - -condition_decl_bind( - unique int expr: @condition_decl ref, - unique int decl: @declaration ref -); - -typeid_bind( - unique int expr: @type_id ref, - int type_id: @type ref -); - -uuidof_bind( - unique int expr: @uuidof ref, - int type_id: @type ref -); - -@runtime_sizeof_or_alignof = @runtime_sizeof | @runtime_alignof | @datasizeof; - -sizeof_bind( - unique int expr: @runtime_sizeof_or_alignof ref, - int type_id: @type ref -); - -code_block( - unique int block: @literal ref, - unique int routine: @function ref -); - -lambdas( - unique int expr: @lambdaexpr ref, - string default_capture: string ref, - boolean has_explicit_return_type: boolean ref -); - -lambda_capture( - unique int id: @lambdacapture, - int lambda: @lambdaexpr ref, - int index: int ref, - int field: @membervariable ref, - boolean captured_by_reference: boolean ref, - boolean is_implicit: boolean ref, - int location: @location_default ref -); - -@funbindexpr = @routineexpr - | @new_expr - | @delete_expr - | @delete_array_expr - | @ctordirectinit - | @ctorvirtualinit - | @ctordelegatinginit - | @dtordirectdestruct - | @dtorvirtualdestruct; - -@varbindexpr = @varaccess | @ctorfieldinit | @dtorfielddestruct; -@addressable = @function | @variable ; -@accessible = @addressable | @enumconstant ; - -@access = @varaccess | @routineexpr ; - -fold( - int expr: @foldexpr ref, - string operator: string ref, - boolean is_left_fold: boolean ref -); - -stmts( - unique int id: @stmt, - int kind: int ref, - int location: @location_stmt ref -); - -case @stmt.kind of - 1 = @stmt_expr -| 2 = @stmt_if -| 3 = @stmt_while -| 4 = @stmt_goto -| 5 = @stmt_label -| 6 = @stmt_return -| 7 = @stmt_block -| 8 = @stmt_end_test_while // do { ... } while ( ... ) -| 9 = @stmt_for -| 10 = @stmt_switch_case -| 11 = @stmt_switch -| 13 = @stmt_asm // "asm" statement or the body of an asm function -| 15 = @stmt_try_block -| 16 = @stmt_microsoft_try // Microsoft -| 17 = @stmt_decl -| 18 = @stmt_set_vla_size // C99 -| 19 = @stmt_vla_decl // C99 -| 25 = @stmt_assigned_goto // GNU -| 26 = @stmt_empty -| 27 = @stmt_continue -| 28 = @stmt_break -| 29 = @stmt_range_based_for // C++11 -// ... 30 @stmt_at_autoreleasepool_block deprecated -// ... 31 @stmt_objc_for_in deprecated -// ... 32 @stmt_at_synchronized deprecated -| 33 = @stmt_handler -// ... 34 @stmt_finally_end deprecated -| 35 = @stmt_constexpr_if -| 37 = @stmt_co_return -; - -type_vla( - int type_id: @type ref, - int decl: @stmt_vla_decl ref -); - -variable_vla( - int var: @variable ref, - int decl: @stmt_vla_decl ref -); - -if_initialization( - unique int if_stmt: @stmt_if ref, - int init_id: @stmt ref -); - -if_then( - unique int if_stmt: @stmt_if ref, - int then_id: @stmt ref -); - -if_else( - unique int if_stmt: @stmt_if ref, - int else_id: @stmt ref -); - -constexpr_if_initialization( - unique int constexpr_if_stmt: @stmt_constexpr_if ref, - int init_id: @stmt ref -); - -constexpr_if_then( - unique int constexpr_if_stmt: @stmt_constexpr_if ref, - int then_id: @stmt ref -); - -constexpr_if_else( - unique int constexpr_if_stmt: @stmt_constexpr_if ref, - int else_id: @stmt ref -); - -while_body( - unique int while_stmt: @stmt_while ref, - int body_id: @stmt ref -); - -do_body( - unique int do_stmt: @stmt_end_test_while ref, - int body_id: @stmt ref -); - -switch_initialization( - unique int switch_stmt: @stmt_switch ref, - int init_id: @stmt ref -); - -#keyset[switch_stmt, index] -switch_case( - int switch_stmt: @stmt_switch ref, - int index: int ref, - int case_id: @stmt_switch_case ref -); - -switch_body( - unique int switch_stmt: @stmt_switch ref, - int body_id: @stmt ref -); - -@stmt_for_or_range_based_for = @stmt_for - | @stmt_range_based_for; - -for_initialization( - unique int for_stmt: @stmt_for_or_range_based_for ref, - int init_id: @stmt ref -); - -for_condition( - unique int for_stmt: @stmt_for ref, - int condition_id: @expr ref -); - -for_update( - unique int for_stmt: @stmt_for ref, - int update_id: @expr ref -); - -for_body( - unique int for_stmt: @stmt_for ref, - int body_id: @stmt ref -); - -@stmtparent = @stmt | @expr_stmt ; -stmtparents( - unique int id: @stmt ref, - int index: int ref, - int parent: @stmtparent ref -); - -ishandler(unique int block: @stmt_block ref); - -@cfgnode = @stmt | @expr | @function | @initialiser ; - -stmt_decl_bind( - int stmt: @stmt_decl ref, - int num: int ref, - int decl: @declaration ref -); - -stmt_decl_entry_bind( - int stmt: @stmt_decl ref, - int num: int ref, - int decl_entry: @element ref -); - -@parameterized_element = @function | @stmt_block | @requires_expr; - -blockscope( - unique int block: @stmt_block ref, - int enclosing: @parameterized_element ref -); - -@jump = @stmt_goto | @stmt_break | @stmt_continue; - -@jumporlabel = @jump | @stmt_label | @literal; - -jumpinfo( - unique int id: @jumporlabel ref, - string str: string ref, - int target: @stmt ref -); - -preprocdirects( - unique int id: @preprocdirect, - int kind: int ref, - int location: @location_default ref -); -case @preprocdirect.kind of - 0 = @ppd_if -| 1 = @ppd_ifdef -| 2 = @ppd_ifndef -| 3 = @ppd_elif -| 4 = @ppd_else -| 5 = @ppd_endif -| 6 = @ppd_plain_include -| 7 = @ppd_define -| 8 = @ppd_undef -| 9 = @ppd_line -| 10 = @ppd_error -| 11 = @ppd_pragma -| 12 = @ppd_objc_import -| 13 = @ppd_include_next -| 18 = @ppd_warning -; - -@ppd_include = @ppd_plain_include | @ppd_objc_import | @ppd_include_next; - -@ppd_branch = @ppd_if | @ppd_ifdef | @ppd_ifndef | @ppd_elif; - -preprocpair( - int begin : @ppd_branch ref, - int elseelifend : @preprocdirect ref -); - -preproctrue(int branch : @ppd_branch ref); -preprocfalse(int branch : @ppd_branch ref); - -preproctext( - unique int id: @preprocdirect ref, - string head: string ref, - string body: string ref -); - -includes( - unique int id: @ppd_include ref, - int included: @file ref -); - -link_targets( - int id: @link_target, - int binary: @file ref -); - -link_parent( - int element : @element ref, - int link_target : @link_target ref -); - -/* XML Files */ - -xmlEncoding(unique int id: @file ref, string encoding: string ref); - -xmlDTDs( - unique int id: @xmldtd, - string root: string ref, - string publicId: string ref, - string systemId: string ref, - int fileid: @file ref -); - -xmlElements( - unique int id: @xmlelement, - string name: string ref, - int parentid: @xmlparent ref, - int idx: int ref, - int fileid: @file ref -); - -xmlAttrs( - unique int id: @xmlattribute, - int elementid: @xmlelement ref, - string name: string ref, - string value: string ref, - int idx: int ref, - int fileid: @file ref -); - -xmlNs( - int id: @xmlnamespace, - string prefixName: string ref, - string URI: string ref, - int fileid: @file ref -); - -xmlHasNs( - int elementId: @xmlnamespaceable ref, - int nsId: @xmlnamespace ref, - int fileid: @file ref -); - -xmlComments( - unique int id: @xmlcomment, - string text: string ref, - int parentid: @xmlparent ref, - int fileid: @file ref -); - -xmlChars( - unique int id: @xmlcharacters, - string text: string ref, - int parentid: @xmlparent ref, - int idx: int ref, - int isCDATA: int ref, - int fileid: @file ref -); - -@xmlparent = @file | @xmlelement; -@xmlnamespaceable = @xmlelement | @xmlattribute; - -xmllocations( - int xmlElement: @xmllocatable ref, - int location: @location_default ref -); - -@xmllocatable = @xmlcharacters - | @xmlelement - | @xmlcomment - | @xmlattribute - | @xmldtd - | @file - | @xmlnamespace; diff --git a/cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/upgrade.properties b/cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/upgrade.properties deleted file mode 100644 index 08e1dc42eb2..00000000000 --- a/cpp/ql/lib/upgrades/e51fad7a2436caefab0c6bd52f05e28e7cce4d92/upgrade.properties +++ /dev/null @@ -1,2 +0,0 @@ -description: Implement compilation_build_mode/2 -compatibility: backwards From 2e90c80a6f85fb451467b66002e7949490115bd0 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Fri, 22 Nov 2024 13:45:00 +0100 Subject: [PATCH 46/47] Rust: accept test changes --- .../CONSISTENCY/DataFlowConsistency.expected | 4 --- .../CONSISTENCY/DataFlowConsistency.expected | 5 ---- .../formatstrings/FormatTemplate.expected | 30 +++++++++---------- .../CONSISTENCY/DataFlowConsistency.expected | 4 --- .../CONSISTENCY/DataFlowConsistency.expected | 5 ---- 5 files changed, 15 insertions(+), 33 deletions(-) delete mode 100644 rust/ql/test/library-tests/definitions/CONSISTENCY/DataFlowConsistency.expected delete mode 100644 rust/ql/test/library-tests/formatstrings/CONSISTENCY/DataFlowConsistency.expected delete mode 100644 rust/ql/test/query-tests/unusedentities/CONSISTENCY/DataFlowConsistency.expected diff --git a/rust/ql/test/library-tests/definitions/CONSISTENCY/DataFlowConsistency.expected b/rust/ql/test/library-tests/definitions/CONSISTENCY/DataFlowConsistency.expected deleted file mode 100644 index 8d729bb5fd9..00000000000 --- a/rust/ql/test/library-tests/definitions/CONSISTENCY/DataFlowConsistency.expected +++ /dev/null @@ -1,4 +0,0 @@ -uniqueEnclosingCallable -| main.rs:5:29:5:33 | width | Node should have one enclosing callable but has 0. | -| main.rs:5:36:5:44 | precision | Node should have one enclosing callable but has 0. | -| main.rs:9:22:9:27 | people | Node should have one enclosing callable but has 0. | diff --git a/rust/ql/test/library-tests/formatstrings/CONSISTENCY/DataFlowConsistency.expected b/rust/ql/test/library-tests/formatstrings/CONSISTENCY/DataFlowConsistency.expected deleted file mode 100644 index 5bd870a7205..00000000000 --- a/rust/ql/test/library-tests/formatstrings/CONSISTENCY/DataFlowConsistency.expected +++ /dev/null @@ -1,5 +0,0 @@ -uniqueEnclosingCallable -| main.rs:5:29:5:33 | width | Node should have one enclosing callable but has 0. | -| main.rs:5:36:5:44 | precision | Node should have one enclosing callable but has 0. | -| main.rs:16:22:16:27 | people | Node should have one enclosing callable but has 0. | -| main.rs:27:23:27:27 | width | Node should have one enclosing callable but has 0. | diff --git a/rust/ql/test/library-tests/formatstrings/FormatTemplate.expected b/rust/ql/test/library-tests/formatstrings/FormatTemplate.expected index 6750a5dc5f0..b554f7e7920 100644 --- a/rust/ql/test/library-tests/formatstrings/FormatTemplate.expected +++ b/rust/ql/test/library-tests/formatstrings/FormatTemplate.expected @@ -2,20 +2,20 @@ getFormat | main.rs:5:14:5:61 | FormatArgsExpr | main.rs:5:21:5:46 | {value:#width$.precision$} | 0 | | main.rs:6:14:6:56 | FormatArgsExpr | main.rs:6:21:6:30 | {0:#1$.2$} | 0 | | main.rs:7:14:7:40 | FormatArgsExpr | main.rs:7:21:7:22 | {} | 0 | -| main.rs:7:14:7:40 | FormatArgsExpr | main.rs:7:24:7:25 | {} | 1 | +| main.rs:7:14:7:40 | FormatArgsExpr | main.rs:7:24:7:25 | {} | 2 | | main.rs:11:14:11:34 | FormatArgsExpr | main.rs:11:22:11:23 | {} | 0 | | main.rs:12:14:12:34 | FormatArgsExpr | main.rs:12:29:12:30 | {} | 0 | | main.rs:13:14:13:27 | FormatArgsExpr | main.rs:13:15:13:18 | {:?} | 0 | | main.rs:14:14:14:33 | FormatArgsExpr | main.rs:14:15:14:21 | {value} | 0 | | main.rs:16:14:16:30 | FormatArgsExpr | main.rs:16:21:16:28 | {people} | 0 | | main.rs:17:14:17:26 | FormatArgsExpr | main.rs:17:15:17:16 | {} | 0 | -| main.rs:17:14:17:26 | FormatArgsExpr | main.rs:17:18:17:19 | {} | 1 | +| main.rs:17:14:17:26 | FormatArgsExpr | main.rs:17:18:17:19 | {} | 2 | | main.rs:18:14:18:24 | FormatArgsExpr | main.rs:18:15:18:19 | {:04} | 0 | | main.rs:19:14:19:32 | FormatArgsExpr | main.rs:19:15:19:19 | {:#?} | 0 | | main.rs:21:14:21:34 | FormatArgsExpr | main.rs:21:15:21:17 | {1} | 0 | -| main.rs:21:14:21:34 | FormatArgsExpr | main.rs:21:19:21:20 | {} | 1 | -| main.rs:21:14:21:34 | FormatArgsExpr | main.rs:21:22:21:24 | {0} | 2 | -| main.rs:21:14:21:34 | FormatArgsExpr | main.rs:21:26:21:27 | {} | 3 | +| main.rs:21:14:21:34 | FormatArgsExpr | main.rs:21:19:21:20 | {} | 2 | +| main.rs:21:14:21:34 | FormatArgsExpr | main.rs:21:22:21:24 | {0} | 4 | +| main.rs:21:14:21:34 | FormatArgsExpr | main.rs:21:26:21:27 | {} | 6 | | main.rs:22:14:22:31 | FormatArgsExpr | main.rs:22:21:22:24 | {:5} | 0 | | main.rs:23:14:23:35 | FormatArgsExpr | main.rs:23:21:23:25 | {:1$} | 0 | | main.rs:24:14:24:36 | FormatArgsExpr | main.rs:24:21:24:26 | {1:0$} | 0 | @@ -33,25 +33,25 @@ getFormat | main.rs:36:24:36:41 | FormatArgsExpr | main.rs:36:31:36:35 | {:05} | 0 | | main.rs:37:24:37:38 | FormatArgsExpr | main.rs:37:25:37:32 | {:#010x} | 0 | | main.rs:39:14:39:45 | FormatArgsExpr | main.rs:39:21:39:23 | {0} | 0 | -| main.rs:39:14:39:45 | FormatArgsExpr | main.rs:39:28:39:33 | {1:.5} | 1 | +| main.rs:39:14:39:45 | FormatArgsExpr | main.rs:39:28:39:33 | {1:.5} | 2 | | main.rs:41:14:41:49 | FormatArgsExpr | main.rs:41:21:41:23 | {1} | 0 | -| main.rs:41:14:41:49 | FormatArgsExpr | main.rs:41:28:41:34 | {2:.0$} | 1 | +| main.rs:41:14:41:49 | FormatArgsExpr | main.rs:41:28:41:34 | {2:.0$} | 2 | | main.rs:43:14:43:49 | FormatArgsExpr | main.rs:43:21:43:23 | {0} | 0 | -| main.rs:43:14:43:49 | FormatArgsExpr | main.rs:43:28:43:34 | {2:.1$} | 1 | +| main.rs:43:14:43:49 | FormatArgsExpr | main.rs:43:28:43:34 | {2:.1$} | 2 | | main.rs:45:14:45:46 | FormatArgsExpr | main.rs:45:21:45:22 | {} | 0 | -| main.rs:45:14:45:46 | FormatArgsExpr | main.rs:45:27:45:31 | {:.*} | 1 | +| main.rs:45:14:45:46 | FormatArgsExpr | main.rs:45:27:45:31 | {:.*} | 2 | | main.rs:47:14:47:48 | FormatArgsExpr | main.rs:47:21:47:23 | {1} | 0 | -| main.rs:47:14:47:48 | FormatArgsExpr | main.rs:47:28:47:33 | {2:.*} | 1 | +| main.rs:47:14:47:48 | FormatArgsExpr | main.rs:47:28:47:33 | {2:.*} | 2 | | main.rs:48:14:48:47 | FormatArgsExpr | main.rs:48:21:48:22 | {} | 0 | -| main.rs:48:14:48:47 | FormatArgsExpr | main.rs:48:27:48:32 | {2:.*} | 1 | +| main.rs:48:14:48:47 | FormatArgsExpr | main.rs:48:27:48:32 | {2:.*} | 2 | | main.rs:49:14:49:72 | FormatArgsExpr | main.rs:49:21:49:22 | {} | 0 | -| main.rs:49:14:49:72 | FormatArgsExpr | main.rs:49:27:49:41 | {number:.prec$} | 1 | +| main.rs:49:14:49:72 | FormatArgsExpr | main.rs:49:27:49:41 | {number:.prec$} | 2 | | main.rs:52:9:55:22 | FormatArgsExpr | main.rs:52:10:52:11 | {} | 0 | -| main.rs:52:9:55:22 | FormatArgsExpr | main.rs:52:15:52:23 | {name:.*} | 1 | +| main.rs:52:9:55:22 | FormatArgsExpr | main.rs:52:15:52:23 | {name:.*} | 2 | | main.rs:58:9:61:24 | FormatArgsExpr | main.rs:58:10:58:11 | {} | 0 | -| main.rs:58:9:61:24 | FormatArgsExpr | main.rs:58:15:58:23 | {name:.*} | 1 | +| main.rs:58:9:61:24 | FormatArgsExpr | main.rs:58:15:58:23 | {name:.*} | 2 | | main.rs:64:9:67:24 | FormatArgsExpr | main.rs:64:10:64:11 | {} | 0 | -| main.rs:64:9:67:24 | FormatArgsExpr | main.rs:64:15:64:25 | {name:>8.*} | 1 | +| main.rs:64:9:67:24 | FormatArgsExpr | main.rs:64:15:64:25 | {name:>8.*} | 2 | | main.rs:70:12:70:31 | FormatArgsExpr | main.rs:70:13:70:20 | {0:.1$e} | 0 | | main.rs:71:12:71:31 | FormatArgsExpr | main.rs:71:13:71:20 | {0:.1$e} | 0 | | main.rs:73:14:73:35 | FormatArgsExpr | main.rs:73:28:73:29 | {} | 0 | diff --git a/rust/ql/test/query-tests/security/CWE-089/CONSISTENCY/DataFlowConsistency.expected b/rust/ql/test/query-tests/security/CWE-089/CONSISTENCY/DataFlowConsistency.expected index 6e35019c1cb..d9a60435a6f 100644 --- a/rust/ql/test/query-tests/security/CWE-089/CONSISTENCY/DataFlowConsistency.expected +++ b/rust/ql/test/query-tests/security/CWE-089/CONSISTENCY/DataFlowConsistency.expected @@ -1,7 +1,3 @@ -uniqueEnclosingCallable -| sqlx.rs:52:72:52:84 | remote_number | Node should have one enclosing callable but has 0. | -| sqlx.rs:56:74:56:86 | remote_string | Node should have one enclosing callable but has 0. | -| sqlx.rs:199:32:199:44 | enable_remote | Node should have one enclosing callable but has 0. | uniqueNodeToString | sqlx.rs:154:13:154:81 | (no string representation) | Node should have one toString but has 0. | | sqlx.rs:156:17:156:86 | (no string representation) | Node should have one toString but has 0. | diff --git a/rust/ql/test/query-tests/unusedentities/CONSISTENCY/DataFlowConsistency.expected b/rust/ql/test/query-tests/unusedentities/CONSISTENCY/DataFlowConsistency.expected deleted file mode 100644 index 0a61a151c20..00000000000 --- a/rust/ql/test/query-tests/unusedentities/CONSISTENCY/DataFlowConsistency.expected +++ /dev/null @@ -1,5 +0,0 @@ -uniqueEnclosingCallable -| main.rs:194:25:194:25 | x | Node should have one enclosing callable but has 0. | -| main.rs:198:28:198:28 | x | Node should have one enclosing callable but has 0. | -| main.rs:202:28:202:28 | x | Node should have one enclosing callable but has 0. | -| main.rs:206:28:206:28 | x | Node should have one enclosing callable but has 0. | From 28d517da59c27d07534e84e43dc3b5d896cbd457 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Fri, 22 Nov 2024 14:13:15 +0100 Subject: [PATCH 47/47] Rust: fix regression in `getFormat` indexing --- .../elements/internal/FormatArgsExprImpl.qll | 3 +- .../FormatArgsExpr_getFormat.expected | 6 ++-- .../formatstrings/FormatTemplate.expected | 30 +++++++++---------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/rust/ql/lib/codeql/rust/elements/internal/FormatArgsExprImpl.qll b/rust/ql/lib/codeql/rust/elements/internal/FormatArgsExprImpl.qll index 59e020fb9e4..6cc3aa11461 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/FormatArgsExprImpl.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/FormatArgsExprImpl.qll @@ -25,7 +25,8 @@ module Impl { */ class FormatArgsExpr extends Generated::FormatArgsExpr { override Format getFormat(int index) { - result.getParent() = this and result.getIndex() = index + 1 + result = + rank[index + 1](Format f, int i | f.getParent() = this and f.getIndex() = i | f order by i) } } } diff --git a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getFormat.expected b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getFormat.expected index acbe782a35d..f0061b8dba4 100644 --- a/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getFormat.expected +++ b/rust/ql/test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getFormat.expected @@ -1,9 +1,9 @@ | gen_format.rs:5:14:5:32 | FormatArgsExpr | 0 | gen_format.rs:5:21:5:22 | {} | | gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | 0 | gen_format_args_expr.rs:6:19:6:20 | {} | -| gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | 2 | gen_format_args_expr.rs:6:26:6:29 | {:?} | +| gen_format_args_expr.rs:6:17:6:37 | FormatArgsExpr | 1 | gen_format_args_expr.rs:6:26:6:29 | {:?} | | gen_format_args_expr.rs:7:17:7:43 | FormatArgsExpr | 0 | gen_format_args_expr.rs:7:19:7:21 | {b} | -| gen_format_args_expr.rs:7:17:7:43 | FormatArgsExpr | 2 | gen_format_args_expr.rs:7:27:7:31 | {a:?} | +| gen_format_args_expr.rs:7:17:7:43 | FormatArgsExpr | 1 | gen_format_args_expr.rs:7:27:7:31 | {a:?} | | gen_format_args_expr.rs:9:17:9:28 | FormatArgsExpr | 0 | gen_format_args_expr.rs:9:19:9:21 | {x} | -| gen_format_args_expr.rs:9:17:9:28 | FormatArgsExpr | 2 | gen_format_args_expr.rs:9:24:9:26 | {y} | +| gen_format_args_expr.rs:9:17:9:28 | FormatArgsExpr | 1 | gen_format_args_expr.rs:9:24:9:26 | {y} | | gen_format_argument.rs:5:14:5:47 | FormatArgsExpr | 0 | gen_format_argument.rs:5:21:5:46 | {value:#width$.precision$} | | gen_format_argument.rs:7:14:7:56 | FormatArgsExpr | 0 | gen_format_argument.rs:7:21:7:30 | {0:#1$.2$} | diff --git a/rust/ql/test/library-tests/formatstrings/FormatTemplate.expected b/rust/ql/test/library-tests/formatstrings/FormatTemplate.expected index b554f7e7920..6750a5dc5f0 100644 --- a/rust/ql/test/library-tests/formatstrings/FormatTemplate.expected +++ b/rust/ql/test/library-tests/formatstrings/FormatTemplate.expected @@ -2,20 +2,20 @@ getFormat | main.rs:5:14:5:61 | FormatArgsExpr | main.rs:5:21:5:46 | {value:#width$.precision$} | 0 | | main.rs:6:14:6:56 | FormatArgsExpr | main.rs:6:21:6:30 | {0:#1$.2$} | 0 | | main.rs:7:14:7:40 | FormatArgsExpr | main.rs:7:21:7:22 | {} | 0 | -| main.rs:7:14:7:40 | FormatArgsExpr | main.rs:7:24:7:25 | {} | 2 | +| main.rs:7:14:7:40 | FormatArgsExpr | main.rs:7:24:7:25 | {} | 1 | | main.rs:11:14:11:34 | FormatArgsExpr | main.rs:11:22:11:23 | {} | 0 | | main.rs:12:14:12:34 | FormatArgsExpr | main.rs:12:29:12:30 | {} | 0 | | main.rs:13:14:13:27 | FormatArgsExpr | main.rs:13:15:13:18 | {:?} | 0 | | main.rs:14:14:14:33 | FormatArgsExpr | main.rs:14:15:14:21 | {value} | 0 | | main.rs:16:14:16:30 | FormatArgsExpr | main.rs:16:21:16:28 | {people} | 0 | | main.rs:17:14:17:26 | FormatArgsExpr | main.rs:17:15:17:16 | {} | 0 | -| main.rs:17:14:17:26 | FormatArgsExpr | main.rs:17:18:17:19 | {} | 2 | +| main.rs:17:14:17:26 | FormatArgsExpr | main.rs:17:18:17:19 | {} | 1 | | main.rs:18:14:18:24 | FormatArgsExpr | main.rs:18:15:18:19 | {:04} | 0 | | main.rs:19:14:19:32 | FormatArgsExpr | main.rs:19:15:19:19 | {:#?} | 0 | | main.rs:21:14:21:34 | FormatArgsExpr | main.rs:21:15:21:17 | {1} | 0 | -| main.rs:21:14:21:34 | FormatArgsExpr | main.rs:21:19:21:20 | {} | 2 | -| main.rs:21:14:21:34 | FormatArgsExpr | main.rs:21:22:21:24 | {0} | 4 | -| main.rs:21:14:21:34 | FormatArgsExpr | main.rs:21:26:21:27 | {} | 6 | +| main.rs:21:14:21:34 | FormatArgsExpr | main.rs:21:19:21:20 | {} | 1 | +| main.rs:21:14:21:34 | FormatArgsExpr | main.rs:21:22:21:24 | {0} | 2 | +| main.rs:21:14:21:34 | FormatArgsExpr | main.rs:21:26:21:27 | {} | 3 | | main.rs:22:14:22:31 | FormatArgsExpr | main.rs:22:21:22:24 | {:5} | 0 | | main.rs:23:14:23:35 | FormatArgsExpr | main.rs:23:21:23:25 | {:1$} | 0 | | main.rs:24:14:24:36 | FormatArgsExpr | main.rs:24:21:24:26 | {1:0$} | 0 | @@ -33,25 +33,25 @@ getFormat | main.rs:36:24:36:41 | FormatArgsExpr | main.rs:36:31:36:35 | {:05} | 0 | | main.rs:37:24:37:38 | FormatArgsExpr | main.rs:37:25:37:32 | {:#010x} | 0 | | main.rs:39:14:39:45 | FormatArgsExpr | main.rs:39:21:39:23 | {0} | 0 | -| main.rs:39:14:39:45 | FormatArgsExpr | main.rs:39:28:39:33 | {1:.5} | 2 | +| main.rs:39:14:39:45 | FormatArgsExpr | main.rs:39:28:39:33 | {1:.5} | 1 | | main.rs:41:14:41:49 | FormatArgsExpr | main.rs:41:21:41:23 | {1} | 0 | -| main.rs:41:14:41:49 | FormatArgsExpr | main.rs:41:28:41:34 | {2:.0$} | 2 | +| main.rs:41:14:41:49 | FormatArgsExpr | main.rs:41:28:41:34 | {2:.0$} | 1 | | main.rs:43:14:43:49 | FormatArgsExpr | main.rs:43:21:43:23 | {0} | 0 | -| main.rs:43:14:43:49 | FormatArgsExpr | main.rs:43:28:43:34 | {2:.1$} | 2 | +| main.rs:43:14:43:49 | FormatArgsExpr | main.rs:43:28:43:34 | {2:.1$} | 1 | | main.rs:45:14:45:46 | FormatArgsExpr | main.rs:45:21:45:22 | {} | 0 | -| main.rs:45:14:45:46 | FormatArgsExpr | main.rs:45:27:45:31 | {:.*} | 2 | +| main.rs:45:14:45:46 | FormatArgsExpr | main.rs:45:27:45:31 | {:.*} | 1 | | main.rs:47:14:47:48 | FormatArgsExpr | main.rs:47:21:47:23 | {1} | 0 | -| main.rs:47:14:47:48 | FormatArgsExpr | main.rs:47:28:47:33 | {2:.*} | 2 | +| main.rs:47:14:47:48 | FormatArgsExpr | main.rs:47:28:47:33 | {2:.*} | 1 | | main.rs:48:14:48:47 | FormatArgsExpr | main.rs:48:21:48:22 | {} | 0 | -| main.rs:48:14:48:47 | FormatArgsExpr | main.rs:48:27:48:32 | {2:.*} | 2 | +| main.rs:48:14:48:47 | FormatArgsExpr | main.rs:48:27:48:32 | {2:.*} | 1 | | main.rs:49:14:49:72 | FormatArgsExpr | main.rs:49:21:49:22 | {} | 0 | -| main.rs:49:14:49:72 | FormatArgsExpr | main.rs:49:27:49:41 | {number:.prec$} | 2 | +| main.rs:49:14:49:72 | FormatArgsExpr | main.rs:49:27:49:41 | {number:.prec$} | 1 | | main.rs:52:9:55:22 | FormatArgsExpr | main.rs:52:10:52:11 | {} | 0 | -| main.rs:52:9:55:22 | FormatArgsExpr | main.rs:52:15:52:23 | {name:.*} | 2 | +| main.rs:52:9:55:22 | FormatArgsExpr | main.rs:52:15:52:23 | {name:.*} | 1 | | main.rs:58:9:61:24 | FormatArgsExpr | main.rs:58:10:58:11 | {} | 0 | -| main.rs:58:9:61:24 | FormatArgsExpr | main.rs:58:15:58:23 | {name:.*} | 2 | +| main.rs:58:9:61:24 | FormatArgsExpr | main.rs:58:15:58:23 | {name:.*} | 1 | | main.rs:64:9:67:24 | FormatArgsExpr | main.rs:64:10:64:11 | {} | 0 | -| main.rs:64:9:67:24 | FormatArgsExpr | main.rs:64:15:64:25 | {name:>8.*} | 2 | +| main.rs:64:9:67:24 | FormatArgsExpr | main.rs:64:15:64:25 | {name:>8.*} | 1 | | main.rs:70:12:70:31 | FormatArgsExpr | main.rs:70:13:70:20 | {0:.1$e} | 0 | | main.rs:71:12:71:31 | FormatArgsExpr | main.rs:71:13:71:20 | {0:.1$e} | 0 | | main.rs:73:14:73:35 | FormatArgsExpr | main.rs:73:28:73:29 | {} | 0 |