mirror of
https://github.com/github/codeql.git
synced 2026-05-25 00:27:09 +02:00
KE2: Use the right file numbers
The thread that did the extraction could see the file number counter after it had been incremented (possibly multiple times) by the main thread. This fixes some consistency query failures in tests.
This commit is contained in:
@@ -238,6 +238,7 @@ fun doAnalysis(
|
||||
var fileNumber = 0
|
||||
val dump_psi = System.getenv("CODEQL_EXTRACTOR_JAVA_KOTLIN_DUMP") == "true"
|
||||
for (psiFile in psiFiles) {
|
||||
val thisFileNumber = fileNumber++
|
||||
launch {
|
||||
extractorThreads.withPermit {
|
||||
if (psiFile is KtFile) {
|
||||
@@ -251,11 +252,11 @@ fun doAnalysis(
|
||||
val fileDiagnosticTrapWriter = dtw.makeSourceFileTrapWriter(psiFile, true)
|
||||
fileDiagnosticTrapWriter.writeCompilation_compiling_files(
|
||||
compilation,
|
||||
fileNumber,
|
||||
thisFileNumber,
|
||||
fileDiagnosticTrapWriter.fileId
|
||||
)
|
||||
doFile(
|
||||
fileNumber,
|
||||
thisFileNumber,
|
||||
compression,
|
||||
/*
|
||||
OLD: KE1
|
||||
@@ -277,7 +278,7 @@ fun doAnalysis(
|
||||
)
|
||||
fileDiagnosticTrapWriter.writeCompilation_compiling_files_completed(
|
||||
compilation,
|
||||
fileNumber,
|
||||
thisFileNumber,
|
||||
fileExtractionProblems.extractionResult()
|
||||
)
|
||||
// We catch Throwable rather than Exception, as we want to
|
||||
@@ -295,7 +296,6 @@ fun doAnalysis(
|
||||
}
|
||||
}
|
||||
}
|
||||
fileNumber += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user