Skip to content

Commit fab1bab

Browse files
committed
Merge branch 'main' into redsun82/swift-fix-arm-build
2 parents 70bf67c + a8dac17 commit fab1bab

File tree

413 files changed

+27372
-4708
lines changed

Some content is hidden

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

413 files changed

+27372
-4708
lines changed

Diff for: .github/workflows/cpp-swift-analysis.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: "Code scanning - C++"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'rc/*'
8+
pull_request:
9+
branches:
10+
- main
11+
- 'rc/*'
12+
paths:
13+
- 'swift/**'
14+
- '.github/codeql/**'
15+
- '.github/workflows/cpp-swift-analysis.yml'
16+
schedule:
17+
- cron: '0 9 * * 1'
18+
19+
jobs:
20+
CodeQL-Build:
21+
22+
runs-on: ubuntu-latest
23+
24+
permissions:
25+
contents: read
26+
security-events: write
27+
pull-requests: read
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
33+
# Initializes the CodeQL tools for scanning.
34+
- name: Initialize CodeQL
35+
uses: github/codeql-action/init@main
36+
# Override language selection by uncommenting this and choosing your languages
37+
with:
38+
languages: cpp
39+
config-file: ./.github/codeql/codeql-config.yml
40+
41+
- name: "[Ubuntu] Remove GCC 13 from runner image"
42+
shell: bash
43+
run: |
44+
sudo rm -f /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-jammy.list
45+
sudo apt-get update
46+
sudo apt-get install -y --allow-downgrades libc6=2.35-* libc6-dev=2.35-* libstdc++6=12.3.0-* libgcc-s1=12.3.0-*
47+
48+
- name: "Build Swift extractor using Bazel"
49+
run: |
50+
bazel clean --expunge
51+
bazel run //swift:create-extractor-pack --nouse_action_cache --noremote_accept_cached --noremote_upload_local_results --spawn_strategy=local --features=-layering_check
52+
bazel shutdown
53+
54+
- name: Perform CodeQL Analysis
55+
uses: github/codeql-action/analyze@main

Diff for: CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/cpp/ @github/codeql-c-analysis
2+
/cpp/autobuilder/ @github/codeql-c-extractor
23
/csharp/ @github/codeql-csharp
34
/go/ @github/codeql-go
45
/java/ @github/codeql-java

Diff for: cpp/autobuilder/Semmle.Autobuild.Cpp.Tests/BuildScripts.cs

+2-22
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,7 @@ void EndCallback(int ret, string s, bool silent)
250250
EndCallbackIn.Add(s);
251251
}
252252

