Skip to content

Commit a3c7d5a

Browse files
committed
Merge branch 'main' into rust-data-flow-consistency
2 parents 82076ee + fb26f78 commit a3c7d5a

File tree

226 files changed

+34815
-32134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

226 files changed

+34815
-32134
lines changed

.github/codeql/codeql-config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ paths-ignore:
99
- '/python/'
1010
- '/javascript/ql/test'
1111
- '/javascript/extractor/tests'
12+
- '/rust/ql/test'
13+
- '/rust/ql/integration-tests'

.github/workflows/rust-analysis.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,7 @@ jobs:
5555
with:
5656
tools: ${{ steps.codeql.outputs.nightly_bundle }}
5757
languages: ${{ matrix.language }}
58-
config: |
59-
disable-default-queries: true
60-
queries:
61-
- uses: security-and-quality
62-
paths-ignore:
63-
- '/rust/ql/tests'
58+
config-file: ./.github/codeql/codeql-config.yml
6459

6560
- name: Autobuild
6661
uses: github/codeql-action/autobuild@main

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ private predicate isInvalidFunction(Function func) {
196196
expr.getEnclosingFunction() = func and
197197
not exists(expr.getType())
198198
)
199+
or
200+
count(func.getEntryPoint().getLocation()) > 1
199201
}
200202

201203
/**

cpp/ql/test/TestUtilities/InlineExpectationsTest.qll

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,5 @@
55

66
import cpp as C
77
private import codeql.util.test.InlineExpectationsTest
8-
9-
private module Impl implements InlineExpectationsTestSig {
10-
private newtype TExpectationComment = MkExpectationComment(C::CppStyleComment c)
11-
12-
/**
13-
* A class representing a line comment in the CPP style.
14-
* Unlike the `CppStyleComment` class, however, the string returned by `getContents` does _not_
15-
* include the preceding comment marker (`//`).
16-
*/
17-
class ExpectationComment extends TExpectationComment {
18-
C::CppStyleComment comment;
19-
20-
ExpectationComment() { this = MkExpectationComment(comment) }
21-
22-
/** Returns the contents of the given comment, _without_ the preceding comment marker (`//`). */
23-
string getContents() { result = comment.getContents().suffix(2) }
24-
25-
/** Gets a textual representation of this element. */
26-
string toString() { result = comment.toString() }
27-
28-
/** Gets the location of this comment. */
29-
Location getLocation() { result = comment.getLocation() }
30-
}
31-
32-
class Location = C::Location;
33-
}
34-
8+
private import internal.InlineExpectationsTestImpl
359
import Make<Impl>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* @kind test-postprocess
3+
*/
4+
5+
private import cpp
6+
private import codeql.util.test.InlineExpectationsTest as T
7+
private import internal.InlineExpectationsTestImpl
8+
import T::TestPostProcessing
9+
import T::TestPostProcessing::Make<Impl, Input>
10+
11+
private module Input implements T::TestPostProcessing::InputSig<Impl> {
12+
string getRelativeUrl(Location location) {
13+
exists(File f, int startline, int startcolumn, int endline, int endcolumn |
14+
location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
15+
f = location.getFile()
16+
|
17+
result =
18+
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
19+
)
20+
}
21+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import cpp as C
2+
private import codeql.util.test.InlineExpectationsTest
3+
4+
module Impl implements InlineExpectationsTestSig {
5+
private newtype TExpectationComment = MkExpectationComment(C::CppStyleComment c)
6+
7+
/**
8+
* A class representing a line comment in the CPP style.
9+
* Unlike the `CppStyleComment` class, however, the string returned by `getContents` does _not_
10+
* include the preceding comment marker (`//`).
11+
*/
12+
class ExpectationComment extends TExpectationComment {
13+
C::CppStyleComment comment;
14+
15+
ExpectationComment() { this = MkExpectationComment(comment) }
16+
17+
/** Returns the contents of the given comment, _without_ the preceding comment marker (`//`). */
18+
string getContents() { result = comment.getContents().suffix(2) }
19+
20+
/** Gets a textual representation of this element. */
21+
string toString() { result = comment.toString() }
22+
23+
/** Gets the location of this comment. */
24+
Location getLocation() { result = comment.getLocation() }
25+
}
26+
27+
class Location = C::Location;
28+
}

cpp/ql/test/library-tests/ir/multiple-entry-points/raw_ir.expected

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* @kind graph
3+
*/
4+
5+
private import cpp
6+
private import semmle.code.cpp.ir.implementation.raw.PrintIR
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
int foo(int i);
2+
3+
int foo(int i) {
4+
return 42;
5+
}
6+
7+
int bar();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
int foo(int i) {
2+
return i;
3+
}

0 commit comments

Comments
 (0)