diff --git a/cpp/ql/test/library-tests/ir/ir/PrintAST.expected b/cpp/ql/test/library-tests/ir/ir/PrintAST.expected index ba76826993d..5de871e4c68 100644 --- a/cpp/ql/test/library-tests/ir/ir/PrintAST.expected +++ b/cpp/ql/test/library-tests/ir/ir/PrintAST.expected @@ -1798,6 +1798,23 @@ ir.c: # 10| Type = [CTypedefType] MyCoords # 10| ValueCategory = lvalue # 11| getStmt(3): [ReturnStmt] return ... +# 13| [TopLevelFunction] void CStyleCast(void*) +# 13| : +# 13| getParameter(0): [Parameter] src +# 13| Type = [VoidPointerType] void * +# 14| getEntryPoint(): [BlockStmt] { ... } +# 15| getStmt(0): [DeclStmt] declaration +# 15| getDeclarationEntry(0): [VariableDeclarationEntry] definition of dst +# 15| Type = [CharPointerType] char * +# 15| getVariable().getInitializer(): [Initializer] initializer for dst +# 15| getExpr(): [VariableAccess] src +# 15| Type = [VoidPointerType] void * +# 15| ValueCategory = prvalue(load) +# 15| getExpr().getFullyConverted(): [CStyleCast] (char *)... +# 15| Conversion = [PointerConversion] pointer conversion +# 15| Type = [CharPointerType] char * +# 15| ValueCategory = prvalue +# 16| getStmt(1): [ReturnStmt] return ... ir.cpp: # 1| [TopLevelFunction] void Constants() # 1| : diff --git a/cpp/ql/test/library-tests/ir/ir/ir.c b/cpp/ql/test/library-tests/ir/ir/ir.c index c162abc2715..c2daea43653 100644 --- a/cpp/ql/test/library-tests/ir/ir/ir.c +++ b/cpp/ql/test/library-tests/ir/ir/ir.c @@ -9,3 +9,10 @@ void MyCoordsTest(int pos) { coords.x = coords.y = pos + 1; coords.x = getX(&coords); } + +void CStyleCast(void *src) +{ + char *dst = (char*)src; +} + +// semmle-extractor-options: --microsoft diff --git a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected index 96698243672..bfe31bbefe7 100644 --- a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected +++ b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected @@ -978,6 +978,20 @@ | ir.c:10:19:10:25 | ChiTotal | total:m9_13 | | ir.c:10:19:10:25 | SideEffect | ~m9_13 | | ir.c:10:20:10:25 | Unary | r10_2 | +| ir.c:13:6:13:15 | ChiPartial | partial:m13_3 | +| ir.c:13:6:13:15 | ChiTotal | total:m13_2 | +| ir.c:13:6:13:15 | SideEffect | m13_3 | +| ir.c:13:23:13:25 | Address | &:r13_5 | +| ir.c:13:23:13:25 | Address | &:r13_5 | +| ir.c:13:23:13:25 | Address | &:r13_7 | +| ir.c:13:23:13:25 | Address | &:r13_7 | +| ir.c:13:23:13:25 | Load | m13_6 | +| ir.c:13:23:13:25 | SideEffect | m13_8 | +| ir.c:15:11:15:13 | Address | &:r15_1 | +| ir.c:15:17:15:26 | StoreValue | r15_4 | +| ir.c:15:24:15:26 | Address | &:r15_2 | +| ir.c:15:24:15:26 | Load | m13_6 | +| ir.c:15:24:15:26 | Unary | r15_3 | | ir.cpp:1:6:1:14 | ChiPartial | partial:m1_3 | | ir.cpp:1:6:1:14 | ChiTotal | total:m1_2 | | ir.cpp:1:6:1:14 | SideEffect | m1_3 | diff --git a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected index 79dd36ed029..019199d980d 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -766,6 +766,26 @@ ir.c: # 7| v7_7(void) = AliasedUse : ~m? # 7| v7_8(void) = ExitFunction : +# 13| void CStyleCast(void*) +# 13| Block 0 +# 13| v13_1(void) = EnterFunction : +# 13| mu13_2(unknown) = AliasedDefinition : +# 13| mu13_3(unknown) = InitializeNonLocal : +# 13| r13_4(glval) = VariableAddress[src] : +# 13| mu13_5(void *) = InitializeParameter[src] : &:r13_4 +# 13| r13_6(void *) = Load[src] : &:r13_4, ~m? +# 13| mu13_7(unknown) = InitializeIndirection[src] : &:r13_6 +# 15| r15_1(glval) = VariableAddress[dst] : +# 15| r15_2(glval) = VariableAddress[src] : +# 15| r15_3(void *) = Load[src] : &:r15_2, ~m? +# 15| r15_4(char *) = Convert : r15_3 +# 15| mu15_5(char *) = Store[dst] : &:r15_1, r15_4 +# 16| v16_1(void) = NoOp : +# 13| v13_8(void) = ReturnIndirection[src] : &:r13_6, ~m? +# 13| v13_9(void) = ReturnVoid : +# 13| v13_10(void) = AliasedUse : ~m? +# 13| v13_11(void) = ExitFunction : + ir.cpp: # 1| void Constants() # 1| Block 0