253-
CppAutobuilder CreateAutoBuilder(bool isWindows,
254-
string? buildless = null, string? solution = null, string? buildCommand = null, string? ignoreErrors = null,
255-
string? msBuildArguments = null, string? msBuildPlatform = null, string? msBuildConfiguration = null, string? msBuildTarget = null,
256-
string? dotnetArguments = null, string? dotnetVersion = null, string? vsToolsVersion = null,
257-
string? nugetRestore = null, string? allSolutions = null,
258-
string cwd = @"C:\Project")
253+
CppAutobuilder CreateAutoBuilder(bool isWindows, string? dotnetVersion = null, string cwd = @"C:\Project")
259254
{
260255
string codeqlUpperLanguage = Language.Cpp.UpperCaseName;
261256
Actions.GetEnvironmentVariable[$"CODEQL_AUTOBUILDER_{codeqlUpperLanguage}_NO_INDEXING"] = "false";
@@ -265,22 +260,7 @@ CppAutobuilder CreateAutoBuilder(bool isWindows,
265260
Actions.GetEnvironmentVariable[$"CODEQL_EXTRACTOR_{codeqlUpperLanguage}_DIAGNOSTIC_DIR"] = "";
266261
Actions.GetEnvironmentVariable["CODEQL_JAVA_HOME"] = @"C:\codeql\tools\java";
267262
Actions.GetEnvironmentVariable["CODEQL_PLATFORM"] = "win64";
268-
Actions.GetEnvironmentVariable["SEMMLE_DIST"] = @"C:\odasa";
269-
Actions.GetEnvironmentVariable["SEMMLE_JAVA_HOME"] = @"C:\odasa\tools\java";
270-
Actions.GetEnvironmentVariable["SEMMLE_PLATFORM_TOOLS"] = @"C:\odasa\tools";
271-
Actions.GetEnvironmentVariable["LGTM_INDEX_VSTOOLS_VERSION"] = vsToolsVersion;
272-
Actions.GetEnvironmentVariable["LGTM_INDEX_MSBUILD_ARGUMENTS"] = msBuildArguments;
273-
Actions.GetEnvironmentVariable["LGTM_INDEX_MSBUILD_PLATFORM"] = msBuildPlatform;
274-
Actions.GetEnvironmentVariable["LGTM_INDEX_MSBUILD_CONFIGURATION"] = msBuildConfiguration;
275-
Actions.GetEnvironmentVariable["LGTM_INDEX_MSBUILD_TARGET"] = msBuildTarget;
276-
Actions.GetEnvironmentVariable["LGTM_INDEX_DOTNET_ARGUMENTS"] = dotnetArguments;
277-
Actions.GetEnvironmentVariable["LGTM_INDEX_DOTNET_VERSION"] = dotnetVersion;
278-
Actions.GetEnvironmentVariable["LGTM_INDEX_BUILD_COMMAND"] = buildCommand;
279-
Actions.GetEnvironmentVariable["LGTM_INDEX_SOLUTION"] = solution;
280-
Actions.GetEnvironmentVariable["LGTM_INDEX_IGNORE_ERRORS"] = ignoreErrors;
281-
Actions.GetEnvironmentVariable["LGTM_INDEX_BUILDLESS"] = buildless;
282-
Actions.GetEnvironmentVariable["LGTM_INDEX_ALL_SOLUTIONS"] = allSolutions;
283-
Actions.GetEnvironmentVariable["LGTM_INDEX_NUGET_RESTORE"] = nugetRestore;
263+
Actions.GetEnvironmentVariable["CODEQL_EXTRACTOR_CSHARP_OPTION_DOTNET_VERSION"] = dotnetVersion;
284264
Actions.GetEnvironmentVariable["ProgramFiles(x86)"] = isWindows ? @"C:\Program Files (x86)" : null;
285265
Actions.GetCurrentDirectory = cwd;
286266
Actions.IsWindows = isWindows;

Diff for: cpp/autobuilder/Semmle.Autobuild.Cpp/CppAutobuilder.cs

-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ public class CppAutobuilder : Autobuilder<CppAutobuildOptions>
2626

2727
public override BuildScript GetBuildScript()
2828
{
29-
if (Options.BuildCommand != null)
30-
return new BuildCommandRule((_, f) => f(null)).Analyse(this, false);
31-
3229
return
3330
// First try MSBuild
3431
new MsBuildRule().Analyse(this, true) |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Expr extends @expr {
2+
string toString() { none() }
3+
}
4+
5+
from Expr reuse, Expr original
6+
where expr_reuse(reuse, original, _)
7+
select reuse, original
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
class Expr extends @expr {
2+
string toString() { none() }
3+
}
4+
5+
class Type extends @type {
6+
string toString() { none() }
7+
}
8+
9+
predicate existingType(Expr expr, Type type, int value_category) {
10+
expr_types(expr, type, value_category)
11+
}
12+
13+
predicate reuseType(Expr reuse, Type type, int value_category) {
14+
exists(Expr original |
15+
expr_reuse(reuse, original, value_category) and
16+
expr_types(original, type, _)
17+
)
18+
}
19+
20+
from Expr expr, Type type, int value_category
21+
where existingType(expr, type, value_category) or reuseType(expr, type, value_category)
22+
select expr, type, value_category

0 commit comments

Comments
 (0)