Skip to content

Commit

Permalink
resolve sonarcloud bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
csanadtelbisz authored Sep 10, 2023
1 parent be9444c commit c43d0a1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ open class XcfaDporLts(private val xcfa: XCFA) : LTS<S, A> {

val action = node.inEdge.get().action
if (relevantProcesses.contains(action.pid)) {
if (newLastDependents.containsKey(action.pid) && index <= newLastDependents[action.pid]!!) {
if (newLastDependents.containsKey(action.pid) && index <= checkNotNull(
newLastDependents[action.pid])) {
// there is an action a' such that action -> a' -> newaction (->: happens-before)
relevantProcesses.remove(action.pid)
} else if (dependent(newaction, action)) {
Expand All @@ -277,7 +278,7 @@ open class XcfaDporLts(private val xcfa: XCFA) : LTS<S, A> {

newLastDependents[action.pid] = index
newLastDependents =
max(newLastDependents, stack[index].lastDependents[action.pid]!!)
max(newLastDependents, checkNotNull(stack[index].lastDependents[action.pid]))
relevantProcesses.remove(action.pid)
}
}
Expand Down Expand Up @@ -442,9 +443,10 @@ open class XcfaDporLts(private val xcfa: XCFA) : LTS<S, A> {
*/
private fun noInfluenceOnRealExploration(realStackSize: Int) =
last.processLastAction.keys.all { process ->
last.lastDependents.containsKey(process) && last.lastDependents[process]!!.all { (_, index) ->
index >= realStackSize
}
last.lastDependents.containsKey(process) &&
checkNotNull(last.lastDependents[process]).all { (_, index) ->
index >= realStackSize
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ class LoopUnrollPass : ProcedurePass {
}

loopEdges.forEach {
val newSource = if (it.source == loopStart) startLocation else locs[it.source]!!
val newSource = if (it.source == loopStart) startLocation else checkNotNull(locs[it.source])
val newLabel = if (it.source == loopStart) it.label.removeCondition() else it.label
val edge = XcfaEdge(newSource, locs[it.target]!!, newLabel, it.metadata)
val edge = XcfaEdge(newSource, checkNotNull(locs[it.target]!!), newLabel, it.metadata)
builder.addEdge(edge)
}

return locs[loopStart]!!
return checkNotNull(locs[loopStart])
}

fun unroll(builder: XcfaProcedureBuilder, transFunc: ExplStmtTransFunc) {
Expand Down

0 comments on commit c43d0a1

Please sign in to comment.