Skip to content

Commit 8b7ec20

Browse files
committed
Merge branch 'main' into rb/summarize-more
2 parents 93e8434 + ecfbd5e commit 8b7ec20

File tree

106 files changed

+8028
-1361
lines changed

Some content is hidden

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

106 files changed

+8028
-1361
lines changed

config/identical-files.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@
3333
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImpl4.qll",
3434
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImpl.qll",
3535
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImpl2.qll",
36-
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForLibraries.qll",
36+
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForRegExp.qll",
3737
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForHttpClientLibraries.qll",
38+
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForPathname.qll",
3839
"swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImpl.qll"
3940
],
4041
"DataFlow Java/C++/C#/Python Common": [
@@ -69,7 +70,7 @@
6970
"python/ql/lib/semmle/python/dataflow/new/internal/tainttracking3/TaintTrackingImpl.qll",
7071
"python/ql/lib/semmle/python/dataflow/new/internal/tainttracking4/TaintTrackingImpl.qll",
7172
"ruby/ql/lib/codeql/ruby/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
72-
"ruby/ql/lib/codeql/ruby/dataflow/internal/tainttrackingforlibraries/TaintTrackingImpl.qll",
73+
"ruby/ql/lib/codeql/ruby/dataflow/internal/tainttrackingforregexp/TaintTrackingImpl.qll",
7374
"swift/ql/lib/codeql/swift/dataflow/internal/tainttracking1/TaintTrackingImpl.qll"
7475
],
7576
"DataFlow Java/C++/C#/Python Consistency checks": [

csharp/ql/integration-tests/all-platforms/dotnet_run/test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,7 @@ def check_build_out(msg, s):
4141
# to `dotnet run -p:UseSharedCompilation=true -p:UseSharedCompilation=false -- hello world`
4242
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test6-db', 'dotnet run -p:UseSharedCompilation=true -- hello world'], "test7-db")
4343
check_build_out("hello, world", s)
44+
45+
# option passed into `dotnet run`
46+
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test7-db', 'dotnet build', 'dotnet run --no-build hello world'], "test8-db")
47+
check_build_out("hello, world", s)

csharp/tools/tracing-config.lua

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ function RegisterExtractorPack(id)
2121
-- if that's `build`, we append `-p:UseSharedCompilation=false` to the command line,
2222
-- otherwise we do nothing.
2323
local match = false
24-
local needsSeparator = false;
25-
local injectionIndex = nil;
24+
local dotnetRunNeedsSeparator = false;
25+
local dotnetRunInjectionIndex = nil;
2626
local argv = compilerArguments.argv
2727
if OperatingSystem == 'windows' then
2828
-- let's hope that this split matches the escaping rules `dotnet` applies to command line arguments
@@ -34,7 +34,9 @@ function RegisterExtractorPack(id)
3434
-- dotnet options start with either - or / (both are legal)
3535
local firstCharacter = string.sub(arg, 1, 1)
3636
if not (firstCharacter == '-') and not (firstCharacter == '/') then
37-
Log(1, 'Dotnet subcommand detected: %s', arg)
37+
if (not match) then
38+
Log(1, 'Dotnet subcommand detected: %s', arg)
39+
end
3840
if arg == 'build' or arg == 'msbuild' or arg == 'publish' or arg == 'pack' or arg == 'test' then
3941
match = true
4042
break
@@ -43,22 +45,29 @@ function RegisterExtractorPack(id)
4345
-- for `dotnet run`, we need to make sure that `-p:UseSharedCompilation=false` is
4446
-- not passed in as an argument to the program that is run
4547
match = true
46-
needsSeparator = true
47-
injectionIndex = i + 1
48+
dotnetRunNeedsSeparator = true
49+
dotnetRunInjectionIndex = i + 1
4850
end
4951
end
52+
-- if we see a separator to `dotnet run`, inject just prior to the existing separator
5053
if arg == '--' then
51-
needsSeparator = false
52-
injectionIndex = i
54+
dotnetRunNeedsSeparator = false
55+
dotnetRunInjectionIndex = i
5356
break
5457
end
58+
-- if we see an option to `dotnet run` (e.g., `--project`), inject just prior
59+
-- to the last option
60+
if firstCharacter == '-' then
61+
dotnetRunNeedsSeparator = false
62+
dotnetRunInjectionIndex = i
63+
end
5564
end
5665
if match then
5766
local injections = { '-p:UseSharedCompilation=false' }
58-
if needsSeparator then
67+
if dotnetRunNeedsSeparator then
5968
table.insert(injections, '--')
6069
end
61-
if injectionIndex == nil then
70+
if dotnetRunInjectionIndex == nil then
6271
-- Simple case; just append at the end
6372
return {
6473
order = ORDER_REPLACE,
@@ -69,7 +78,7 @@ function RegisterExtractorPack(id)
6978

7079
-- Complex case; splice injections into the middle of the command line
7180
for i, injectionArg in ipairs(injections) do
72-
table.insert(argv, injectionIndex + i - 1, injectionArg)
81+
table.insert(argv, dotnetRunInjectionIndex + i - 1, injectionArg)
7382
end
7483

7584
if OperatingSystem == 'windows' then

java/kotlin-extractor/src/main/kotlin/ExternalDeclExtractor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class ExternalDeclExtractor(val logger: FileLogger, val invocationTrapFile: Stri
8484
// file information if needed:
8585
val ftw = tw.makeFileTrapWriter(binaryPath, irDecl is IrClass)
8686

87-
val fileExtractor = KotlinFileExtractor(logger, ftw, binaryPath, manager, this, primitiveTypeMapping, pluginContext, globalExtensionState)
87+
val fileExtractor = KotlinFileExtractor(logger, ftw, binaryPath, manager, this, primitiveTypeMapping, pluginContext, KotlinFileExtractor.DeclarationStack(), globalExtensionState)
8888

8989
if (irDecl is IrClass) {
9090
// Populate a location and compilation-unit package for the file. This is similar to

java/kotlin-extractor/src/main/kotlin/KotlinExtractorExtension.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ private fun doFile(
322322
// file information
323323
val sftw = tw.makeSourceFileTrapWriter(srcFile, true)
324324
val externalDeclExtractor = ExternalDeclExtractor(logger, invocationTrapFile, srcFilePath, primitiveTypeMapping, pluginContext, globalExtensionState, fileTrapWriter)
325-
val fileExtractor = KotlinFileExtractor(logger, sftw, srcFilePath, null, externalDeclExtractor, primitiveTypeMapping, pluginContext, globalExtensionState)
325+
val fileExtractor = KotlinFileExtractor(logger, sftw, srcFilePath, null, externalDeclExtractor, primitiveTypeMapping, pluginContext, KotlinFileExtractor.DeclarationStack(), globalExtensionState)
326326

327327
fileExtractor.extractFileContents(srcFile, sftw.fileId)
328328
externalDeclExtractor.extractExternalClasses()

0 commit comments

Comments
 (0)