Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the max complexity config for ControlFlowSensitiveDFGPass in neoj and console #1514

Merged
merged 7 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ class TranslatePlugin : Plugin {
" .optionalLanguage(\"de.fraunhofer.aisec.cpg.frontends.typescript.TypeScriptLanguage\")" +
" .optionalLanguage(\"de.fraunhofer.aisec.cpg.frontends.ruby.RubyLanguage\")" +
" .defaultPasses()\n" +
" .useParallelPasses(false)\n" +
" .configurePass<de.fraunhofer.aisec.cpg.passes.ControlFlowSensitiveDFGPass>(\n" +
" de.fraunhofer.aisec.cpg.passes.ControlFlowSensitiveDFGPass.Configuration(\n" +
" maxComplexity = 200,\n" +
" )\n" +
" )\n" +
" .build()",
"val analyzer = TranslationManager.builder().config(config).build()",
"val result = analyzer.analyze().get()",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ private const val DEFAULT_PORT = 7687
private const val DEFAULT_USER_NAME = "neo4j"
private const val DEFAULT_PASSWORD = "password"
private const val DEFAULT_SAVE_DEPTH = -1
private const val DEFAULT_MAX_COMPLEXITY = -1

data class JsonNode(val id: Long, val labels: Set<String>, val properties: Map<String, Any>)

Expand Down Expand Up @@ -161,6 +162,17 @@ class Application : Callable<Int> {
)
private var depth: Int = DEFAULT_SAVE_DEPTH

@CommandLine.Option(
names = ["--max-complexity-cf-dfg"],
description =
[
"Performance optimisation: " +
"Limit the ControlFlowSensitiveDFGPass to functions with a complexity less than what is specified here. " +
"$DEFAULT_MAX_COMPLEXITY (default) means no limit is used."
]
)
private var maxComplexity: Int = DEFAULT_MAX_COMPLEXITY

@CommandLine.Option(
names = ["--load-includes"],
description = ["Enable TranslationConfiguration option loadIncludes"]
Expand Down Expand Up @@ -485,7 +497,15 @@ class Application : Callable<Int> {
.addIncludesToGraph(loadIncludes)
.debugParser(DEBUG_PARSER)
.useUnityBuild(useUnityBuild)
.useParallelPasses(true)
.useParallelPasses(false)
KuechA marked this conversation as resolved.
Show resolved Hide resolved

if (maxComplexity != -1) {
translationConfiguration.configurePass<ControlFlowSensitiveDFGPass>(
ControlFlowSensitiveDFGPass.Configuration(
maxComplexity = maxComplexity,
)
)
}

if (mutuallyExclusiveParameters.softwareComponents.isNotEmpty()) {
val components = mutableMapOf<String, List<File>>()
Expand Down
Loading