Skip to content

Commit

Permalink
Merge branch 'main' into ak/throw-cxx
Browse files Browse the repository at this point in the history
  • Loading branch information
KuechA authored Nov 6, 2024
2 parents f429e0e + c516e81 commit 4b3690c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class ExpressionHandler(lang: LLVMIRLanguageFrontend) :
}
LLVMMetadataAsValueValueKind,
LLVMInlineAsmValueKind -> {
// TODO
return newProblemExpression(
"Metadata or ASM value kind not supported yet",
ProblemNode.ProblemType.TRANSLATION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class LLVMIRLanguage : Language<LLVMIRLanguageFrontend>() {
override val frontend: KClass<out LLVMIRLanguageFrontend> = LLVMIRLanguageFrontend::class
override val compoundAssignmentOperators = setOf<String>()

// TODO: In theory, the integers can have any bitwidth from 1 to 1^32 bits. It's not known if
// TODO: In theory, the integers can have any bit-width from 1 to 1^32 bits. It's not known if
// they are interpreted as signed or unsigned.
@Transient
override val builtInTypes =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ package de.fraunhofer.aisec.cpg.frontends.llvm
import de.fraunhofer.aisec.cpg.frontends.Handler
import de.fraunhofer.aisec.cpg.frontends.TranslationException
import de.fraunhofer.aisec.cpg.graph.*
import de.fraunhofer.aisec.cpg.graph.declarations.FunctionDeclaration
import de.fraunhofer.aisec.cpg.graph.declarations.TranslationUnitDeclaration
import de.fraunhofer.aisec.cpg.graph.declarations.VariableDeclaration
import de.fraunhofer.aisec.cpg.graph.statements.*
Expand Down Expand Up @@ -1396,19 +1395,15 @@ class StatementHandler(lang: LLVMIRLanguageFrontend) :
// We have multiple pairs, so we insert a declaration at the beginning of the function and
// make an assignment in each BB.
val functionName = LLVMGetValueName(bbsFunction).string
val functions =
tu.declarations.filter { d ->
(d as? FunctionDeclaration)?.name != null &&
(d as? FunctionDeclaration)?.name.toString() == functionName
}
val functions = tu.functions(functionName)
if (functions.size != 1) {
log.error(
"${functions.size} functions match the name of the one where the phi instruction is inserted. Can't handle this case."
)
throw TranslationException("Wrong number of functions for phi statement.")
}
// Create the dummy declaration at the beginning of the function body
val firstBB = (functions[0] as FunctionDeclaration).body as Block
val firstBB = functions[0].body as Block
val varName = instr.name
val type = frontend.typeOf(instr)
val declaration = newVariableDeclaration(varName, type, false, rawNode = instr)
Expand Down

0 comments on commit 4b3690c

Please sign in to comment.