From 5de81ef19e13f6a543ad101750e3d0474a78e34d Mon Sep 17 00:00:00 2001 From: Christian Banse Date: Thu, 7 Mar 2024 12:33:01 +0100 Subject: [PATCH] Made it compile, but test fail --- buildSrc/src/main/kotlin/module.gradle.kts | 2 +- .../fraunhofer/aisec/codyze/backends/cpg/CPGBackend.kt | 1 - .../aisec/codyze/backends/cpg/CPGConfiguration.kt | 1 - .../aisec/codyze/backends/cpg/cli/BaseCpgBackend.kt | 1 - .../aisec/codyze/backends/cpg/cli/CokoCpgBackend.kt | 1 - .../backends/cpg/coko/evaluators/OrderEvaluator.kt | 4 ++-- .../aisec/codyze/backends/cpg/CPGConfigurationTest.kt | 3 --- .../aisec/codyze/backends/cpg/CpgOptionGroupTest.kt | 9 +++------ .../de/fraunhofer/aisec/codyze/backends/cpg/TestUtils.kt | 1 - .../coko/dsl/CokoCpgIntegrationTest.kt | 1 - 10 files changed, 6 insertions(+), 18 deletions(-) diff --git a/buildSrc/src/main/kotlin/module.gradle.kts b/buildSrc/src/main/kotlin/module.gradle.kts index f2d3cd753..25c56ca3e 100644 --- a/buildSrc/src/main/kotlin/module.gradle.kts +++ b/buildSrc/src/main/kotlin/module.gradle.kts @@ -38,7 +38,7 @@ repositories { // Eclipse CDT repo --> needed for CPG ivy { - setUrl("https://download.eclipse.org/tools/cdt/releases/11.0/cdt-11.0.0/plugins") + setUrl("https://download.eclipse.org/tools/cdt/releases/11.3/cdt-11.3.1/plugins") metadataSources { artifact() } diff --git a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGBackend.kt b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGBackend.kt index b57f52d64..8f37c367b 100644 --- a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGBackend.kt +++ b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGBackend.kt @@ -67,7 +67,6 @@ open class CPGBackend(config: BackendConfiguration) : Backend { .processAnnotations(processAnnotations) .failOnError(failOnError) .useParallelFrontends(useParallelFrontends) - .typeSystemActiveInFrontend(typeSystemActiveInFrontend) .sourceLocations(source.map { (it.toFile()) }) .symbols(symbols) .useUnityBuild(useUnityBuild) diff --git a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGConfiguration.kt b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGConfiguration.kt index 2621ab588..d7780e252 100644 --- a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGConfiguration.kt +++ b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGConfiguration.kt @@ -34,7 +34,6 @@ private val logger = KotlinLogging.logger {} data class CPGConfiguration( val source: List, val useUnityBuild: Boolean, - val typeSystemActiveInFrontend: Boolean, val debugParser: Boolean, val disableCleanup: Boolean, val codeInNodes: Boolean, diff --git a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/cli/BaseCpgBackend.kt b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/cli/BaseCpgBackend.kt index f9bfc5739..c082e65e0 100644 --- a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/cli/BaseCpgBackend.kt +++ b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/cli/BaseCpgBackend.kt @@ -33,7 +33,6 @@ class BaseCpgBackend : BackendCommand("cpg") { CPGConfiguration( source = source, useUnityBuild = useUnityBuild, - typeSystemActiveInFrontend = typeSystemActiveInFrontend, debugParser = debugParser, disableCleanup = disableCleanup, codeInNodes = codeInNodes, diff --git a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/cli/CokoCpgBackend.kt b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/cli/CokoCpgBackend.kt index f755db75c..b86ea74f6 100644 --- a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/cli/CokoCpgBackend.kt +++ b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/cli/CokoCpgBackend.kt @@ -34,7 +34,6 @@ class CokoCpgBackend : BackendCommand("cokoCpg") { CPGConfiguration( source = source, useUnityBuild = useUnityBuild, - typeSystemActiveInFrontend = typeSystemActiveInFrontend, debugParser = debugParser, disableCleanup = disableCleanup, codeInNodes = codeInNodes, diff --git a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/coko/evaluators/OrderEvaluator.kt b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/coko/evaluators/OrderEvaluator.kt index 1461ed47f..b32848ea6 100644 --- a/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/coko/evaluators/OrderEvaluator.kt +++ b/codyze-backends/cpg/src/main/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/coko/evaluators/OrderEvaluator.kt @@ -30,7 +30,7 @@ import de.fraunhofer.aisec.codyze.specificationLanguages.coko.core.dsl.Order import de.fraunhofer.aisec.codyze.specificationLanguages.coko.core.ordering.* import de.fraunhofer.aisec.cpg.graph.* import de.fraunhofer.aisec.cpg.graph.declarations.VariableDeclaration -import de.fraunhofer.aisec.cpg.graph.statements.expressions.DeclaredReferenceExpression +import de.fraunhofer.aisec.cpg.graph.statements.expressions.Reference import io.github.oshai.kotlinlogging.KotlinLogging import kotlin.reflect.full.createType import kotlin.reflect.full.declaredMemberFunctions @@ -164,7 +164,7 @@ class OrderEvaluator(val baseNodes: Collection, val order: Order) : Evalua nodeToRelevantMethod = nodesToOp, consideredBases = baseNodes.flatMap { node -> node.followNextDFGEdgesUntilHit { next -> - next is VariableDeclaration || next is DeclaredReferenceExpression + next is VariableDeclaration || next is Reference }.fulfilled.mapNotNull { path -> path.lastOrNull() } diff --git a/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGConfigurationTest.kt b/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGConfigurationTest.kt index d3563cde2..65553f2fc 100644 --- a/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGConfigurationTest.kt +++ b/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CPGConfigurationTest.kt @@ -25,7 +25,6 @@ class CPGConfigurationTest { val expectedCpgConfiguration = CPGConfiguration( source = listOf(), useUnityBuild = true, - typeSystemActiveInFrontend = false, debugParser = false, disableCleanup = false, codeInNodes = true, @@ -46,7 +45,6 @@ class CPGConfigurationTest { val cpgConfiguration = CPGConfiguration( source = listOf(), useUnityBuild = true, - typeSystemActiveInFrontend = false, debugParser = false, disableCleanup = false, codeInNodes = true, @@ -74,7 +72,6 @@ class CPGConfigurationTest { val expectedCpgConfiguration = CPGConfiguration( source = listOf(), useUnityBuild = false, - typeSystemActiveInFrontend = false, debugParser = false, disableCleanup = false, codeInNodes = true, diff --git a/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CpgOptionGroupTest.kt b/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CpgOptionGroupTest.kt index 0f3fa74df..7ebfdfbea 100644 --- a/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CpgOptionGroupTest.kt +++ b/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/CpgOptionGroupTest.kt @@ -20,10 +20,7 @@ import com.github.ajalt.clikt.core.MultiUsageError import com.github.ajalt.clikt.core.NoOpCliktCommand import com.github.ajalt.clikt.parameters.groups.provideDelegate import de.fraunhofer.aisec.codyze.core.config.combineSources -import de.fraunhofer.aisec.cpg.passes.CallResolver -import de.fraunhofer.aisec.cpg.passes.EdgeCachePass -import de.fraunhofer.aisec.cpg.passes.FilenameMapper -import de.fraunhofer.aisec.cpg.passes.Pass +import de.fraunhofer.aisec.cpg.passes.* import io.github.oshai.kotlinlogging.KotlinLogging import org.junit.jupiter.api.* import org.junit.jupiter.api.Test @@ -86,7 +83,7 @@ class CpgOptionGroupTest { fun passesTest() { val edgeCachePassName = EdgeCachePass::class.qualifiedName val filenameMapperName = FilenameMapper::class.qualifiedName - val callResolverName = CallResolver::class.qualifiedName + val callResolverName = SymbolResolver::class.qualifiedName assertNotNull(edgeCachePassName) assertNotNull(filenameMapperName) assertNotNull(callResolverName) @@ -106,7 +103,7 @@ class CpgOptionGroupTest { ) val expectedPassesNames = - listOf(EdgeCachePass::class, FilenameMapper::class, CallResolver::class).map { p -> + listOf(EdgeCachePass::class, FilenameMapper::class, SymbolResolver::class).map { p -> p.qualifiedName } val actualPassesNames = cli.cpgOptions.passes.map { p -> p.qualifiedName } diff --git a/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/TestUtils.kt b/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/TestUtils.kt index a3cea8180..32e22d705 100644 --- a/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/TestUtils.kt +++ b/codyze-backends/cpg/src/test/kotlin/de/fraunhofer/aisec/codyze/backends/cpg/TestUtils.kt @@ -25,7 +25,6 @@ fun createCpgConfiguration(vararg sourceFile: Path) = CPGConfiguration( source = listOf(*sourceFile), useUnityBuild = false, - typeSystemActiveInFrontend = true, debugParser = false, disableCleanup = false, codeInNodes = true, diff --git a/codyze-specification-languages/coko/coko-dsl/src/test/kotlin/de/fraunhofer/aisec/codyze/specificationLanguages/coko/dsl/CokoCpgIntegrationTest.kt b/codyze-specification-languages/coko/coko-dsl/src/test/kotlin/de/fraunhofer/aisec/codyze/specificationLanguages/coko/dsl/CokoCpgIntegrationTest.kt index 0f710d243..10a603410 100644 --- a/codyze-specification-languages/coko/coko-dsl/src/test/kotlin/de/fraunhofer/aisec/codyze/specificationLanguages/coko/dsl/CokoCpgIntegrationTest.kt +++ b/codyze-specification-languages/coko/coko-dsl/src/test/kotlin/de/fraunhofer/aisec/codyze/specificationLanguages/coko/dsl/CokoCpgIntegrationTest.kt @@ -45,7 +45,6 @@ class CokoCpgIntegrationTest { CPGConfiguration( source = sourceFiles, useUnityBuild = false, - typeSystemActiveInFrontend = true, debugParser = false, disableCleanup = false, codeInNodes = true,