secure-software-engineering / phasar

A LLVM-based static analysis framework.
Other
933 stars 140 forks source link

F lca swift tests #588

Closed janniclas closed 1 year ago

janniclas commented 1 year ago

Besides many unit tests for LCA for Swift-based LLVM IR, a utility function to check llvm types for "integer like" structs (isIntegerLikeType) was added. Further, the LCA's getNormalEdge function was fixed to correctly take the getElementPtr workaround from the getNormalFlow function into account and correctly generate the edge for the desired alloca instruction.

janniclas commented 1 year ago

Global Variables follow this pattern in Swift-based LLVM IR.

@"$s9global_012g1Sivp" = hidden global %TSi <{ i64 10 }>, align 8, !dbg !0

define hidden swiftcc i8* @"$s9global_012g1Sivau"() #0 !dbg !41 {
entry:
  ret i8* bitcast (%TSi* @"$s9global_012g1Sivp" to i8*), !dbg !45
}

Currently, we don't support this behavior, however all other test cases translated from C++ work as expected with the changes included in this PR. I'll extend the LCA with support for globals at a later point