From 18304c13cb53e2e8bdca4ca0fd705d4e7aa3a361 Mon Sep 17 00:00:00 2001 From: Calum Grant Date: Fri, 28 Jun 2024 16:08:36 +0100 Subject: [PATCH] C++: Update expected results --- .../allocators/allocators.expected | 20 ++++----- .../library-tests/ir/ir/PrintAST.expected | 8 ++++ .../library-tests/ir/ir/aliased_ir.expected | 42 +++++++++++-------- .../test/library-tests/ir/ir/raw_ir.expected | 30 +++++++------ .../library-tests/types/scope/expr.expected | 2 + .../valuenumbering/HashCons/HashCons.expected | 7 ++-- 6 files changed, 66 insertions(+), 43 deletions(-) diff --git a/cpp/ql/test/library-tests/allocators/allocators.expected b/cpp/ql/test/library-tests/allocators/allocators.expected index 8ed64b76dfe..25bb31af19f 100644 --- a/cpp/ql/test/library-tests/allocators/allocators.expected +++ b/cpp/ql/test/library-tests/allocators/allocators.expected @@ -15,13 +15,13 @@ newArrayExprs | allocators.cpp:69:3:69:18 | new[] | int[] | int | void* operator new[](size_t, float) | 4 | 4 | | n | | | allocators.cpp:70:3:70:15 | new[] | String[] | String | void* operator new[](unsigned long) | 8 | 8 | | n | | | allocators.cpp:71:3:71:20 | new[] | Overaligned[] | Overaligned | void* operator new[](unsigned long, std::align_val_t) | 256 | 128 | aligned | n | | -| allocators.cpp:72:3:72:16 | new[] | String[10] | String | void* operator new[](unsigned long) | 8 | 8 | | | | +| allocators.cpp:72:3:72:16 | new[] | String[10] | String | void* operator new[](unsigned long) | 8 | 8 | | 10 | | | allocators.cpp:108:3:108:19 | new[] | FailedInit[] | FailedInit | void* FailedInit::operator new[](size_t) | 1 | 1 | | n | | -| allocators.cpp:110:3:110:37 | new[] | FailedInitOveraligned[10] | FailedInitOveraligned | void* FailedInitOveraligned::operator new[](size_t, std::align_val_t, float) | 128 | 128 | aligned | | | -| allocators.cpp:132:3:132:17 | new[] | int[1] | int | void* operator new[](std::size_t, void*) | 4 | 4 | | | buf | -| allocators.cpp:136:3:136:26 | new[] | int[2] | int | void* operator new[](std::size_t, std::nothrow_t const&) | 4 | 4 | | | | +| allocators.cpp:110:3:110:37 | new[] | FailedInitOveraligned[10] | FailedInitOveraligned | void* FailedInitOveraligned::operator new[](size_t, std::align_val_t, float) | 128 | 128 | aligned | 10 | | +| allocators.cpp:132:3:132:17 | new[] | int[1] | int | void* operator new[](std::size_t, void*) | 4 | 4 | | 1 | buf | +| allocators.cpp:136:3:136:26 | new[] | int[2] | int | void* operator new[](std::size_t, std::nothrow_t const&) | 4 | 4 | | 2 | | | allocators.cpp:142:13:142:27 | new[] | char[][10] | char[10] | void* operator new[](unsigned long) | 10 | 1 | | x | | -| allocators.cpp:143:13:143:28 | new[] | char[20][20] | char[20] | void* operator new[](unsigned long) | 20 | 1 | | | | +| allocators.cpp:143:13:143:28 | new[] | char[20][20] | char[20] | void* operator new[](unsigned long) | 20 | 1 | | 20 | | | allocators.cpp:144:13:144:31 | new[] | char[][30][30] | char[30][30] | void* operator new[](unsigned long) | 900 | 1 | | x | | newExprDeallocators | allocators.cpp:52:3:52:14 | new | String | void operator delete(void*, unsigned long) | 8 | 8 | sized | @@ -72,17 +72,17 @@ allocationExprs | allocators.cpp:69:3:69:18 | new[] | getAllocatedElementType = int, getSizeExpr = n, getSizeMult = 4, requiresDealloc | | allocators.cpp:70:3:70:15 | new[] | getAllocatedElementType = String, getSizeExpr = n, getSizeMult = 8, requiresDealloc | | allocators.cpp:71:3:71:20 | new[] | getAllocatedElementType = Overaligned, getSizeExpr = n, getSizeMult = 256, requiresDealloc | -| allocators.cpp:72:3:72:16 | new[] | getAllocatedElementType = String, getSizeBytes = 80, requiresDealloc | +| allocators.cpp:72:3:72:16 | new[] | getAllocatedElementType = String, getSizeBytes = 80, getSizeExpr = 10, getSizeMult = 8, requiresDealloc | | allocators.cpp:107:3:107:18 | new | getAllocatedElementType = FailedInit, getSizeBytes = 1, requiresDealloc | | allocators.cpp:108:3:108:19 | new[] | getAllocatedElementType = FailedInit, getSizeExpr = n, getSizeMult = 1, requiresDealloc | | allocators.cpp:109:3:109:35 | new | getAllocatedElementType = FailedInitOveraligned, getSizeBytes = 128, requiresDealloc | -| allocators.cpp:110:3:110:37 | new[] | getAllocatedElementType = FailedInitOveraligned, getSizeBytes = 1280, requiresDealloc | +| allocators.cpp:110:3:110:37 | new[] | getAllocatedElementType = FailedInitOveraligned, getSizeBytes = 1280, getSizeExpr = 10, getSizeMult = 128, requiresDealloc | | allocators.cpp:129:3:129:21 | new | getAllocatedElementType = int, getSizeBytes = 4 | -| allocators.cpp:132:3:132:17 | new[] | getAllocatedElementType = int, getSizeBytes = 4 | +| allocators.cpp:132:3:132:17 | new[] | getAllocatedElementType = int, getSizeBytes = 4, getSizeExpr = 1, getSizeMult = 4 | | allocators.cpp:135:3:135:26 | new | getAllocatedElementType = int, getSizeBytes = 4, requiresDealloc | -| allocators.cpp:136:3:136:26 | new[] | getAllocatedElementType = int, getSizeBytes = 8, requiresDealloc | +| allocators.cpp:136:3:136:26 | new[] | getAllocatedElementType = int, getSizeBytes = 8, getSizeExpr = 2, getSizeMult = 4, requiresDealloc | | allocators.cpp:142:13:142:27 | new[] | getAllocatedElementType = char[10], getSizeExpr = x, getSizeMult = 10, requiresDealloc | -| allocators.cpp:143:13:143:28 | new[] | getAllocatedElementType = char[20], getSizeBytes = 400, requiresDealloc | +| allocators.cpp:143:13:143:28 | new[] | getAllocatedElementType = char[20], getSizeBytes = 400, getSizeExpr = 20, getSizeMult = 20, requiresDealloc | | allocators.cpp:144:13:144:31 | new[] | getAllocatedElementType = char[30][30], getSizeExpr = x, getSizeMult = 900, requiresDealloc | | allocators.cpp:149:8:149:19 | call to operator new | getSizeBytes = 4, getSizeExpr = sizeof(int), getSizeMult = 1, requiresDealloc | | allocators.cpp:157:50:157:55 | call to malloc | getAllocatedElementType = const volatile int, getSizeBytes = 5, getSizeExpr = 5, getSizeMult = 1, requiresDealloc | diff --git a/cpp/ql/test/library-tests/ir/ir/PrintAST.expected b/cpp/ql/test/library-tests/ir/ir/PrintAST.expected index 94f8d8bff3c..42dc92eed5b 100644 --- a/cpp/ql/test/library-tests/ir/ir/PrintAST.expected +++ b/cpp/ql/test/library-tests/ir/ir/PrintAST.expected @@ -10681,6 +10681,10 @@ ir.cpp: # 960| getExpr(): [NewArrayExpr] new[] # 960| Type = [IntPointerType] int * # 960| ValueCategory = prvalue +# 960| getExtent(): [Literal] 10 +# 960| Type = [IntType] int +# 960| Value = [Literal] 10 +# 960| ValueCategory = prvalue # 961| getStmt(1): [ExprStmt] ExprStmt # 961| getExpr(): [NewArrayExpr] new[] # 961| Type = [IntPointerType] int * @@ -10747,6 +10751,10 @@ ir.cpp: # 965| Type = [FloatType] float # 965| Value = [Literal] 1.0 # 965| ValueCategory = prvalue +# 965| getExtent(): [Literal] 10 +# 965| Type = [IntType] int +# 965| Value = [Literal] 10 +# 965| ValueCategory = prvalue # 966| getStmt(6): [ExprStmt] ExprStmt # 966| getExpr(): [NewArrayExpr] new[] # 966| Type = [PointerType] DefaultCtorWithDefaultParam * diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected index d3238068707..7482412464c 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected @@ -8033,12 +8033,15 @@ ir.cpp: # 959| r959_5(glval) = VariableAddress[n] : # 959| m959_6(int) = InitializeParameter[n] : &:r959_5 # 960| r960_1(glval) = FunctionAddress[operator new[]] : -# 960| r960_2(unsigned long) = Constant[40] : -# 960| r960_3(void *) = Call[operator new[]] : func:r960_1, 0:r960_2 -# 960| m960_4(unknown) = ^CallSideEffect : ~m959_4 -# 960| m960_5(unknown) = Chi : total:m959_4, partial:m960_4 -# 960| m960_6(unknown) = ^InitializeDynamicAllocation : &:r960_3 -# 960| r960_7(int *) = Convert : r960_3 +# 960| r960_2(int) = Constant[10] : +# 960| r960_3(unsigned long) = Convert : r960_2 +# 960| r960_4(unsigned long) = Constant[4] : +# 960| r960_5(unsigned long) = Mul : r960_3, r960_4 +# 960| r960_6(void *) = Call[operator new[]] : func:r960_1, 0:r960_5 +# 960| m960_7(unknown) = ^CallSideEffect : ~m959_4 +# 960| m960_8(unknown) = Chi : total:m959_4, partial:m960_7 +# 960| m960_9(unknown) = ^InitializeDynamicAllocation : &:r960_6 +# 960| r960_10(int *) = Convert : r960_6 # 961| r961_1(glval) = FunctionAddress[operator new[]] : # 961| r961_2(glval) = VariableAddress[n] : # 961| r961_3(int) = Load[n] : &:r961_2, m959_6 @@ -8046,8 +8049,8 @@ ir.cpp: # 961| r961_5(unsigned long) = Constant[4] : # 961| r961_6(unsigned long) = Mul : r961_4, r961_5 # 961| r961_7(void *) = Call[operator new[]] : func:r961_1, 0:r961_6 -# 961| m961_8(unknown) = ^CallSideEffect : ~m960_5 -# 961| m961_9(unknown) = Chi : total:m960_5, partial:m961_8 +# 961| m961_8(unknown) = ^CallSideEffect : ~m960_8 +# 961| m961_9(unknown) = Chi : total:m960_8, partial:m961_8 # 961| m961_10(unknown) = ^InitializeDynamicAllocation : &:r961_7 # 961| r961_11(int *) = Convert : r961_7 # 962| r962_1(glval) = FunctionAddress[operator new[]] : @@ -8086,14 +8089,17 @@ ir.cpp: # 964| m964_11(unknown) = ^InitializeDynamicAllocation : &:r964_8 # 964| r964_12(Overaligned *) = Convert : r964_8 # 965| r965_1(glval) = FunctionAddress[operator new[]] : -# 965| r965_2(unsigned long) = Constant[2560] : -# 965| r965_3(align_val_t) = Constant[128] : -# 965| r965_4(float) = Constant[1.0] : -# 965| r965_5(void *) = Call[operator new[]] : func:r965_1, 0:r965_2, 1:r965_3, 2:r965_4 -# 965| m965_6(unknown) = ^CallSideEffect : ~m964_10 -# 965| m965_7(unknown) = Chi : total:m964_10, partial:m965_6 -# 965| m965_8(unknown) = ^InitializeDynamicAllocation : &:r965_5 -# 965| r965_9(Overaligned *) = Convert : r965_5 +# 965| r965_2(int) = Constant[10] : +# 965| r965_3(unsigned long) = Convert : r965_2 +# 965| r965_4(unsigned long) = Constant[256] : +# 965| r965_5(unsigned long) = Mul : r965_3, r965_4 +# 965| r965_6(align_val_t) = Constant[128] : +# 965| r965_7(float) = Constant[1.0] : +# 965| r965_8(void *) = Call[operator new[]] : func:r965_1, 0:r965_5, 1:r965_6, 2:r965_7 +# 965| m965_9(unknown) = ^CallSideEffect : ~m964_10 +# 965| m965_10(unknown) = Chi : total:m964_10, partial:m965_9 +# 965| m965_11(unknown) = ^InitializeDynamicAllocation : &:r965_8 +# 965| r965_12(Overaligned *) = Convert : r965_8 # 966| r966_1(glval) = FunctionAddress[operator new[]] : # 966| r966_2(glval) = VariableAddress[n] : # 966| r966_3(int) = Load[n] : &:r966_2, m959_6 @@ -8101,8 +8107,8 @@ ir.cpp: # 966| r966_5(unsigned long) = Constant[1] : # 966| r966_6(unsigned long) = Mul : r966_4, r966_5 # 966| r966_7(void *) = Call[operator new[]] : func:r966_1, 0:r966_6 -# 966| m966_8(unknown) = ^CallSideEffect : ~m965_7 -# 966| m966_9(unknown) = Chi : total:m965_7, partial:m966_8 +# 966| m966_8(unknown) = ^CallSideEffect : ~m965_10 +# 966| m966_9(unknown) = Chi : total:m965_10, partial:m966_8 # 966| m966_10(unknown) = ^InitializeDynamicAllocation : &:r966_7 # 966| r966_11(DefaultCtorWithDefaultParam *) = Convert : r966_7 # 967| r967_1(glval) = FunctionAddress[operator new[]] : 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 76bea510ea0..7563cbef92d 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -7475,11 +7475,14 @@ ir.cpp: # 959| r959_4(glval) = VariableAddress[n] : # 959| mu959_5(int) = InitializeParameter[n] : &:r959_4 # 960| r960_1(glval) = FunctionAddress[operator new[]] : -# 960| r960_2(unsigned long) = Constant[40] : -# 960| r960_3(void *) = Call[operator new[]] : func:r960_1, 0:r960_2 -# 960| mu960_4(unknown) = ^CallSideEffect : ~m? -# 960| mu960_5(unknown) = ^InitializeDynamicAllocation : &:r960_3 -# 960| r960_6(int *) = Convert : r960_3 +# 960| r960_2(int) = Constant[10] : +# 960| r960_3(unsigned long) = Convert : r960_2 +# 960| r960_4(unsigned long) = Constant[4] : +# 960| r960_5(unsigned long) = Mul : r960_3, r960_4 +# 960| r960_6(void *) = Call[operator new[]] : func:r960_1, 0:r960_5 +# 960| mu960_7(unknown) = ^CallSideEffect : ~m? +# 960| mu960_8(unknown) = ^InitializeDynamicAllocation : &:r960_6 +# 960| r960_9(int *) = Convert : r960_6 # 961| r961_1(glval) = FunctionAddress[operator new[]] : # 961| r961_2(glval) = VariableAddress[n] : # 961| r961_3(int) = Load[n] : &:r961_2, ~m? @@ -7523,13 +7526,16 @@ ir.cpp: # 964| mu964_10(unknown) = ^InitializeDynamicAllocation : &:r964_8 # 964| r964_11(Overaligned *) = Convert : r964_8 # 965| r965_1(glval) = FunctionAddress[operator new[]] : -# 965| r965_2(unsigned long) = Constant[2560] : -# 965| r965_3(align_val_t) = Constant[128] : -# 965| r965_4(float) = Constant[1.0] : -# 965| r965_5(void *) = Call[operator new[]] : func:r965_1, 0:r965_2, 1:r965_3, 2:r965_4 -# 965| mu965_6(unknown) = ^CallSideEffect : ~m? -# 965| mu965_7(unknown) = ^InitializeDynamicAllocation : &:r965_5 -# 965| r965_8(Overaligned *) = Convert : r965_5 +# 965| r965_2(int) = Constant[10] : +# 965| r965_3(unsigned long) = Convert : r965_2 +# 965| r965_4(unsigned long) = Constant[256] : +# 965| r965_5(unsigned long) = Mul : r965_3, r965_4 +# 965| r965_6(align_val_t) = Constant[128] : +# 965| r965_7(float) = Constant[1.0] : +# 965| r965_8(void *) = Call[operator new[]] : func:r965_1, 0:r965_5, 1:r965_6, 2:r965_7 +# 965| mu965_9(unknown) = ^CallSideEffect : ~m? +# 965| mu965_10(unknown) = ^InitializeDynamicAllocation : &:r965_8 +# 965| r965_11(Overaligned *) = Convert : r965_8 # 966| r966_1(glval) = FunctionAddress[operator new[]] : # 966| r966_2(glval) = VariableAddress[n] : # 966| r966_3(int) = Load[n] : &:r966_2, ~m? diff --git a/cpp/ql/test/library-tests/types/scope/expr.expected b/cpp/ql/test/library-tests/types/scope/expr.expected index e277ae00b00..d27ef32ecbc 100644 --- a/cpp/ql/test/library-tests/types/scope/expr.expected +++ b/cpp/ql/test/library-tests/types/scope/expr.expected @@ -28,7 +28,9 @@ | scope.cpp:24:13:24:28 | (int)... | scope.cpp:6:6:6:7 | g1 | | scope.cpp:24:13:24:28 | sizeof(int[800]) | scope.cpp:6:6:6:7 | g1 | | scope.cpp:24:24:24:26 | 800 | scope.cpp:6:6:6:7 | g1 | +| scope.cpp:25:14:25:25 | 900 | scope.cpp:6:6:6:7 | g1 | | scope.cpp:25:14:25:25 | new[] | scope.cpp:6:6:6:7 | g1 | | scope.cpp:25:22:25:24 | 900 | scope.cpp:6:6:6:7 | g1 | +| scope.cpp:26:14:26:26 | 1000 | scope.cpp:6:6:6:7 | g1 | | scope.cpp:26:14:26:26 | new[] | scope.cpp:6:6:6:7 | g1 | | scope.cpp:26:22:26:25 | 1000 | scope.cpp:6:6:6:7 | g1 | diff --git a/cpp/ql/test/library-tests/valuenumbering/HashCons/HashCons.expected b/cpp/ql/test/library-tests/valuenumbering/HashCons/HashCons.expected index fa7208639c6..11ab23429ef 100644 --- a/cpp/ql/test/library-tests/valuenumbering/HashCons/HashCons.expected +++ b/cpp/ql/test/library-tests/valuenumbering/HashCons/HashCons.expected @@ -33,7 +33,6 @@ | test.cpp:80:5:80:5 | v | 79:c7-c7 80:c5-c5 | | test.cpp:80:9:80:17 | call to getAValue | 77:c20-c28 80:c9-c17 | | test.cpp:80:9:80:19 | (signed short)... | 77:c20-c30 80:c9-c19 | -| test.cpp:92:15:92:16 | 10 | 260:c21-c22 261:c21-c22 92:c15-c16 | | test.cpp:93:10:93:10 | x | 92:c11-c11 93:c10-c10 | | test.cpp:97:3:97:3 | x | 97:c3-c3 98:c3-c3 | | test.cpp:97:3:97:5 | ... ++ | 97:c3-c5 98:c3-c5 | @@ -82,6 +81,7 @@ | test.cpp:210:10:210:11 | (...) | 210:c10-c11 211:c11-c12 211:c24-c25 | | test.cpp:211:3:211:12 | alignof() | 211:c16-c25 211:c3-c12 | | test.cpp:239:3:239:12 | new | 239:c3-c12 240:c3-c12 | +| test.cpp:245:16:245:36 | 4 | 245:c16-c36 246:c16-c36 265:c31-c31 | | test.cpp:245:16:245:36 | new[] | 245:c16-c36 246:c16-c36 | | test.cpp:248:3:248:28 | delete | 248:c3-c28 249:c3-c28 | | test.cpp:248:10:248:28 | call to operator new | 248:c10-c28 249:c10-c28 | @@ -97,21 +97,22 @@ | test.cpp:255:11:255:14 | ptr1 | 248:c14-c17 249:c14-c17 252:c18-c21 253:c20-c23 255:c11-c14 | | test.cpp:257:3:257:19 | call to operator new | 257:c3-c19 258:c3-c19 | | test.cpp:257:3:257:19 | new | 257:c3-c19 258:c3-c19 | +| test.cpp:260:3:260:23 | 10 | 260:c21-c22 260:c3-c23 261:c21-c22 261:c3-c23 92:c15-c16 | | test.cpp:260:3:260:23 | call to operator new[] | 260:c3-c23 261:c3-c23 | | test.cpp:260:3:260:23 | new[] | 260:c3-c23 261:c3-c23 | | test.cpp:263:3:263:32 | delete[] | 263:c3-c32 264:c3-c32 | | test.cpp:263:12:263:32 | new[] | 263:c12-c32 264:c12-c32 | | test.cpp:263:12:263:32 | {...} | 263:c12-c32 264:c12-c32 | +| test.cpp:266:3:266:23 | 2 | 105:c7-c7 106:c7-c7 107:c11-c11 108:c11-c11 21:c16-c16 241:c11-c11 263:c12-c32 263:c24-c24 263:c31-c31 264:c12-c32 264:c24-c24 264:c31-c31 265:c12-c32 265:c24-c24 266:c15-c15 266:c3-c23 267:c15-c15 267:c19-c19 267:c22-c22 267:c3-c23 269:c15-c15 269:c3-c19 270:c15-c15 270:c3-c19 286:c5-c5 290:c5-c5 293:c5-c5 301:c9-c9 302:c9-c9 | | test.cpp:266:3:266:23 | | 263:c12-c32 264:c12-c32 265:c12-c32 266:c3-c23 267:c3-c23 269:c3-c19 270:c3-c19 271:c3-c19 | | test.cpp:266:3:266:23 | call to operator new[] | 263:c12-c32 264:c12-c32 265:c12-c32 266:c3-c23 267:c3-c23 269:c3-c19 270:c3-c19 271:c3-c19 | | test.cpp:269:3:269:19 | new[] | 269:c3-c19 270:c3-c19 | | test.cpp:269:3:269:19 | {...} | 269:c3-c19 270:c3-c19 | -| test.cpp:271:15:271:15 | 3 | 265:c28-c28 271:c15-c15 35:c16-c16 | +| test.cpp:271:3:271:19 | 3 | 265:c28-c28 271:c15-c15 271:c3-c19 35:c16-c16 | | test.cpp:273:3:273:12 | new[] | 273:c3-c12 274:c3-c12 | | test.cpp:273:11:273:11 | x | 273:c11-c11 274:c11-c11 | | test.cpp:284:15:287:3 | {...} | 284:c15-c3 288:c15-c3 | | test.cpp:285:5:285:5 | 1 | 103:c10-c11 104:c7-c7 107:c7-c7 108:c7-c7 10:c16-c16 179:c21-c21 239:c11-c11 240:c11-c11 263:c28-c28 264:c28-c28 266:c19-c19 266:c22-c22 285:c5-c5 289:c5-c5 294:c5-c5 299:c9-c9 300:c9-c9 310:c5-c5 311:c5-c5 313:c5-c5 | -| test.cpp:286:5:286:5 | 2 | 105:c7-c7 106:c7-c7 107:c11-c11 108:c11-c11 21:c16-c16 241:c11-c11 263:c24-c24 263:c31-c31 264:c24-c24 264:c31-c31 265:c24-c24 266:c15-c15 267:c15-c15 267:c19-c19 267:c22-c22 269:c15-c15 270:c15-c15 286:c5-c5 290:c5-c5 293:c5-c5 301:c9-c9 302:c9-c9 | | test.cpp:299:3:299:9 | throw ... | 299:c3-c9 300:c3-c9 | | test.cpp:301:3:301:9 | throw ... | 301:c3-c9 302:c3-c9 | | test.cpp:303:3:303:7 | re-throw exception | 303:c3-c7 304:c3-c7 |