| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // Copyright (c) 2021-2025 ChilliBits. All rights reserved. | ||
| 2 | |||
| 3 | #include "OpRuleManager.h" | ||
| 4 | |||
| 5 | #include <SourceFile.h> | ||
| 6 | #include <ast/ASTNodes.h> | ||
| 7 | #include <global/GlobalResourceManager.h> | ||
| 8 | #include <global/RuntimeModuleManager.h> | ||
| 9 | #include <typechecker/MacroDefs.h> | ||
| 10 | #include <typechecker/TypeChecker.h> | ||
| 11 | |||
| 12 | namespace spice::compiler { | ||
| 13 | |||
| 14 | 3335 | OpRuleManager::OpRuleManager(TypeChecker *typeChecker) | |
| 15 | 3335 | : typeChecker(typeChecker), resourceManager(typeChecker->resourceManager) {} | |
| 16 | |||
| 17 | 24387 | std::pair<QualType, Function *> OpRuleManager::getAssignResultType(const ASTNode *node, const ExprResult &lhs, | |
| 18 | const ExprResult &rhs, bool isDecl, bool isReturn, | ||
| 19 | const char *errMsgPrefix) const { | ||
| 20 | // Retrieve types | ||
| 21 | 24387 | const QualType lhsType = lhs.type; | |
| 22 | 24387 | const QualType rhsType = rhs.type; | |
| 23 | |||
| 24 | // Check if lhs is a temporary | ||
| 25 |
2/2✓ Branch 3 → 4 taken 1 time.
✓ Branch 3 → 12 taken 24386 times.
|
24387 | if (lhs.isTemporary()) |
| 26 |
2/4✓ Branch 7 → 8 taken 1 time.
✗ Branch 7 → 111 not taken.
✓ Branch 8 → 9 taken 1 time.
✗ Branch 8 → 108 not taken.
|
3 | throw SemanticError(node, OPERATOR_WRONG_DATA_TYPE, "Cannot assign to a temporary value"); |
| 27 | |||
| 28 | // Skip type compatibility check if the lhs is of type dyn -> perform type inference | ||
| 29 |
3/4✓ Branch 12 → 13 taken 24386 times.
✗ Branch 12 → 125 not taken.
✓ Branch 13 → 14 taken 69 times.
✓ Branch 13 → 16 taken 24317 times.
|
24386 | if (lhsType.is(TY_DYN)) |
| 30 | 69 | return {rhsType, nullptr}; | |
| 31 | |||
| 32 | // Check if we try to assign a constant value | ||
| 33 |
1/2✓ Branch 16 → 17 taken 24317 times.
✗ Branch 16 → 125 not taken.
|
24317 | ensureNoConstAssign(node, lhsType, isDecl, isReturn); |
| 34 | |||
| 35 | // Allow pointers and references of the same type straight away | ||
| 36 |
8/10✓ Branch 17 → 18 taken 24317 times.
✗ Branch 17 → 117 not taken.
✓ Branch 18 → 19 taken 3347 times.
✓ Branch 18 → 22 taken 20970 times.
✓ Branch 19 → 20 taken 3347 times.
✗ Branch 19 → 117 not taken.
✓ Branch 20 → 21 taken 2751 times.
✓ Branch 20 → 22 taken 596 times.
✓ Branch 23 → 24 taken 2751 times.
✓ Branch 23 → 41 taken 21566 times.
|
24317 | if (lhsType.isOneOf({TY_PTR, TY_REF}) && lhsType.matches(rhsType, false, false, true)) { |
| 37 | // If we perform a heap x* = heap x* assignment, we need set the right hand side to MOVED | ||
| 38 |
15/22✓ Branch 24 → 25 taken 919 times.
✓ Branch 24 → 35 taken 1832 times.
✓ Branch 25 → 26 taken 919 times.
✗ Branch 25 → 118 not taken.
✓ Branch 26 → 27 taken 625 times.
✓ Branch 26 → 35 taken 294 times.
✓ Branch 27 → 28 taken 625 times.
✗ Branch 27 → 118 not taken.
✓ Branch 28 → 29 taken 513 times.
✓ Branch 28 → 35 taken 112 times.
✓ Branch 29 → 30 taken 513 times.
✗ Branch 29 → 118 not taken.
✓ Branch 30 → 31 taken 513 times.
✗ Branch 30 → 118 not taken.
✓ Branch 31 → 32 taken 513 times.
✗ Branch 31 → 35 not taken.
✓ Branch 32 → 33 taken 513 times.
✗ Branch 32 → 118 not taken.
✓ Branch 33 → 34 taken 513 times.
✗ Branch 33 → 35 not taken.
✓ Branch 36 → 37 taken 513 times.
✓ Branch 36 → 39 taken 2238 times.
|
2751 | if (rhs.entry && lhsType.isPtr() && lhsType.isHeap() && rhsType.removeReferenceWrapper().isPtr() && rhsType.isHeap()) |
| 39 |
1/2✓ Branch 37 → 38 taken 513 times.
✗ Branch 37 → 119 not taken.
|
513 | rhs.entry->updateState(MOVED, node); |
| 40 | 2751 | return {rhsType, nullptr}; | |
| 41 | } | ||
| 42 | // Allow ref type to type of the same contained type straight away | ||
| 43 |
3/4✓ Branch 41 → 42 taken 21566 times.
✗ Branch 41 → 125 not taken.
✓ Branch 42 → 43 taken 340 times.
✓ Branch 42 → 63 taken 21226 times.
|
21566 | if (rhsType.isRef()) { |
| 44 | // If this is const ref, remove both: the reference and the constness | ||
| 45 |
2/4✓ Branch 43 → 44 taken 340 times.
✗ Branch 43 → 120 not taken.
✓ Branch 44 → 45 taken 340 times.
✗ Branch 44 → 120 not taken.
|
340 | const QualType rhsModified = rhsType.getContained().toNonConst(); |
| 46 |
3/4✓ Branch 45 → 46 taken 340 times.
✗ Branch 45 → 122 not taken.
✓ Branch 46 → 47 taken 338 times.
✓ Branch 46 → 62 taken 2 times.
|
340 | if (lhsType.matches(rhsModified, false, false, true)) { |
| 47 | // Check if we support nrvo. If yes, skip the implicit copy ctor call | ||
| 48 |
4/4✓ Branch 47 → 48 taken 5 times.
✓ Branch 47 → 51 taken 333 times.
✓ Branch 49 → 50 taken 2 times.
✓ Branch 49 → 51 taken 3 times.
|
338 | const bool supportsNRVO = isReturn && !rhs.isTemporary(); |
| 49 | 338 | Function *copyCtor = nullptr; | |
| 50 |
7/8✓ Branch 52 → 53 taken 338 times.
✗ Branch 52 → 121 not taken.
✓ Branch 53 → 54 taken 224 times.
✓ Branch 53 → 56 taken 114 times.
✓ Branch 54 → 55 taken 222 times.
✓ Branch 54 → 56 taken 2 times.
✓ Branch 57 → 58 taken 222 times.
✓ Branch 57 → 60 taken 116 times.
|
338 | if (rhsModified.is(TY_STRUCT) && !supportsNRVO) |
| 51 |
1/2✓ Branch 58 → 59 taken 222 times.
✗ Branch 58 → 121 not taken.
|
222 | copyCtor = typeChecker->implicitlyCallStructCopyCtor(rhsModified, node); |
| 52 | 338 | return {lhsType, copyCtor}; | |
| 53 | } | ||
| 54 | } | ||
| 55 | // Allow arrays, structs, interfaces, functions, procedures of the same type straight away | ||
| 56 |
8/10✓ Branch 63 → 64 taken 21228 times.
✗ Branch 63 → 123 not taken.
✓ Branch 64 → 65 taken 78 times.
✓ Branch 64 → 68 taken 21150 times.
✓ Branch 65 → 66 taken 78 times.
✗ Branch 65 → 123 not taken.
✓ Branch 66 → 67 taken 73 times.
✓ Branch 66 → 68 taken 5 times.
✓ Branch 69 → 70 taken 73 times.
✓ Branch 69 → 72 taken 21155 times.
|
21228 | if (lhsType.isOneOf({TY_ARRAY, TY_INTERFACE, TY_FUNCTION, TY_PROCEDURE}) && lhsType.matches(rhsType, false, true, true)) |
| 57 | 73 | return {rhsType, nullptr}; | |
| 58 | // Allow struct of the same type straight away | ||
| 59 |
8/10✓ Branch 72 → 73 taken 21155 times.
✗ Branch 72 → 125 not taken.
✓ Branch 73 → 74 taken 2536 times.
✓ Branch 73 → 77 taken 18619 times.
✓ Branch 74 → 75 taken 2536 times.
✗ Branch 74 → 125 not taken.
✓ Branch 75 → 76 taken 2535 times.
✓ Branch 75 → 77 taken 1 time.
✓ Branch 78 → 79 taken 2535 times.
✓ Branch 78 → 96 taken 18620 times.
|
21155 | if (lhsType.is(TY_STRUCT) && lhsType.matches(rhsType, false, true, true)) { |
| 60 | // Check if we support nrvo. If yes, skip the implicit copy ctor call | ||
| 61 |
4/4✓ Branch 79 → 80 taken 1394 times.
✓ Branch 79 → 83 taken 1141 times.
✓ Branch 81 → 82 taken 105 times.
✓ Branch 81 → 83 taken 1289 times.
|
2535 | const bool supportsNRVO = isReturn && !rhs.isTemporary(); |
| 62 | 2535 | Function *copyCtor = nullptr; | |
| 63 |
10/10✓ Branch 84 → 85 taken 1883 times.
✓ Branch 84 → 90 taken 652 times.
✓ Branch 85 → 86 taken 1778 times.
✓ Branch 85 → 90 taken 105 times.
✓ Branch 86 → 87 taken 983 times.
✓ Branch 86 → 90 taken 795 times.
✓ Branch 88 → 89 taken 11 times.
✓ Branch 88 → 90 taken 972 times.
✓ Branch 91 → 92 taken 11 times.
✓ Branch 91 → 94 taken 2524 times.
|
2535 | if (rhs.entry != nullptr && !supportsNRVO && !isReturn && !rhs.isTemporary()) |
| 64 |
1/2✓ Branch 92 → 93 taken 11 times.
✗ Branch 92 → 124 not taken.
|
11 | copyCtor = typeChecker->implicitlyCallStructCopyCtor(rhsType, rhs.entry->declNode); |
| 65 | 2535 | return {rhsType, copyCtor}; | |
| 66 | } | ||
| 67 | |||
| 68 | // Check common type combinations | ||
| 69 |
2/2✓ Branch 96 → 97 taken 18618 times.
✓ Branch 96 → 125 taken 2 times.
|
18620 | const QualType resultType = getAssignResultTypeCommon(node, lhs, rhs, isDecl, isReturn); |
| 70 |
3/4✓ Branch 97 → 98 taken 18618 times.
✗ Branch 97 → 125 not taken.
✓ Branch 98 → 99 taken 548 times.
✓ Branch 98 → 101 taken 18070 times.
|
18618 | if (!resultType.is(TY_INVALID)) |
| 71 | 548 | return {resultType, nullptr}; | |
| 72 | |||
| 73 | // Check primitive type combinations | ||
| 74 | const QualType binOpType = | ||
| 75 |
2/2✓ Branch 103 → 104 taken 18058 times.
✓ Branch 103 → 125 taken 12 times.
|
18070 | validateBinaryOperation(node, ASSIGN_OP_RULES, std::size(ASSIGN_OP_RULES), "=", lhsType, rhsType, true, errMsgPrefix); |
| 76 | 18058 | return {binOpType, nullptr}; | |
| 77 | } | ||
| 78 | |||
| 79 | 407 | QualType OpRuleManager::getFieldAssignResultType(const ASTNode *node, const ExprResult &lhs, const ExprResult &rhs, bool imm, | |
| 80 | bool isDecl) const { | ||
| 81 | // Retrieve types | ||
| 82 | 407 | const QualType lhsType = lhs.type; | |
| 83 | 407 | const QualType rhsType = rhs.type; | |
| 84 |
2/4✓ Branch 2 → 3 taken 407 times.
✗ Branch 2 → 92 not taken.
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 5 taken 407 times.
|
407 | assert(!lhsType.is(TY_DYN)); |
| 85 | |||
| 86 | // Check if we try to assign a constant value | ||
| 87 |
1/2✓ Branch 5 → 6 taken 407 times.
✗ Branch 5 → 92 not taken.
|
407 | ensureNoConstAssign(node, lhsType, isDecl); |
| 88 | |||
| 89 | // Allow pointers, arrays and structs of the same type straight away | ||
| 90 |
8/10✓ Branch 6 → 7 taken 407 times.
✗ Branch 6 → 85 not taken.
✓ Branch 7 → 8 taken 239 times.
✓ Branch 7 → 11 taken 168 times.
✓ Branch 8 → 9 taken 239 times.
✗ Branch 8 → 85 not taken.
✓ Branch 9 → 10 taken 237 times.
✓ Branch 9 → 11 taken 2 times.
✓ Branch 12 → 13 taken 237 times.
✓ Branch 12 → 29 taken 170 times.
|
407 | if (lhsType.isOneOf({TY_PTR, TY_ARRAY}) && lhsType == rhsType) { |
| 91 | // If we perform a heap x* = heap x* assignment, we need set the right hand side to MOVED | ||
| 92 |
8/22✓ Branch 13 → 14 taken 66 times.
✓ Branch 13 → 24 taken 171 times.
✓ Branch 14 → 15 taken 66 times.
✗ Branch 14 → 86 not taken.
✓ Branch 15 → 16 taken 64 times.
✓ Branch 15 → 24 taken 2 times.
✓ Branch 16 → 17 taken 64 times.
✗ Branch 16 → 86 not taken.
✗ Branch 17 → 18 not taken.
✓ Branch 17 → 24 taken 64 times.
✗ Branch 18 → 19 not taken.
✗ Branch 18 → 86 not taken.
✗ Branch 19 → 20 not taken.
✗ Branch 19 → 86 not taken.
✗ Branch 20 → 21 not taken.
✗ Branch 20 → 24 not taken.
✗ Branch 21 → 22 not taken.
✗ Branch 21 → 86 not taken.
✗ Branch 22 → 23 not taken.
✗ Branch 22 → 24 not taken.
✗ Branch 25 → 26 not taken.
✓ Branch 25 → 28 taken 237 times.
|
237 | if (rhs.entry && lhsType.isPtr() && lhsType.isHeap() && rhsType.removeReferenceWrapper().isPtr() && rhsType.isHeap()) |
| 93 | ✗ | rhs.entry->updateState(MOVED, node); | |
| 94 | 237 | return rhsType; | |
| 95 | } | ||
| 96 | // Allow struct of the same type straight away | ||
| 97 |
8/10✓ Branch 29 → 30 taken 170 times.
✗ Branch 29 → 92 not taken.
✓ Branch 30 → 31 taken 11 times.
✓ Branch 30 → 34 taken 159 times.
✓ Branch 31 → 32 taken 11 times.
✗ Branch 31 → 92 not taken.
✓ Branch 32 → 33 taken 9 times.
✓ Branch 32 → 34 taken 2 times.
✓ Branch 35 → 36 taken 9 times.
✓ Branch 35 → 40 taken 161 times.
|
170 | if (lhsType.is(TY_STRUCT) && lhsType.matches(rhsType, false, true, true)) { |
| 98 |
2/2✓ Branch 37 → 38 taken 5 times.
✓ Branch 37 → 39 taken 4 times.
|
9 | if (!rhs.isTemporary()) |
| 99 |
1/2✓ Branch 38 → 39 taken 5 times.
✗ Branch 38 → 92 not taken.
|
5 | typeChecker->implicitlyCallStructCopyCtor(rhs.entry, rhs.entry->declNode); |
| 100 | 9 | return rhsType; | |
| 101 | } | ||
| 102 | // Allow ref type to type of the same contained type straight away | ||
| 103 |
9/12✓ Branch 40 → 41 taken 161 times.
✗ Branch 40 → 88 not taken.
✓ Branch 41 → 42 taken 24 times.
✓ Branch 41 → 46 taken 137 times.
✓ Branch 42 → 43 taken 24 times.
✗ Branch 42 → 88 not taken.
✓ Branch 43 → 44 taken 24 times.
✗ Branch 43 → 88 not taken.
✓ Branch 44 → 45 taken 1 time.
✓ Branch 44 → 46 taken 23 times.
✓ Branch 47 → 48 taken 1 time.
✓ Branch 47 → 58 taken 160 times.
|
161 | if (rhsType.isRef() && lhsType.matches(rhsType.getContained(), false, false, true)) { |
| 104 | // In case of a return expression, we perform temp stealing | ||
| 105 |
4/10✓ Branch 48 → 49 taken 1 time.
✗ Branch 48 → 89 not taken.
✓ Branch 49 → 50 taken 1 time.
✗ Branch 49 → 89 not taken.
✗ Branch 50 → 51 not taken.
✓ Branch 50 → 54 taken 1 time.
✗ Branch 52 → 53 not taken.
✗ Branch 52 → 54 not taken.
✗ Branch 55 → 56 not taken.
✓ Branch 55 → 57 taken 1 time.
|
1 | if (rhsType.getContained().is(TY_STRUCT) && !rhs.isTemporary()) |
| 106 | ✗ | typeChecker->implicitlyCallStructCopyCtor(rhs.entry, rhs.entry->declNode); | |
| 107 | 1 | return lhsType; | |
| 108 | } | ||
| 109 | // Allow const ref type to type of the same contained type straight away | ||
| 110 |
9/14✓ Branch 58 → 59 taken 160 times.
✗ Branch 58 → 90 not taken.
✓ Branch 59 → 60 taken 23 times.
✓ Branch 59 → 65 taken 137 times.
✓ Branch 60 → 61 taken 23 times.
✗ Branch 60 → 90 not taken.
✓ Branch 61 → 62 taken 23 times.
✗ Branch 61 → 90 not taken.
✓ Branch 62 → 63 taken 23 times.
✗ Branch 62 → 90 not taken.
✓ Branch 63 → 64 taken 23 times.
✗ Branch 63 → 65 not taken.
✓ Branch 66 → 67 taken 23 times.
✓ Branch 66 → 68 taken 137 times.
|
160 | if (rhsType.isConstRef() && lhsType.matches(rhsType.getContained().toNonConst(), false, false, true)) |
| 111 | 23 | return lhsType; | |
| 112 | // Allow immediate value to const ref of the same contained type straight away | ||
| 113 |
6/8✓ Branch 68 → 69 taken 137 times.
✗ Branch 68 → 92 not taken.
✓ Branch 69 → 70 taken 1 time.
✓ Branch 69 → 72 taken 136 times.
✓ Branch 70 → 71 taken 1 time.
✗ Branch 70 → 72 not taken.
✓ Branch 73 → 74 taken 1 time.
✓ Branch 73 → 75 taken 136 times.
|
137 | if (lhsType.isConstRef() && imm) |
| 114 | 1 | return rhsType; | |
| 115 | |||
| 116 | // Check common type combinations | ||
| 117 |
1/2✓ Branch 75 → 76 taken 136 times.
✗ Branch 75 → 92 not taken.
|
136 | const QualType resultType = getAssignResultTypeCommon(node, lhs, rhs, isDecl, false); |
| 118 |
3/4✓ Branch 76 → 77 taken 136 times.
✗ Branch 76 → 92 not taken.
✓ Branch 77 → 78 taken 4 times.
✓ Branch 77 → 79 taken 132 times.
|
136 | if (!resultType.is(TY_INVALID)) |
| 119 | 4 | return resultType; | |
| 120 | |||
| 121 | // Check primitive type combinations | ||
| 122 |
2/2✓ Branch 81 → 82 taken 131 times.
✓ Branch 81 → 92 taken 1 time.
|
132 | return validateBinaryOperation(node, ASSIGN_OP_RULES, std::size(ASSIGN_OP_RULES), "=", lhsType, rhsType, true, |
| 123 | 131 | ERROR_FIELD_ASSIGN); | |
| 124 | } | ||
| 125 | |||
| 126 | 18756 | QualType OpRuleManager::getAssignResultTypeCommon(const ASTNode *node, const ExprResult &lhs, const ExprResult &rhs, bool isDecl, | |
| 127 | bool isReturn) { | ||
| 128 | // Retrieve types | ||
| 129 | 18756 | const QualType lhsType = lhs.type; | |
| 130 | 18756 | const QualType rhsType = rhs.type; | |
| 131 | |||
| 132 | // Allow type to ref type of the same contained type straight away | ||
| 133 |
9/12✓ Branch 2 → 3 taken 18756 times.
✗ Branch 2 → 113 not taken.
✓ Branch 3 → 4 taken 394 times.
✓ Branch 3 → 8 taken 18362 times.
✓ Branch 4 → 5 taken 394 times.
✗ Branch 4 → 113 not taken.
✓ Branch 5 → 6 taken 394 times.
✗ Branch 5 → 113 not taken.
✓ Branch 6 → 7 taken 391 times.
✓ Branch 6 → 8 taken 3 times.
✓ Branch 9 → 10 taken 391 times.
✓ Branch 9 → 44 taken 18365 times.
|
18756 | if (lhsType.isRef() && lhsType.getContained().matches(rhsType, false, false, true)) { |
| 134 |
4/4✓ Branch 10 → 11 taken 333 times.
✓ Branch 10 → 12 taken 58 times.
✓ Branch 11 → 12 taken 275 times.
✓ Branch 11 → 13 taken 58 times.
|
391 | const bool isDeclOrReturn = isDecl || isReturn; |
| 135 |
7/8✓ Branch 14 → 15 taken 333 times.
✓ Branch 14 → 19 taken 58 times.
✓ Branch 16 → 17 taken 333 times.
✗ Branch 16 → 137 not taken.
✓ Branch 17 → 18 taken 1 time.
✓ Branch 17 → 19 taken 332 times.
✓ Branch 20 → 21 taken 1 time.
✓ Branch 20 → 29 taken 390 times.
|
391 | if (isDeclOrReturn && !lhsType.canBind(rhsType, rhs.isTemporary())) |
| 136 |
2/4✓ Branch 24 → 25 taken 1 time.
✗ Branch 24 → 117 not taken.
✓ Branch 25 → 26 taken 1 time.
✗ Branch 25 → 114 not taken.
|
3 | throw SemanticError(node, TEMP_TO_NON_CONST_REF, "Temporary values can only be bound to const reference variables/fields"); |
| 137 |
6/6✓ Branch 29 → 30 taken 275 times.
✓ Branch 29 → 33 taken 115 times.
✓ Branch 31 → 32 taken 1 time.
✓ Branch 31 → 33 taken 274 times.
✓ Branch 34 → 35 taken 1 time.
✓ Branch 34 → 43 taken 389 times.
|
390 | if (isReturn && rhs.isTemporary()) |
| 138 |
2/4✓ Branch 38 → 39 taken 1 time.
✗ Branch 38 → 126 not taken.
✓ Branch 39 → 40 taken 1 time.
✗ Branch 39 → 123 not taken.
|
3 | throw SemanticError(node, RETURN_OF_TEMPORARY_VALUE, "Cannot return reference to temporary value"); |
| 139 | 389 | return lhsType; | |
| 140 | } | ||
| 141 | // Allow char* = string | ||
| 142 |
9/14✓ Branch 44 → 45 taken 18365 times.
✗ Branch 44 → 137 not taken.
✓ Branch 45 → 46 taken 1 time.
✓ Branch 45 → 53 taken 18364 times.
✓ Branch 46 → 47 taken 1 time.
✗ Branch 46 → 137 not taken.
✓ Branch 47 → 48 taken 1 time.
✗ Branch 47 → 53 not taken.
✓ Branch 50 → 51 taken 1 time.
✗ Branch 50 → 137 not taken.
✓ Branch 51 → 52 taken 1 time.
✗ Branch 51 → 53 not taken.
✓ Branch 54 → 55 taken 1 time.
✓ Branch 54 → 56 taken 18364 times.
|
18365 | if (lhsType.isPtrTo(TY_CHAR) && rhsType.is(TY_STRING) && lhsType.getQualifiers() == rhsType.getQualifiers()) |
| 143 | 1 | return lhsType; | |
| 144 | // Allow array to pointer | ||
| 145 |
12/18✓ Branch 56 → 57 taken 18364 times.
✗ Branch 56 → 132 not taken.
✓ Branch 57 → 58 taken 162 times.
✓ Branch 57 → 65 taken 18202 times.
✓ Branch 58 → 59 taken 162 times.
✗ Branch 58 → 132 not taken.
✓ Branch 59 → 60 taken 5 times.
✓ Branch 59 → 65 taken 157 times.
✓ Branch 60 → 61 taken 5 times.
✗ Branch 60 → 132 not taken.
✓ Branch 61 → 62 taken 5 times.
✗ Branch 61 → 132 not taken.
✓ Branch 62 → 63 taken 5 times.
✗ Branch 62 → 132 not taken.
✓ Branch 63 → 64 taken 5 times.
✗ Branch 63 → 65 not taken.
✓ Branch 66 → 67 taken 5 times.
✓ Branch 66 → 68 taken 18359 times.
|
18364 | if (lhsType.isPtr() && rhsType.isArray() && lhsType.getContained().matches(rhsType.getContained(), false, false, true)) |
| 146 | 5 | return lhsType; | |
| 147 | // Allow interface* = struct* or interface& = struct that implements this interface | ||
| 148 |
1/2✓ Branch 70 → 71 taken 18359 times.
✗ Branch 70 → 137 not taken.
|
18359 | const bool sameChainDepth = Type::hasSameTypeChainDepth(lhsType.getType(), rhsType.getType()); |
| 149 |
10/14✓ Branch 71 → 72 taken 18359 times.
✗ Branch 71 → 137 not taken.
✓ Branch 72 → 73 taken 157 times.
✓ Branch 72 → 76 taken 18202 times.
✓ Branch 73 → 74 taken 157 times.
✗ Branch 73 → 137 not taken.
✓ Branch 74 → 75 taken 156 times.
✓ Branch 74 → 76 taken 1 time.
✗ Branch 75 → 76 not taken.
✓ Branch 75 → 78 taken 156 times.
✓ Branch 76 → 77 taken 18203 times.
✗ Branch 76 → 137 not taken.
✓ Branch 77 → 78 taken 3 times.
✓ Branch 77 → 79 taken 18200 times.
|
18359 | const bool typesCompatible = (lhsType.isPtr() && rhsType.isPtr() && sameChainDepth) || lhsType.isRef(); |
| 150 |
9/12✓ Branch 80 → 81 taken 159 times.
✓ Branch 80 → 86 taken 18200 times.
✓ Branch 81 → 82 taken 159 times.
✗ Branch 81 → 137 not taken.
✓ Branch 82 → 83 taken 5 times.
✓ Branch 82 → 86 taken 154 times.
✓ Branch 83 → 84 taken 5 times.
✗ Branch 83 → 137 not taken.
✓ Branch 84 → 85 taken 5 times.
✗ Branch 84 → 86 not taken.
✓ Branch 87 → 88 taken 5 times.
✓ Branch 87 → 93 taken 18354 times.
|
18359 | if (typesCompatible && lhsType.isBase(TY_INTERFACE) && rhsType.isBase(TY_STRUCT)) { |
| 151 | 5 | QualType lhsTypeCopy = lhsType; | |
| 152 | 5 | QualType rhsTypeCopy = rhsType; | |
| 153 |
1/2✓ Branch 88 → 89 taken 5 times.
✗ Branch 88 → 134 not taken.
|
5 | QualType::unwrapBoth(lhsTypeCopy, rhsTypeCopy); |
| 154 |
2/4✓ Branch 89 → 90 taken 5 times.
✗ Branch 89 → 134 not taken.
✓ Branch 90 → 91 taken 5 times.
✗ Branch 90 → 92 not taken.
|
5 | if (lhsTypeCopy.matchesInterfaceImplementedByStruct(rhsTypeCopy)) |
| 155 | 5 | return lhsType; | |
| 156 | } | ||
| 157 | // Allow type* = heap type* straight away. This is used for initializing non-owning pointers to heap allocations | ||
| 158 |
10/14✓ Branch 93 → 94 taken 18354 times.
✗ Branch 93 → 137 not taken.
✓ Branch 94 → 95 taken 153 times.
✓ Branch 94 → 100 taken 18201 times.
✓ Branch 95 → 96 taken 153 times.
✗ Branch 95 → 137 not taken.
✓ Branch 96 → 97 taken 152 times.
✓ Branch 96 → 100 taken 1 time.
✓ Branch 97 → 98 taken 152 times.
✗ Branch 97 → 137 not taken.
✓ Branch 98 → 99 taken 152 times.
✗ Branch 98 → 100 not taken.
✓ Branch 101 → 102 taken 152 times.
✓ Branch 101 → 108 taken 18202 times.
|
18354 | if (lhsType.isPtr() && rhsType.isHeap() && lhsType.matches(rhsType, false, true, true)) { |
| 159 | 152 | TypeQualifiers rhsQualifiers = rhsType.getQualifiers(); | |
| 160 | 152 | rhsQualifiers.isHeap = false; | |
| 161 |
2/4✓ Branch 104 → 105 taken 152 times.
✗ Branch 104 → 135 not taken.
✓ Branch 105 → 106 taken 152 times.
✗ Branch 105 → 107 not taken.
|
152 | if (lhsType.getQualifiers() == rhsQualifiers) |
| 162 | 152 | return lhsType; | |
| 163 | } | ||
| 164 | |||
| 165 | // Nothing matched | ||
| 166 |
1/2✓ Branch 108 → 109 taken 18202 times.
✗ Branch 108 → 136 not taken.
|
18202 | return QualType(TY_INVALID); |
| 167 | } | ||
| 168 | |||
| 169 | 252 | ExprResult OpRuleManager::getPlusEqualResultType(ASTNode *node, const ExprResult &lhs, const ExprResult &rhs, size_t opIdx) { | |
| 170 | // Check is there is an overloaded operator function available | ||
| 171 |
1/2✓ Branch 2 → 3 taken 252 times.
✗ Branch 2 → 24 not taken.
|
252 | const ExprResult resultType = isOperatorOverloadingFctAvailable<2>(node, OP_FCT_PLUS_EQUAL, {lhs, rhs}, opIdx); |
| 172 |
3/4✓ Branch 3 → 4 taken 252 times.
✗ Branch 3 → 26 not taken.
✓ Branch 4 → 5 taken 97 times.
✓ Branch 4 → 6 taken 155 times.
|
252 | if (!resultType.type.is(TY_INVALID)) |
| 173 | 97 | return resultType; | |
| 174 | |||
| 175 | // Check if we try to assign a constant value | ||
| 176 |
1/2✓ Branch 6 → 7 taken 155 times.
✗ Branch 6 → 26 not taken.
|
155 | ensureNoConstAssign(node, lhs.type); |
| 177 | |||
| 178 | // Remove reference wrappers | ||
| 179 |
1/2✓ Branch 7 → 8 taken 155 times.
✗ Branch 7 → 26 not taken.
|
155 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 180 |
1/2✓ Branch 8 → 9 taken 155 times.
✗ Branch 8 → 26 not taken.
|
155 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 181 | |||
| 182 | // Check if this is an unsafe operation | ||
| 183 |
7/10✓ Branch 9 → 10 taken 155 times.
✗ Branch 9 → 25 not taken.
✓ Branch 10 → 11 taken 1 time.
✓ Branch 10 → 14 taken 154 times.
✓ Branch 11 → 12 taken 1 time.
✗ Branch 11 → 25 not taken.
✓ Branch 12 → 13 taken 1 time.
✗ Branch 12 → 14 not taken.
✓ Branch 15 → 16 taken 1 time.
✓ Branch 15 → 18 taken 154 times.
|
155 | if (lhsType.isPtr() && rhsType.isOneOf({TY_INT, TY_LONG, TY_SHORT})) { |
| 184 |
1/2✓ Branch 16 → 17 taken 1 time.
✗ Branch 16 → 26 not taken.
|
1 | ensureUnsafeAllowed(node, "+=", lhsType, rhsType); |
| 185 | 1 | return {lhs}; | |
| 186 | } | ||
| 187 | |||
| 188 |
1/2✓ Branch 20 → 21 taken 154 times.
✗ Branch 20 → 26 not taken.
|
154 | return {validateBinaryOperation(node, PLUS_EQUAL_OP_RULES, std::size(PLUS_EQUAL_OP_RULES), "+=", lhsType, rhsType)}; |
| 189 | } | ||
| 190 | |||
| 191 | 33 | ExprResult OpRuleManager::getMinusEqualResultType(ASTNode *node, const ExprResult &lhs, const ExprResult &rhs, size_t opIdx) { | |
| 192 | // Check is there is an overloaded operator function available | ||
| 193 |
1/2✓ Branch 2 → 3 taken 33 times.
✗ Branch 2 → 24 not taken.
|
33 | const ExprResult resultType = isOperatorOverloadingFctAvailable<2>(node, OP_FCT_MINUS_EQUAL, {lhs, rhs}, opIdx); |
| 194 |
3/4✓ Branch 3 → 4 taken 33 times.
✗ Branch 3 → 26 not taken.
✓ Branch 4 → 5 taken 7 times.
✓ Branch 4 → 6 taken 26 times.
|
33 | if (!resultType.type.is(TY_INVALID)) |
| 195 | 7 | return resultType; | |
| 196 | |||
| 197 | // Check if we try to assign a constant value | ||
| 198 |
1/2✓ Branch 6 → 7 taken 26 times.
✗ Branch 6 → 26 not taken.
|
26 | ensureNoConstAssign(node, lhs.type); |
| 199 | |||
| 200 | // Remove reference wrappers | ||
| 201 |
1/2✓ Branch 7 → 8 taken 26 times.
✗ Branch 7 → 26 not taken.
|
26 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 202 |
1/2✓ Branch 8 → 9 taken 26 times.
✗ Branch 8 → 26 not taken.
|
26 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 203 | |||
| 204 | // Check if this is an unsafe operation | ||
| 205 |
7/10✓ Branch 9 → 10 taken 26 times.
✗ Branch 9 → 25 not taken.
✓ Branch 10 → 11 taken 1 time.
✓ Branch 10 → 14 taken 25 times.
✓ Branch 11 → 12 taken 1 time.
✗ Branch 11 → 25 not taken.
✓ Branch 12 → 13 taken 1 time.
✗ Branch 12 → 14 not taken.
✓ Branch 15 → 16 taken 1 time.
✓ Branch 15 → 18 taken 25 times.
|
26 | if (lhsType.isPtr() && rhsType.isOneOf({TY_INT, TY_LONG, TY_SHORT})) { |
| 206 |
1/2✓ Branch 16 → 17 taken 1 time.
✗ Branch 16 → 26 not taken.
|
1 | ensureUnsafeAllowed(node, "-=", lhsType, rhsType); |
| 207 | 1 | return {lhs}; | |
| 208 | } | ||
| 209 | |||
| 210 |
1/2✓ Branch 20 → 21 taken 25 times.
✗ Branch 20 → 26 not taken.
|
25 | return {validateBinaryOperation(node, MINUS_EQUAL_OP_RULES, std::size(MINUS_EQUAL_OP_RULES), "-=", lhsType, rhsType)}; |
| 211 | } | ||
| 212 | |||
| 213 | 40 | ExprResult OpRuleManager::getMulEqualResultType(ASTNode *node, const ExprResult &lhs, const ExprResult &rhs, size_t opIdx) { | |
| 214 | // Check is there is an overloaded operator function available | ||
| 215 |
1/2✓ Branch 2 → 3 taken 40 times.
✗ Branch 2 → 15 not taken.
|
40 | const ExprResult resultType = isOperatorOverloadingFctAvailable<2>(node, OP_FCT_MUL_EQUAL, {lhs, rhs}, opIdx); |
| 216 |
3/4✓ Branch 3 → 4 taken 40 times.
✗ Branch 3 → 16 not taken.
✓ Branch 4 → 5 taken 2 times.
✓ Branch 4 → 6 taken 38 times.
|
40 | if (!resultType.type.is(TY_INVALID)) |
| 217 | 2 | return resultType; | |
| 218 | |||
| 219 | // Check if we try to assign a constant value | ||
| 220 |
1/2✓ Branch 6 → 7 taken 38 times.
✗ Branch 6 → 16 not taken.
|
38 | ensureNoConstAssign(node, lhs.type); |
| 221 | |||
| 222 | // Remove reference wrappers | ||
| 223 |
1/2✓ Branch 7 → 8 taken 38 times.
✗ Branch 7 → 16 not taken.
|
38 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 224 |
1/2✓ Branch 8 → 9 taken 38 times.
✗ Branch 8 → 16 not taken.
|
38 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 225 | |||
| 226 |
1/2✓ Branch 11 → 12 taken 38 times.
✗ Branch 11 → 16 not taken.
|
38 | return {validateBinaryOperation(node, MUL_EQUAL_OP_RULES, std::size(MUL_EQUAL_OP_RULES), "*=", lhsType, rhsType)}; |
| 227 | } | ||
| 228 | |||
| 229 | 45 | ExprResult OpRuleManager::getDivEqualResultType(ASTNode *node, const ExprResult &lhs, const ExprResult &rhs, size_t opIdx) { | |
| 230 | // Check is there is an overloaded operator function available | ||
| 231 |
1/2✓ Branch 2 → 3 taken 45 times.
✗ Branch 2 → 15 not taken.
|
45 | const ExprResult resultType = isOperatorOverloadingFctAvailable<2>(node, OP_FCT_DIV_EQUAL, {lhs, rhs}, opIdx); |
| 232 |
3/4✓ Branch 3 → 4 taken 45 times.
✗ Branch 3 → 16 not taken.
✓ Branch 4 → 5 taken 37 times.
✓ Branch 4 → 6 taken 8 times.
|
45 | if (!resultType.type.is(TY_INVALID)) |
| 233 | 37 | return resultType; | |
| 234 | |||
| 235 | // Check if we try to assign a constant value | ||
| 236 |
1/2✓ Branch 6 → 7 taken 8 times.
✗ Branch 6 → 16 not taken.
|
8 | ensureNoConstAssign(node, lhs.type); |
| 237 | |||
| 238 | // Remove reference wrappers | ||
| 239 |
1/2✓ Branch 7 → 8 taken 8 times.
✗ Branch 7 → 16 not taken.
|
8 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 240 |
1/2✓ Branch 8 → 9 taken 8 times.
✗ Branch 8 → 16 not taken.
|
8 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 241 | |||
| 242 |
1/2✓ Branch 11 → 12 taken 8 times.
✗ Branch 11 → 16 not taken.
|
8 | return {validateBinaryOperation(node, DIV_EQUAL_OP_RULES, std::size(DIV_EQUAL_OP_RULES), "/=", lhsType, rhsType)}; |
| 243 | } | ||
| 244 | |||
| 245 | 6 | QualType OpRuleManager::getRemEqualResultType(const ASTNode *node, const ExprResult &lhs, const ExprResult &rhs) const { | |
| 246 | // Check if we try to assign a constant value | ||
| 247 |
1/2✓ Branch 2 → 3 taken 6 times.
✗ Branch 2 → 11 not taken.
|
6 | ensureNoConstAssign(node, lhs.type); |
| 248 | |||
| 249 | // Remove reference wrappers | ||
| 250 |
1/2✓ Branch 3 → 4 taken 6 times.
✗ Branch 3 → 11 not taken.
|
6 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 251 |
1/2✓ Branch 4 → 5 taken 6 times.
✗ Branch 4 → 11 not taken.
|
6 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 252 | |||
| 253 |
1/2✓ Branch 7 → 8 taken 6 times.
✗ Branch 7 → 11 not taken.
|
12 | return validateBinaryOperation(node, REM_EQUAL_OP_RULES, std::size(REM_EQUAL_OP_RULES), "%=", lhsType, rhsType); |
| 254 | } | ||
| 255 | |||
| 256 | 2 | QualType OpRuleManager::getSHLEqualResultType(const ASTNode *node, const ExprResult &lhs, const ExprResult &rhs) const { | |
| 257 | // Check if we try to assign a constant value | ||
| 258 |
1/2✓ Branch 2 → 3 taken 2 times.
✗ Branch 2 → 11 not taken.
|
2 | ensureNoConstAssign(node, lhs.type); |
| 259 | |||
| 260 | // Remove reference wrappers | ||
| 261 |
1/2✓ Branch 3 → 4 taken 2 times.
✗ Branch 3 → 11 not taken.
|
2 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 262 |
1/2✓ Branch 4 → 5 taken 2 times.
✗ Branch 4 → 11 not taken.
|
2 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 263 | |||
| 264 |
1/2✓ Branch 7 → 8 taken 2 times.
✗ Branch 7 → 11 not taken.
|
4 | return validateBinaryOperation(node, SHL_EQUAL_OP_RULES, std::size(SHL_EQUAL_OP_RULES), "<<=", lhsType, rhsType); |
| 265 | } | ||
| 266 | |||
| 267 | 3 | QualType OpRuleManager::getSHREqualResultType(const ASTNode *node, const ExprResult &lhs, const ExprResult &rhs) const { | |
| 268 | // Check if we try to assign a constant value | ||
| 269 |
1/2✓ Branch 2 → 3 taken 3 times.
✗ Branch 2 → 11 not taken.
|
3 | ensureNoConstAssign(node, lhs.type); |
| 270 | |||
| 271 | // Remove reference wrappers | ||
| 272 |
1/2✓ Branch 3 → 4 taken 3 times.
✗ Branch 3 → 11 not taken.
|
3 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 273 |
1/2✓ Branch 4 → 5 taken 3 times.
✗ Branch 4 → 11 not taken.
|
3 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 274 | |||
| 275 |
1/2✓ Branch 7 → 8 taken 3 times.
✗ Branch 7 → 11 not taken.
|
6 | return validateBinaryOperation(node, SHR_EQUAL_OP_RULES, std::size(SHR_EQUAL_OP_RULES), ">>=", lhsType, rhsType); |
| 276 | } | ||
| 277 | |||
| 278 | 1 | QualType OpRuleManager::getAndEqualResultType(const ASTNode *node, const ExprResult &lhs, const ExprResult &rhs) const { | |
| 279 | // Check if we try to assign a constant value | ||
| 280 |
1/2✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 11 not taken.
|
1 | ensureNoConstAssign(node, lhs.type); |
| 281 | |||
| 282 | // Remove reference wrappers | ||
| 283 |
1/2✓ Branch 3 → 4 taken 1 time.
✗ Branch 3 → 11 not taken.
|
1 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 284 |
1/2✓ Branch 4 → 5 taken 1 time.
✗ Branch 4 → 11 not taken.
|
1 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 285 | |||
| 286 |
1/2✓ Branch 7 → 8 taken 1 time.
✗ Branch 7 → 11 not taken.
|
2 | return validateBinaryOperation(node, AND_EQUAL_OP_RULES, std::size(AND_EQUAL_OP_RULES), "&=", lhsType, rhsType); |
| 287 | } | ||
| 288 | |||
| 289 | 1 | QualType OpRuleManager::getOrEqualResultType(const ASTNode *node, const ExprResult &lhs, const ExprResult &rhs) const { | |
| 290 | // Check if we try to assign a constant value | ||
| 291 |
1/2✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 11 not taken.
|
1 | ensureNoConstAssign(node, lhs.type); |
| 292 | |||
| 293 | // Remove reference wrappers | ||
| 294 |
1/2✓ Branch 3 → 4 taken 1 time.
✗ Branch 3 → 11 not taken.
|
1 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 295 |
1/2✓ Branch 4 → 5 taken 1 time.
✗ Branch 4 → 11 not taken.
|
1 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 296 | |||
| 297 |
1/2✓ Branch 7 → 8 taken 1 time.
✗ Branch 7 → 11 not taken.
|
2 | return validateBinaryOperation(node, OR_EQUAL_OP_RULES, std::size(OR_EQUAL_OP_RULES), "|=", lhsType, rhsType); |
| 298 | } | ||
| 299 | |||
| 300 | 325 | QualType OpRuleManager::getXorEqualResultType(const ASTNode *node, const ExprResult &lhs, const ExprResult &rhs) const { | |
| 301 | // Check if we try to assign a constant value | ||
| 302 |
1/2✓ Branch 2 → 3 taken 325 times.
✗ Branch 2 → 11 not taken.
|
325 | ensureNoConstAssign(node, lhs.type); |
| 303 | |||
| 304 | // Remove reference wrappers | ||
| 305 |
1/2✓ Branch 3 → 4 taken 325 times.
✗ Branch 3 → 11 not taken.
|
325 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 306 |
1/2✓ Branch 4 → 5 taken 325 times.
✗ Branch 4 → 11 not taken.
|
325 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 307 | |||
| 308 |
1/2✓ Branch 7 → 8 taken 325 times.
✗ Branch 7 → 11 not taken.
|
650 | return validateBinaryOperation(node, XOR_EQUAL_OP_RULES, std::size(XOR_EQUAL_OP_RULES), "^=", lhsType, rhsType); |
| 309 | } | ||
| 310 | |||
| 311 | 1147 | QualType OpRuleManager::getLogicalOrResultType(const ASTNode *node, const ExprResult &lhs, const ExprResult &rhs) { | |
| 312 | // Remove reference wrappers | ||
| 313 |
1/2✓ Branch 2 → 3 taken 1147 times.
✗ Branch 2 → 10 not taken.
|
1147 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 314 |
1/2✓ Branch 3 → 4 taken 1147 times.
✗ Branch 3 → 10 not taken.
|
1147 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 315 | |||
| 316 |
2/2✓ Branch 6 → 7 taken 1146 times.
✓ Branch 6 → 10 taken 1 time.
|
2293 | return validateBinaryOperation(node, LOGICAL_OR_OP_RULES, std::size(LOGICAL_OR_OP_RULES), "||", lhsType, rhsType); |
| 317 | } | ||
| 318 | |||
| 319 | 202 | QualType OpRuleManager::getLogicalAndResultType(const ASTNode *node, const ExprResult &lhs, const ExprResult &rhs) { | |
| 320 | // Remove reference wrappers | ||
| 321 |
1/2✓ Branch 2 → 3 taken 202 times.
✗ Branch 2 → 10 not taken.
|
202 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 322 |
1/2✓ Branch 3 → 4 taken 202 times.
✗ Branch 3 → 10 not taken.
|
202 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 323 | |||
| 324 |
1/2✓ Branch 6 → 7 taken 202 times.
✗ Branch 6 → 10 not taken.
|
404 | return validateBinaryOperation(node, LOGICAL_AND_OP_RULES, std::size(LOGICAL_AND_OP_RULES), "&&", lhsType, rhsType); |
| 325 | } | ||
| 326 | |||
| 327 | 84 | QualType OpRuleManager::getBitwiseOrResultType(const ASTNode *node, const ExprResult &lhs, const ExprResult &rhs) { | |
| 328 | // Remove reference wrappers | ||
| 329 |
1/2✓ Branch 2 → 3 taken 84 times.
✗ Branch 2 → 10 not taken.
|
84 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 330 |
1/2✓ Branch 3 → 4 taken 84 times.
✗ Branch 3 → 10 not taken.
|
84 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 331 | |||
| 332 |
2/2✓ Branch 6 → 7 taken 83 times.
✓ Branch 6 → 10 taken 1 time.
|
167 | return validateBinaryOperation(node, BITWISE_OR_OP_RULES, std::size(BITWISE_OR_OP_RULES), "|", lhsType, rhsType); |
| 333 | } | ||
| 334 | |||
| 335 | 14 | QualType OpRuleManager::getBitwiseXorResultType(const ASTNode *node, const ExprResult &lhs, const ExprResult &rhs) { | |
| 336 | // Remove reference wrappers | ||
| 337 |
1/2✓ Branch 2 → 3 taken 14 times.
✗ Branch 2 → 10 not taken.
|
14 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 338 |
1/2✓ Branch 3 → 4 taken 14 times.
✗ Branch 3 → 10 not taken.
|
14 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 339 | |||
| 340 |
1/2✓ Branch 6 → 7 taken 14 times.
✗ Branch 6 → 10 not taken.
|
28 | return validateBinaryOperation(node, BITWISE_XOR_OP_RULES, std::size(BITWISE_XOR_OP_RULES), "^", lhsType, rhsType); |
| 341 | } | ||
| 342 | |||
| 343 | 30 | QualType OpRuleManager::getBitwiseAndResultType(const ASTNode *node, const ExprResult &lhs, const ExprResult &rhs) { | |
| 344 | // Remove reference wrappers | ||
| 345 |
1/2✓ Branch 2 → 3 taken 30 times.
✗ Branch 2 → 10 not taken.
|
30 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 346 |
1/2✓ Branch 3 → 4 taken 30 times.
✗ Branch 3 → 10 not taken.
|
30 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 347 | |||
| 348 |
1/2✓ Branch 6 → 7 taken 30 times.
✗ Branch 6 → 10 not taken.
|
60 | return validateBinaryOperation(node, BITWISE_AND_OP_RULES, std::size(BITWISE_AND_OP_RULES), "&", lhsType, rhsType); |
| 349 | } | ||
| 350 | |||
| 351 | 3624 | ExprResult OpRuleManager::getEqualResultType(ASTNode *node, const ExprResult &lhs, const ExprResult &rhs, size_t opIdx) { | |
| 352 | // Check is there is an overloaded operator function available | ||
| 353 |
1/2✓ Branch 2 → 3 taken 3624 times.
✗ Branch 2 → 45 not taken.
|
3624 | const ExprResult resultType = isOperatorOverloadingFctAvailable<2>(node, OP_FCT_EQUAL, {lhs, rhs}, opIdx); |
| 354 |
3/4✓ Branch 3 → 4 taken 3624 times.
✗ Branch 3 → 46 not taken.
✓ Branch 4 → 5 taken 416 times.
✓ Branch 4 → 6 taken 3208 times.
|
3624 | if (!resultType.type.is(TY_INVALID)) |
| 355 | 416 | return resultType; | |
| 356 | |||
| 357 | // Remove reference wrappers | ||
| 358 |
1/2✓ Branch 6 → 7 taken 3208 times.
✗ Branch 6 → 46 not taken.
|
3208 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 359 |
1/2✓ Branch 7 → 8 taken 3208 times.
✗ Branch 7 → 46 not taken.
|
3208 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 360 | |||
| 361 | // Allow 'pointer == pointer' straight away | ||
| 362 |
7/10✓ Branch 8 → 9 taken 3208 times.
✗ Branch 8 → 46 not taken.
✓ Branch 9 → 10 taken 893 times.
✓ Branch 9 → 13 taken 2315 times.
✓ Branch 10 → 11 taken 893 times.
✗ Branch 10 → 46 not taken.
✓ Branch 11 → 12 taken 893 times.
✗ Branch 11 → 13 not taken.
✓ Branch 14 → 15 taken 893 times.
✓ Branch 14 → 17 taken 2315 times.
|
3208 | if (lhsType.isPtr() && rhsType.isPtr()) |
| 363 |
1/2✓ Branch 15 → 16 taken 893 times.
✗ Branch 15 → 46 not taken.
|
893 | return ExprResult(QualType(TY_BOOL)); |
| 364 | |||
| 365 | // Allow 'pointer == int' straight away | ||
| 366 |
3/10✓ Branch 17 → 18 taken 2315 times.
✗ Branch 17 → 46 not taken.
✗ Branch 18 → 19 not taken.
✓ Branch 18 → 22 taken 2315 times.
✗ Branch 19 → 20 not taken.
✗ Branch 19 → 46 not taken.
✗ Branch 20 → 21 not taken.
✗ Branch 20 → 22 not taken.
✗ Branch 23 → 24 not taken.
✓ Branch 23 → 26 taken 2315 times.
|
2315 | if (lhsType.isPtr() && rhsType.is(TY_INT)) |
| 367 | ✗ | return ExprResult(QualType(TY_BOOL)); | |
| 368 | |||
| 369 | // Allow 'string == char*' and vice versa straight away | ||
| 370 |
8/18✓ Branch 26 → 27 taken 2315 times.
✗ Branch 26 → 46 not taken.
✓ Branch 27 → 28 taken 142 times.
✓ Branch 27 → 30 taken 2173 times.
✓ Branch 28 → 29 taken 142 times.
✗ Branch 28 → 46 not taken.
✓ Branch 29 → 30 taken 142 times.
✗ Branch 29 → 34 not taken.
✓ Branch 30 → 31 taken 2315 times.
✗ Branch 30 → 46 not taken.
✗ Branch 31 → 32 not taken.
✓ Branch 31 → 35 taken 2315 times.
✗ Branch 32 → 33 not taken.
✗ Branch 32 → 46 not taken.
✗ Branch 33 → 34 not taken.
✗ Branch 33 → 35 not taken.
✗ Branch 36 → 37 not taken.
✓ Branch 36 → 39 taken 2315 times.
|
2315 | if ((lhsType.is(TY_STRING) && rhsType.isPtrTo(TY_CHAR)) || (lhsType.isPtrTo(TY_CHAR) && rhsType.is(TY_STRING))) |
| 371 | ✗ | return ExprResult(QualType(TY_BOOL)); | |
| 372 | |||
| 373 | // Check primitive type combinations | ||
| 374 |
2/2✓ Branch 41 → 42 taken 2314 times.
✓ Branch 41 → 46 taken 1 time.
|
2315 | return ExprResult(validateBinaryOperation(node, EQUAL_OP_RULES, std::size(EQUAL_OP_RULES), "==", lhsType, rhsType)); |
| 375 | } | ||
| 376 | |||
| 377 | 1481 | ExprResult OpRuleManager::getNotEqualResultType(ASTNode *node, const ExprResult &lhs, const ExprResult &rhs, size_t opIdx) { | |
| 378 | // Check is there is an overloaded operator function available | ||
| 379 |
1/2✓ Branch 2 → 3 taken 1481 times.
✗ Branch 2 → 45 not taken.
|
1481 | const ExprResult resultType = isOperatorOverloadingFctAvailable<2>(node, OP_FCT_NOT_EQUAL, {lhs, rhs}, opIdx); |
| 380 |
3/4✓ Branch 3 → 4 taken 1481 times.
✗ Branch 3 → 46 not taken.
✓ Branch 4 → 5 taken 11 times.
✓ Branch 4 → 6 taken 1470 times.
|
1481 | if (!resultType.type.is(TY_INVALID)) |
| 381 | 11 | return resultType; | |
| 382 | |||
| 383 | // Remove reference wrappers | ||
| 384 |
1/2✓ Branch 6 → 7 taken 1470 times.
✗ Branch 6 → 46 not taken.
|
1470 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 385 |
1/2✓ Branch 7 → 8 taken 1470 times.
✗ Branch 7 → 46 not taken.
|
1470 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 386 | |||
| 387 | // Allow 'pointer != pointer' straight away | ||
| 388 |
8/10✓ Branch 8 → 9 taken 1470 times.
✗ Branch 8 → 46 not taken.
✓ Branch 9 → 10 taken 217 times.
✓ Branch 9 → 13 taken 1253 times.
✓ Branch 10 → 11 taken 217 times.
✗ Branch 10 → 46 not taken.
✓ Branch 11 → 12 taken 210 times.
✓ Branch 11 → 13 taken 7 times.
✓ Branch 14 → 15 taken 210 times.
✓ Branch 14 → 17 taken 1260 times.
|
1470 | if (lhsType.isPtr() && rhsType.isPtr()) |
| 389 |
1/2✓ Branch 15 → 16 taken 210 times.
✗ Branch 15 → 46 not taken.
|
210 | return ExprResult(QualType(TY_BOOL)); |
| 390 | |||
| 391 | // Allow 'pointer != int' straight away | ||
| 392 |
6/10✓ Branch 17 → 18 taken 1260 times.
✗ Branch 17 → 46 not taken.
✓ Branch 18 → 19 taken 7 times.
✓ Branch 18 → 22 taken 1253 times.
✓ Branch 19 → 20 taken 7 times.
✗ Branch 19 → 46 not taken.
✗ Branch 20 → 21 not taken.
✓ Branch 20 → 22 taken 7 times.
✗ Branch 23 → 24 not taken.
✓ Branch 23 → 26 taken 1260 times.
|
1260 | if (lhsType.isPtr() && rhsType.is(TY_INT)) |
| 393 | ✗ | return ExprResult(QualType(TY_BOOL)); | |
| 394 | |||
| 395 | // Allow 'string != char*' and vice versa straight away | ||
| 396 |
12/18✓ Branch 26 → 27 taken 1260 times.
✗ Branch 26 → 46 not taken.
✓ Branch 27 → 28 taken 9 times.
✓ Branch 27 → 30 taken 1251 times.
✓ Branch 28 → 29 taken 9 times.
✗ Branch 28 → 46 not taken.
✓ Branch 29 → 30 taken 9 times.
✗ Branch 29 → 34 not taken.
✓ Branch 30 → 31 taken 1260 times.
✗ Branch 30 → 46 not taken.
✓ Branch 31 → 32 taken 7 times.
✓ Branch 31 → 35 taken 1253 times.
✓ Branch 32 → 33 taken 7 times.
✗ Branch 32 → 46 not taken.
✓ Branch 33 → 34 taken 7 times.
✗ Branch 33 → 35 not taken.
✓ Branch 36 → 37 taken 7 times.
✓ Branch 36 → 39 taken 1253 times.
|
1260 | if ((lhsType.is(TY_STRING) && rhsType.isPtrTo(TY_CHAR)) || (lhsType.isPtrTo(TY_CHAR) && rhsType.is(TY_STRING))) |
| 397 |
1/2✓ Branch 37 → 38 taken 7 times.
✗ Branch 37 → 46 not taken.
|
7 | return ExprResult(QualType(TY_BOOL)); |
| 398 | |||
| 399 | // Check primitive type combinations | ||
| 400 |
1/2✓ Branch 41 → 42 taken 1253 times.
✗ Branch 41 → 46 not taken.
|
1253 | return ExprResult(validateBinaryOperation(node, NOT_EQUAL_OP_RULES, std::size(NOT_EQUAL_OP_RULES), "!=", lhsType, rhsType)); |
| 401 | } | ||
| 402 | |||
| 403 | 1784 | QualType OpRuleManager::getLessResultType(const ASTNode *node, const ExprResult &lhs, const ExprResult &rhs) { | |
| 404 | // Remove reference wrappers | ||
| 405 |
1/2✓ Branch 2 → 3 taken 1784 times.
✗ Branch 2 → 10 not taken.
|
1784 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 406 |
1/2✓ Branch 3 → 4 taken 1784 times.
✗ Branch 3 → 10 not taken.
|
1784 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 407 | |||
| 408 |
1/2✓ Branch 6 → 7 taken 1784 times.
✗ Branch 6 → 10 not taken.
|
3568 | return validateBinaryOperation(node, LESS_OP_RULES, std::size(LESS_OP_RULES), "<", lhsType, rhsType); |
| 409 | } | ||
| 410 | |||
| 411 | 497 | QualType OpRuleManager::getGreaterResultType(const ASTNode *node, const ExprResult &lhs, const ExprResult &rhs) { | |
| 412 | // Remove reference wrappers | ||
| 413 |
1/2✓ Branch 2 → 3 taken 497 times.
✗ Branch 2 → 10 not taken.
|
497 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 414 |
1/2✓ Branch 3 → 4 taken 497 times.
✗ Branch 3 → 10 not taken.
|
497 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 415 | |||
| 416 |
2/2✓ Branch 6 → 7 taken 496 times.
✓ Branch 6 → 10 taken 1 time.
|
993 | return validateBinaryOperation(node, GREATER_OP_RULES, std::size(GREATER_OP_RULES), ">", lhsType, rhsType); |
| 417 | } | ||
| 418 | |||
| 419 | 373 | QualType OpRuleManager::getLessEqualResultType(const ASTNode *node, const ExprResult &lhs, const ExprResult &rhs) { | |
| 420 | // Remove reference wrappers | ||
| 421 |
1/2✓ Branch 2 → 3 taken 373 times.
✗ Branch 2 → 10 not taken.
|
373 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 422 |
1/2✓ Branch 3 → 4 taken 373 times.
✗ Branch 3 → 10 not taken.
|
373 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 423 | |||
| 424 |
1/2✓ Branch 6 → 7 taken 373 times.
✗ Branch 6 → 10 not taken.
|
746 | return validateBinaryOperation(node, LESS_EQUAL_OP_RULES, std::size(LESS_EQUAL_OP_RULES), "<=", lhsType, rhsType); |
| 425 | } | ||
| 426 | |||
| 427 | 964 | QualType OpRuleManager::getGreaterEqualResultType(const ASTNode *node, const ExprResult &lhs, const ExprResult &rhs) { | |
| 428 | // Remove reference wrappers | ||
| 429 |
1/2✓ Branch 2 → 3 taken 964 times.
✗ Branch 2 → 10 not taken.
|
964 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 430 |
1/2✓ Branch 3 → 4 taken 964 times.
✗ Branch 3 → 10 not taken.
|
964 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 431 | |||
| 432 |
1/2✓ Branch 6 → 7 taken 964 times.
✗ Branch 6 → 10 not taken.
|
1928 | return validateBinaryOperation(node, GREATER_EQUAL_OP_RULES, std::size(GREATER_EQUAL_OP_RULES), ">=", lhsType, rhsType); |
| 433 | } | ||
| 434 | |||
| 435 | 97 | ExprResult OpRuleManager::getShiftLeftResultType(ASTNode *node, const ExprResult &lhs, const ExprResult &rhs, size_t opIdx) { | |
| 436 | // Check is there is an overloaded operator function available | ||
| 437 |
1/2✓ Branch 2 → 3 taken 97 times.
✗ Branch 2 → 14 not taken.
|
97 | const ExprResult resultType = isOperatorOverloadingFctAvailable<2>(node, OP_FCT_SHL, {lhs, rhs}, opIdx); |
| 438 |
3/4✓ Branch 3 → 4 taken 97 times.
✗ Branch 3 → 15 not taken.
✓ Branch 4 → 5 taken 85 times.
✓ Branch 4 → 6 taken 12 times.
|
97 | if (!resultType.type.is(TY_INVALID)) |
| 439 | 85 | return resultType; | |
| 440 | |||
| 441 | // Remove reference wrappers | ||
| 442 |
1/2✓ Branch 6 → 7 taken 12 times.
✗ Branch 6 → 15 not taken.
|
12 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 443 |
1/2✓ Branch 7 → 8 taken 12 times.
✗ Branch 7 → 15 not taken.
|
12 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 444 | |||
| 445 |
1/2✓ Branch 10 → 11 taken 12 times.
✗ Branch 10 → 15 not taken.
|
12 | return {validateBinaryOperation(node, SHIFT_LEFT_OP_RULES, std::size(SHIFT_LEFT_OP_RULES), "<<", lhsType, rhsType)}; |
| 446 | } | ||
| 447 | |||
| 448 | 56 | ExprResult OpRuleManager::getShiftRightResultType(ASTNode *node, const ExprResult &lhs, const ExprResult &rhs, size_t opIdx) { | |
| 449 | // Check is there is an overloaded operator function available | ||
| 450 |
1/2✓ Branch 2 → 3 taken 56 times.
✗ Branch 2 → 14 not taken.
|
56 | const ExprResult resultType = isOperatorOverloadingFctAvailable<2>(node, OP_FCT_SHR, {lhs, rhs}, opIdx); |
| 451 |
3/4✓ Branch 3 → 4 taken 56 times.
✗ Branch 3 → 15 not taken.
✓ Branch 4 → 5 taken 1 time.
✓ Branch 4 → 6 taken 55 times.
|
56 | if (!resultType.type.is(TY_INVALID)) |
| 452 | 1 | return resultType; | |
| 453 | |||
| 454 | // Remove reference wrappers | ||
| 455 |
1/2✓ Branch 6 → 7 taken 55 times.
✗ Branch 6 → 15 not taken.
|
55 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 456 |
1/2✓ Branch 7 → 8 taken 55 times.
✗ Branch 7 → 15 not taken.
|
55 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 457 | |||
| 458 |
1/2✓ Branch 10 → 11 taken 55 times.
✗ Branch 10 → 15 not taken.
|
55 | return {validateBinaryOperation(node, SHIFT_RIGHT_OP_RULES, std::size(SHIFT_RIGHT_OP_RULES), ">>", lhsType, rhsType)}; |
| 459 | } | ||
| 460 | |||
| 461 | 2868 | ExprResult OpRuleManager::getPlusResultType(ASTNode *node, const ExprResult &lhs, const ExprResult &rhs, size_t opIdx) { | |
| 462 | // Check is there is an overloaded operator function available | ||
| 463 |
1/2✓ Branch 2 → 3 taken 2868 times.
✗ Branch 2 → 32 not taken.
|
2868 | const ExprResult result = isOperatorOverloadingFctAvailable<2>(node, OP_FCT_PLUS, {lhs, rhs}, opIdx); |
| 464 |
3/4✓ Branch 3 → 4 taken 2868 times.
✗ Branch 3 → 35 not taken.
✓ Branch 4 → 5 taken 62 times.
✓ Branch 4 → 6 taken 2806 times.
|
2868 | if (!result.type.is(TY_INVALID)) |
| 465 | 62 | return result; | |
| 466 | |||
| 467 | // Remove reference wrappers | ||
| 468 |
1/2✓ Branch 6 → 7 taken 2806 times.
✗ Branch 6 → 35 not taken.
|
2806 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 469 |
1/2✓ Branch 7 → 8 taken 2806 times.
✗ Branch 7 → 35 not taken.
|
2806 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 470 | |||
| 471 | // Allow any* + <int/long/short> | ||
| 472 |
7/10✓ Branch 8 → 9 taken 2806 times.
✗ Branch 8 → 33 not taken.
✓ Branch 9 → 10 taken 522 times.
✓ Branch 9 → 13 taken 2284 times.
✓ Branch 10 → 11 taken 522 times.
✗ Branch 10 → 33 not taken.
✓ Branch 11 → 12 taken 522 times.
✗ Branch 11 → 13 not taken.
✓ Branch 14 → 15 taken 522 times.
✓ Branch 14 → 17 taken 2284 times.
|
2806 | if (lhsType.isPtr() && rhsType.isOneOf({TY_INT, TY_LONG, TY_SHORT})) { |
| 473 |
1/2✓ Branch 15 → 16 taken 522 times.
✗ Branch 15 → 35 not taken.
|
522 | ensureUnsafeAllowed(node, "+", lhsType, rhsType); |
| 474 | 522 | return {lhsType}; | |
| 475 | } | ||
| 476 | // Allow <int/long/short> + any* | ||
| 477 |
6/10✓ Branch 17 → 18 taken 2284 times.
✗ Branch 17 → 34 not taken.
✓ Branch 18 → 19 taken 2177 times.
✓ Branch 18 → 22 taken 107 times.
✓ Branch 19 → 20 taken 2177 times.
✗ Branch 19 → 34 not taken.
✗ Branch 20 → 21 not taken.
✓ Branch 20 → 22 taken 2177 times.
✗ Branch 23 → 24 not taken.
✓ Branch 23 → 26 taken 2284 times.
|
2284 | if (lhsType.isOneOf({TY_INT, TY_LONG, TY_SHORT}) && rhsType.isPtr()) { |
| 478 | ✗ | ensureUnsafeAllowed(node, "+", lhsType, rhsType); | |
| 479 | ✗ | return {rhsType}; | |
| 480 | } | ||
| 481 | |||
| 482 |
2/2✓ Branch 28 → 29 taken 2283 times.
✓ Branch 28 → 35 taken 1 time.
|
2284 | return {validateBinaryOperation(node, PLUS_OP_RULES, std::size(PLUS_OP_RULES), "+", lhsType, rhsType)}; |
| 483 | } | ||
| 484 | |||
| 485 | 1804 | ExprResult OpRuleManager::getMinusResultType(ASTNode *node, const ExprResult &lhs, const ExprResult &rhs, size_t opIdx) { | |
| 486 | // Check is there is an overloaded operator function available | ||
| 487 |
1/2✓ Branch 2 → 3 taken 1804 times.
✗ Branch 2 → 32 not taken.
|
1804 | const ExprResult resultType = isOperatorOverloadingFctAvailable<2>(node, OP_FCT_MINUS, {lhs, rhs}, opIdx); |
| 488 |
3/4✓ Branch 3 → 4 taken 1804 times.
✗ Branch 3 → 35 not taken.
✓ Branch 4 → 5 taken 1 time.
✓ Branch 4 → 6 taken 1803 times.
|
1804 | if (!resultType.type.is(TY_INVALID)) |
| 489 | 1 | return resultType; | |
| 490 | |||
| 491 | // Remove reference wrappers | ||
| 492 |
1/2✓ Branch 6 → 7 taken 1803 times.
✗ Branch 6 → 35 not taken.
|
1803 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 493 |
1/2✓ Branch 7 → 8 taken 1803 times.
✗ Branch 7 → 35 not taken.
|
1803 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 494 | |||
| 495 | // Allow any* - <int/long/short> | ||
| 496 |
3/10✓ Branch 8 → 9 taken 1803 times.
✗ Branch 8 → 33 not taken.
✗ Branch 9 → 10 not taken.
✓ Branch 9 → 13 taken 1803 times.
✗ Branch 10 → 11 not taken.
✗ Branch 10 → 33 not taken.
✗ Branch 11 → 12 not taken.
✗ Branch 11 → 13 not taken.
✗ Branch 14 → 15 not taken.
✓ Branch 14 → 17 taken 1803 times.
|
1803 | if (lhsType.isPtr() && rhsType.isOneOf({TY_INT, TY_LONG, TY_SHORT})) { |
| 497 | ✗ | ensureUnsafeAllowed(node, "-", lhsType, rhsType); | |
| 498 | ✗ | return {lhs}; | |
| 499 | } | ||
| 500 | // Allow <int/long/short> - any* | ||
| 501 |
6/10✓ Branch 17 → 18 taken 1803 times.
✗ Branch 17 → 34 not taken.
✓ Branch 18 → 19 taken 1795 times.
✓ Branch 18 → 22 taken 8 times.
✓ Branch 19 → 20 taken 1795 times.
✗ Branch 19 → 34 not taken.
✗ Branch 20 → 21 not taken.
✓ Branch 20 → 22 taken 1795 times.
✗ Branch 23 → 24 not taken.
✓ Branch 23 → 26 taken 1803 times.
|
1803 | if (lhsType.isOneOf({TY_INT, TY_LONG, TY_SHORT}) && rhsType.isPtr()) { |
| 502 | ✗ | ensureUnsafeAllowed(node, "-", lhsType, rhsType); | |
| 503 | ✗ | return {rhs}; | |
| 504 | } | ||
| 505 | |||
| 506 |
1/2✓ Branch 28 → 29 taken 1803 times.
✗ Branch 28 → 35 not taken.
|
1803 | return {validateBinaryOperation(node, MINUS_OP_RULES, std::size(MINUS_OP_RULES), "-", lhsType, rhsType)}; |
| 507 | } | ||
| 508 | |||
| 509 | 741 | ExprResult OpRuleManager::getMulResultType(ASTNode *node, const ExprResult &lhs, const ExprResult &rhs, size_t opIdx) { | |
| 510 | // Check is there is an overloaded operator function available | ||
| 511 |
1/2✓ Branch 2 → 3 taken 741 times.
✗ Branch 2 → 14 not taken.
|
741 | const ExprResult resultType = isOperatorOverloadingFctAvailable<2>(node, OP_FCT_MUL, {lhs, rhs}, opIdx); |
| 512 |
3/4✓ Branch 3 → 4 taken 741 times.
✗ Branch 3 → 15 not taken.
✓ Branch 4 → 5 taken 9 times.
✓ Branch 4 → 6 taken 732 times.
|
741 | if (!resultType.type.is(TY_INVALID)) |
| 513 | 9 | return resultType; | |
| 514 | |||
| 515 | // Remove reference wrappers | ||
| 516 |
1/2✓ Branch 6 → 7 taken 732 times.
✗ Branch 6 → 15 not taken.
|
732 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 517 |
1/2✓ Branch 7 → 8 taken 732 times.
✗ Branch 7 → 15 not taken.
|
732 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 518 | |||
| 519 |
2/2✓ Branch 10 → 11 taken 731 times.
✓ Branch 10 → 15 taken 1 time.
|
732 | return {validateBinaryOperation(node, MUL_OP_RULES, std::size(MUL_OP_RULES), "*", lhsType, rhsType)}; |
| 520 | } | ||
| 521 | |||
| 522 | 138 | ExprResult OpRuleManager::getDivResultType(ASTNode *node, const ExprResult &lhs, const ExprResult &rhs, size_t opIdx) { | |
| 523 | // Check is there is an overloaded operator function available | ||
| 524 |
1/2✓ Branch 2 → 3 taken 138 times.
✗ Branch 2 → 14 not taken.
|
138 | const ExprResult resultType = isOperatorOverloadingFctAvailable<2>(node, OP_FCT_DIV, {lhs, rhs}, opIdx); |
| 525 |
3/4✓ Branch 3 → 4 taken 138 times.
✗ Branch 3 → 15 not taken.
✓ Branch 4 → 5 taken 3 times.
✓ Branch 4 → 6 taken 135 times.
|
138 | if (!resultType.type.is(TY_INVALID)) |
| 526 | 3 | return resultType; | |
| 527 | |||
| 528 | // Remove reference wrappers | ||
| 529 |
1/2✓ Branch 6 → 7 taken 135 times.
✗ Branch 6 → 15 not taken.
|
135 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 530 |
1/2✓ Branch 7 → 8 taken 135 times.
✗ Branch 7 → 15 not taken.
|
135 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 531 | |||
| 532 |
1/2✓ Branch 10 → 11 taken 135 times.
✗ Branch 10 → 15 not taken.
|
135 | return {validateBinaryOperation(node, DIV_OP_RULES, std::size(DIV_OP_RULES), "/", lhsType, rhsType)}; |
| 533 | } | ||
| 534 | |||
| 535 | 12 | ExprResult OpRuleManager::getRemResultType(const ASTNode *node, const ExprResult &lhs, const ExprResult &rhs) { | |
| 536 | // Remove reference wrappers | ||
| 537 |
1/2✓ Branch 2 → 3 taken 12 times.
✗ Branch 2 → 10 not taken.
|
12 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 538 |
1/2✓ Branch 3 → 4 taken 12 times.
✗ Branch 3 → 10 not taken.
|
12 | const QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 539 | |||
| 540 |
1/2✓ Branch 6 → 7 taken 12 times.
✗ Branch 6 → 10 not taken.
|
24 | return {validateBinaryOperation(node, REM_OP_RULES, std::size(REM_OP_RULES), "%", lhsType, rhsType)}; |
| 541 | } | ||
| 542 | |||
| 543 | 16 | QualType OpRuleManager::getPrefixMinusResultType(const ASTNode *node, const ExprResult &lhs) { | |
| 544 | // Remove reference wrappers | ||
| 545 |
1/2✓ Branch 2 → 3 taken 16 times.
✗ Branch 2 → 9 not taken.
|
16 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 546 | |||
| 547 |
1/2✓ Branch 5 → 6 taken 16 times.
✗ Branch 5 → 9 not taken.
|
32 | return validateUnaryOperation(node, PREFIX_MINUS_OP_RULES, std::size(PREFIX_MINUS_OP_RULES), "-", lhsType); |
| 548 | } | ||
| 549 | |||
| 550 | 23 | QualType OpRuleManager::getPrefixPlusPlusResultType(const ASTNode *node, const ExprResult &lhs) const { | |
| 551 | // Check if we try to assign a constant value | ||
| 552 |
1/2✓ Branch 2 → 3 taken 23 times.
✗ Branch 2 → 14 not taken.
|
23 | ensureNoConstAssign(node, lhs.type); |
| 553 | |||
| 554 | // Remove reference wrappers | ||
| 555 |
1/2✓ Branch 3 → 4 taken 23 times.
✗ Branch 3 → 14 not taken.
|
23 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 556 | |||
| 557 | // Check if this is an unsafe operation | ||
| 558 |
2/4✓ Branch 4 → 5 taken 23 times.
✗ Branch 4 → 14 not taken.
✗ Branch 5 → 6 not taken.
✓ Branch 5 → 8 taken 23 times.
|
23 | if (lhsType.isPtr()) { |
| 559 | ✗ | ensureUnsafeAllowed(node, "++", lhsType); | |
| 560 | ✗ | return lhsType; | |
| 561 | } | ||
| 562 | |||
| 563 |
1/2✓ Branch 10 → 11 taken 23 times.
✗ Branch 10 → 14 not taken.
|
23 | return validateUnaryOperation(node, PREFIX_PLUS_PLUS_OP_RULES, std::size(PREFIX_PLUS_PLUS_OP_RULES), "++", lhsType); |
| 564 | } | ||
| 565 | |||
| 566 | 8 | QualType OpRuleManager::getPrefixMinusMinusResultType(const ASTNode *node, const ExprResult &lhs) const { | |
| 567 | // Check if we try to assign a constant value | ||
| 568 |
1/2✓ Branch 2 → 3 taken 8 times.
✗ Branch 2 → 14 not taken.
|
8 | ensureNoConstAssign(node, lhs.type); |
| 569 | |||
| 570 | // Remove reference wrappers | ||
| 571 |
1/2✓ Branch 3 → 4 taken 8 times.
✗ Branch 3 → 14 not taken.
|
8 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 572 | |||
| 573 | // Check if this is an unsafe operation | ||
| 574 |
2/4✓ Branch 4 → 5 taken 8 times.
✗ Branch 4 → 14 not taken.
✗ Branch 5 → 6 not taken.
✓ Branch 5 → 8 taken 8 times.
|
8 | if (lhsType.isPtr()) { |
| 575 | ✗ | ensureUnsafeAllowed(node, "--", lhsType); | |
| 576 | ✗ | return lhsType; | |
| 577 | } | ||
| 578 | |||
| 579 |
2/2✓ Branch 10 → 11 taken 7 times.
✓ Branch 10 → 14 taken 1 time.
|
8 | return validateUnaryOperation(node, PREFIX_MINUS_MINUS_OP_RULES, std::size(PREFIX_MINUS_MINUS_OP_RULES), "--", lhsType); |
| 580 | } | ||
| 581 | |||
| 582 | 731 | QualType OpRuleManager::getPrefixNotResultType(const ASTNode *node, const ExprResult &lhs) { | |
| 583 | // Remove reference wrappers | ||
| 584 |
1/2✓ Branch 2 → 3 taken 731 times.
✗ Branch 2 → 9 not taken.
|
731 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 585 | |||
| 586 |
1/2✓ Branch 5 → 6 taken 731 times.
✗ Branch 5 → 9 not taken.
|
1462 | return validateUnaryOperation(node, PREFIX_NOT_OP_RULES, std::size(PREFIX_NOT_OP_RULES), "!", lhsType); |
| 587 | } | ||
| 588 | |||
| 589 | 1 | QualType OpRuleManager::getPrefixBitwiseNotResultType(const ASTNode *node, const ExprResult &lhs) { | |
| 590 | // Remove reference wrappers | ||
| 591 |
1/2✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 9 not taken.
|
1 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 592 | |||
| 593 |
1/2✓ Branch 5 → 6 taken 1 time.
✗ Branch 5 → 9 not taken.
|
2 | return validateUnaryOperation(node, PREFIX_BITWISE_NOT_OP_RULES, std::size(PREFIX_BITWISE_NOT_OP_RULES), "~", lhsType); |
| 594 | } | ||
| 595 | |||
| 596 | 211 | QualType OpRuleManager::getPrefixMulResultType(const ASTNode *node, const ExprResult &lhs) { | |
| 597 | // Remove reference wrappers | ||
| 598 |
1/2✓ Branch 2 → 3 taken 211 times.
✗ Branch 2 → 25 not taken.
|
211 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 599 | |||
| 600 |
2/4✓ Branch 3 → 4 taken 211 times.
✗ Branch 3 → 25 not taken.
✗ Branch 4 → 5 not taken.
✓ Branch 4 → 12 taken 211 times.
|
211 | if (!lhsType.isPtr()) |
| 601 | ✗ | throw SemanticError(node, OPERATOR_WRONG_DATA_TYPE, "Cannot apply de-referencing operator on type " + lhsType.getName(true)); | |
| 602 |
1/2✓ Branch 12 → 13 taken 211 times.
✗ Branch 12 → 25 not taken.
|
422 | return lhsType.getContained(); |
| 603 | } | ||
| 604 | |||
| 605 | 92 | QualType OpRuleManager::getPrefixBitwiseAndResultType(const ASTNode *node, const ExprResult &lhs) { | |
| 606 | // Remove reference wrappers | ||
| 607 |
1/2✓ Branch 2 → 3 taken 92 times.
✗ Branch 2 → 7 not taken.
|
92 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 608 | |||
| 609 |
1/2✓ Branch 3 → 4 taken 92 times.
✗ Branch 3 → 7 not taken.
|
184 | return lhsType.toPtr(node); |
| 610 | } | ||
| 611 | |||
| 612 | 1731 | ExprResult OpRuleManager::getPostfixPlusPlusResultType(ASTNode *node, const ExprResult &lhs, size_t opIdx) { | |
| 613 | // Check is there is an overloaded operator function available | ||
| 614 |
1/2✓ Branch 2 → 3 taken 1731 times.
✗ Branch 2 → 18 not taken.
|
1731 | const ExprResult resultType = isOperatorOverloadingFctAvailable<1>(node, OP_FCT_POSTFIX_PLUS_PLUS, {lhs}, opIdx); |
| 615 |
3/4✓ Branch 3 → 4 taken 1731 times.
✗ Branch 3 → 19 not taken.
✓ Branch 4 → 5 taken 9 times.
✓ Branch 4 → 6 taken 1722 times.
|
1731 | if (!resultType.type.is(TY_INVALID)) |
| 616 | 9 | return resultType; | |
| 617 | |||
| 618 | // Check if we try to assign a constant value | ||
| 619 |
1/2✓ Branch 6 → 7 taken 1722 times.
✗ Branch 6 → 19 not taken.
|
1722 | ensureNoConstAssign(node, lhs.type); |
| 620 | |||
| 621 | // Remove reference wrappers | ||
| 622 |
1/2✓ Branch 7 → 8 taken 1722 times.
✗ Branch 7 → 19 not taken.
|
1722 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 623 | |||
| 624 | // Check if this is an unsafe operation | ||
| 625 |
3/4✓ Branch 8 → 9 taken 1722 times.
✗ Branch 8 → 19 not taken.
✓ Branch 9 → 10 taken 8 times.
✓ Branch 9 → 12 taken 1714 times.
|
1722 | if (lhsType.isPtr()) { |
| 626 |
1/2✓ Branch 10 → 11 taken 8 times.
✗ Branch 10 → 19 not taken.
|
8 | ensureUnsafeAllowed(node, "++", lhsType); |
| 627 | 8 | return {lhs}; | |
| 628 | } | ||
| 629 | |||
| 630 |
2/2✓ Branch 14 → 15 taken 1713 times.
✓ Branch 14 → 19 taken 1 time.
|
1714 | return {validateUnaryOperation(node, POSTFIX_PLUS_PLUS_OP_RULES, std::size(POSTFIX_PLUS_PLUS_OP_RULES), "++", lhsType)}; |
| 631 | } | ||
| 632 | |||
| 633 | 399 | ExprResult OpRuleManager::getPostfixMinusMinusResultType(ASTNode *node, const ExprResult &lhs, size_t opIdx) { | |
| 634 | // Check is there is an overloaded operator function available | ||
| 635 |
1/2✓ Branch 2 → 3 taken 399 times.
✗ Branch 2 → 18 not taken.
|
399 | const ExprResult resultType = isOperatorOverloadingFctAvailable<1>(node, OP_FCT_POSTFIX_MINUS_MINUS, {lhs}, opIdx); |
| 636 |
3/4✓ Branch 3 → 4 taken 399 times.
✗ Branch 3 → 19 not taken.
✓ Branch 4 → 5 taken 7 times.
✓ Branch 4 → 6 taken 392 times.
|
399 | if (!resultType.type.is(TY_INVALID)) |
| 637 | 7 | return resultType; | |
| 638 | |||
| 639 | // Check if we try to assign a constant value | ||
| 640 |
1/2✓ Branch 6 → 7 taken 392 times.
✗ Branch 6 → 19 not taken.
|
392 | ensureNoConstAssign(node, lhs.type); |
| 641 | |||
| 642 | // Remove reference wrappers | ||
| 643 |
1/2✓ Branch 7 → 8 taken 392 times.
✗ Branch 7 → 19 not taken.
|
392 | const QualType lhsType = lhs.type.removeReferenceWrapper(); |
| 644 | |||
| 645 | // Check if this is an unsafe operation | ||
| 646 |
3/4✓ Branch 8 → 9 taken 392 times.
✗ Branch 8 → 19 not taken.
✓ Branch 9 → 10 taken 1 time.
✓ Branch 9 → 12 taken 391 times.
|
392 | if (lhsType.isPtr()) { |
| 647 |
1/2✓ Branch 10 → 11 taken 1 time.
✗ Branch 10 → 19 not taken.
|
1 | ensureUnsafeAllowed(node, "--", lhsType); |
| 648 | 1 | return {lhs}; | |
| 649 | } | ||
| 650 | |||
| 651 |
1/2✓ Branch 14 → 15 taken 391 times.
✗ Branch 14 → 19 not taken.
|
391 | return {validateUnaryOperation(node, POSTFIX_MINUS_MINUS_OP_RULES, std::size(POSTFIX_MINUS_MINUS_OP_RULES), "--", lhsType)}; |
| 652 | } | ||
| 653 | |||
| 654 | 2455 | QualType OpRuleManager::getCastResultType(const ASTNode *node, QualType lhsType, const ExprResult &rhs) const { | |
| 655 | // Remove reference wrappers | ||
| 656 |
1/2✓ Branch 2 → 3 taken 2455 times.
✗ Branch 2 → 50 not taken.
|
2455 | lhsType = lhsType.removeReferenceWrapper(); |
| 657 |
1/2✓ Branch 3 → 4 taken 2455 times.
✗ Branch 3 → 57 not taken.
|
2455 | QualType rhsType = rhs.type.removeReferenceWrapper(); |
| 658 | |||
| 659 | // Only allow to cast the 'heap' qualifier away, if we are in unsafe mode | ||
| 660 |
2/2✓ Branch 6 → 7 taken 98 times.
✓ Branch 6 → 8 taken 2357 times.
|
2455 | if (lhsType.getQualifiers().isHeap != rhsType.getQualifiers().isHeap) |
| 661 |
1/2✓ Branch 7 → 8 taken 98 times.
✗ Branch 7 → 57 not taken.
|
98 | ensureUnsafeAllowed(node, "(cast)", lhsType, rhsType); |
| 662 | |||
| 663 | // Allow identity casts | ||
| 664 |
3/4✓ Branch 8 → 9 taken 2455 times.
✗ Branch 8 → 57 not taken.
✓ Branch 9 → 10 taken 241 times.
✓ Branch 9 → 11 taken 2214 times.
|
2455 | if (lhsType.matches(rhsType, false, true, true)) |
| 665 | 241 | return lhsType; | |
| 666 | // Allow casts string -> char* and string -> char[] | ||
| 667 |
12/16✓ Branch 11 → 12 taken 2214 times.
✗ Branch 11 → 51 not taken.
✓ Branch 12 → 13 taken 1110 times.
✓ Branch 12 → 19 taken 1104 times.
✓ Branch 13 → 14 taken 1110 times.
✗ Branch 13 → 51 not taken.
✓ Branch 14 → 15 taken 1110 times.
✗ Branch 14 → 51 not taken.
✓ Branch 15 → 16 taken 871 times.
✓ Branch 15 → 19 taken 239 times.
✓ Branch 16 → 17 taken 871 times.
✗ Branch 16 → 51 not taken.
✓ Branch 17 → 18 taken 867 times.
✓ Branch 17 → 19 taken 4 times.
✓ Branch 20 → 21 taken 867 times.
✓ Branch 20 → 22 taken 1347 times.
|
2214 | if (lhsType.isOneOf({TY_PTR, TY_ARRAY}) && lhsType.getContained().is(TY_CHAR) && rhsType.is(TY_STRING)) |
| 668 | 867 | return lhsType; | |
| 669 | // Allow casts char* -> string and char[] -> string | ||
| 670 |
10/16✓ Branch 22 → 23 taken 1347 times.
✗ Branch 22 → 53 not taken.
✓ Branch 23 → 24 taken 87 times.
✓ Branch 23 → 30 taken 1260 times.
✓ Branch 24 → 25 taken 87 times.
✗ Branch 24 → 53 not taken.
✓ Branch 25 → 26 taken 87 times.
✗ Branch 25 → 30 not taken.
✓ Branch 26 → 27 taken 87 times.
✗ Branch 26 → 53 not taken.
✓ Branch 27 → 28 taken 87 times.
✗ Branch 27 → 53 not taken.
✓ Branch 28 → 29 taken 87 times.
✗ Branch 28 → 30 not taken.
✓ Branch 31 → 32 taken 87 times.
✓ Branch 31 → 33 taken 1260 times.
|
1347 | if (lhsType.is(TY_STRING) && rhsType.isOneOf({TY_PTR, TY_ARRAY}) && rhsType.getContained().is(TY_CHAR)) |
| 671 | 87 | return lhsType; | |
| 672 | // Allow casts any* -> any* | ||
| 673 |
7/10✓ Branch 33 → 34 taken 1260 times.
✗ Branch 33 → 55 not taken.
✓ Branch 34 → 35 taken 243 times.
✓ Branch 34 → 38 taken 1017 times.
✓ Branch 35 → 36 taken 243 times.
✗ Branch 35 → 55 not taken.
✓ Branch 36 → 37 taken 243 times.
✗ Branch 36 → 38 not taken.
✓ Branch 39 → 40 taken 243 times.
✓ Branch 39 → 44 taken 1017 times.
|
1260 | if (lhsType.isOneOf({TY_PTR, TY_STRING}) && rhsType.isOneOf({TY_PTR, TY_STRING})) { |
| 674 |
2/4✓ Branch 40 → 41 taken 243 times.
✗ Branch 40 → 57 not taken.
✓ Branch 41 → 42 taken 243 times.
✗ Branch 41 → 43 not taken.
|
243 | if (lhsType != rhsType) |
| 675 |
1/2✓ Branch 42 → 43 taken 243 times.
✗ Branch 42 → 57 not taken.
|
243 | ensureUnsafeAllowed(node, "(cast)", lhsType, rhsType); |
| 676 | 243 | return lhsType; | |
| 677 | } | ||
| 678 | // Check primitive type combinations | ||
| 679 |
1/2✓ Branch 46 → 47 taken 1017 times.
✗ Branch 46 → 57 not taken.
|
1017 | return validateBinaryOperation(node, CAST_OP_RULES, std::size(CAST_OP_RULES), "(cast)", lhsType, rhsType, true); |
| 680 | } | ||
| 681 | |||
| 682 | template <size_t N> | ||
| 683 | 16534 | ExprResult OpRuleManager::isOperatorOverloadingFctAvailable(ASTNode *node, const char *const fctName, | |
| 684 | const std::array<ExprResult, N> &op, size_t opIdx) { | ||
| 685 | static_assert(N == 1 || N == 2, "Only unary and binary operators are overloadable"); | ||
| 686 | 16534 | Scope *calleeParentScope = nullptr; | |
| 687 | 16534 | const Function *callee = nullptr; | |
| 688 |
14/20spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<1ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 1ul> const&, unsigned long):
✓ Branch 2 → 3 taken 2130 times.
✗ Branch 2 → 123 not taken.
✓ Branch 3 → 4 taken 2130 times.
✗ Branch 3 → 123 not taken.
✓ Branch 4 → 5 taken 2130 times.
✗ Branch 4 → 123 not taken.
✓ Branch 42 → 43 taken 2291 times.
✓ Branch 42 → 45 taken 16 times.
✓ Branch 48 → 6 taken 18426 times.
✓ Branch 48 → 49 taken 2114 times.
spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<2ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 2ul> const&, unsigned long):
✓ Branch 2 → 3 taken 14404 times.
✗ Branch 2 → 132 not taken.
✓ Branch 3 → 4 taken 14404 times.
✗ Branch 3 → 132 not taken.
✓ Branch 4 → 5 taken 14404 times.
✗ Branch 4 → 132 not taken.
✓ Branch 49 → 50 taken 48993 times.
✓ Branch 49 → 52 taken 845 times.
✓ Branch 55 → 6 taken 121137 times.
✓ Branch 55 → 56 taken 13559 times.
|
207381 | for (const auto &sourceFile : typeChecker->resourceManager.sourceFiles | std::views::values) { |
| 689 | // Check if there is a registered operator function | ||
| 690 |
8/12spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<1ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 1ul> const&, unsigned long):
✓ Branch 10 → 11 taken 18426 times.
✗ Branch 10 → 102 not taken.
✓ Branch 11 → 12 taken 18426 times.
✗ Branch 11 → 100 not taken.
✓ Branch 14 → 15 taken 16119 times.
✓ Branch 14 → 16 taken 2307 times.
spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<2ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 2ul> const&, unsigned long):
✓ Branch 10 → 11 taken 121137 times.
✗ Branch 10 → 109 not taken.
✓ Branch 11 → 12 taken 121137 times.
✗ Branch 11 → 107 not taken.
✓ Branch 14 → 15 taken 71299 times.
✓ Branch 14 → 16 taken 49838 times.
|
418689 | if (!sourceFile->getNameRegistryEntry(fctName)) |
| 691 | 87418 | continue; | |
| 692 | |||
| 693 | // Match callees in the global scope of this source file | ||
| 694 | 52145 | calleeParentScope = sourceFile->globalScope.get(); | |
| 695 |
2/4spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<1ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 1ul> const&, unsigned long):
✓ Branch 18 → 19 taken 2307 times.
✗ Branch 18 → 122 not taken.
spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<2ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 2ul> const&, unsigned long):
✓ Branch 18 → 19 taken 49838 times.
✗ Branch 18 → 131 not taken.
|
52145 | const QualType thisType(TY_DYN); |
| 696 |
2/4spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<1ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 1ul> const&, unsigned long):
✓ Branch 21 → 22 taken 2307 times.
✗ Branch 21 → 106 not taken.
spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<2ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 2ul> const&, unsigned long):
✓ Branch 21 → 22 taken 49838 times.
✗ Branch 21 → 113 not taken.
|
52145 | ArgList args(N); |
| 697 |
2/4spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<1ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 1ul> const&, unsigned long):
✓ Branch 24 → 25 taken 2307 times.
✗ Branch 24 → 109 not taken.
spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<2ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 2ul> const&, unsigned long):
✓ Branch 24 → 25 taken 49838 times.
✗ Branch 24 → 116 not taken.
|
52145 | args[0] = {typeChecker->mapLocalTypeToImportedScopeType(calleeParentScope, op[0].type), op[0].isTemporary()}; |
| 698 | if constexpr (N == 2) | ||
| 699 |
1/2✓ Branch 31 → 32 taken 49838 times.
✗ Branch 31 → 118 not taken.
|
49838 | args[1] = {typeChecker->mapLocalTypeToImportedScopeType(calleeParentScope, op[1].type), op[1].isTemporary()}; |
| 700 |
4/8spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<1ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 1ul> const&, unsigned long):
✓ Branch 33 → 34 taken 2307 times.
✗ Branch 33 → 113 not taken.
✓ Branch 34 → 35 taken 2307 times.
✗ Branch 34 → 111 not taken.
spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<2ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 2ul> const&, unsigned long):
✓ Branch 40 → 41 taken 49838 times.
✗ Branch 40 → 122 not taken.
✓ Branch 41 → 42 taken 49838 times.
✗ Branch 41 → 120 not taken.
|
156435 | callee = FunctionManager::match(typeChecker, calleeParentScope, fctName, thisType, args, {}, false, node); |
| 701 |
4/4spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<1ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 1ul> const&, unsigned long):
✓ Branch 38 → 39 taken 16 times.
✓ Branch 38 → 40 taken 2291 times.
spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<2ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 2ul> const&, unsigned long):
✓ Branch 45 → 46 taken 845 times.
✓ Branch 45 → 47 taken 48993 times.
|
52145 | if (callee) |
| 702 | 861 | break; | |
| 703 | } | ||
| 704 | |||
| 705 | // Return invalid type if the callee was not found | ||
| 706 |
4/4spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<1ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 1ul> const&, unsigned long):
✓ Branch 49 → 50 taken 2114 times.
✓ Branch 49 → 52 taken 16 times.
spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<2ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 2ul> const&, unsigned long):
✓ Branch 56 → 57 taken 13559 times.
✓ Branch 56 → 59 taken 845 times.
|
16534 | if (!callee) |
| 707 | 15673 | return ExprResult(QualType(TY_INVALID)); | |
| 708 |
2/4spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<1ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 1ul> const&, unsigned long):
✗ Branch 52 → 53 not taken.
✓ Branch 52 → 54 taken 16 times.
spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<2ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 2ul> const&, unsigned long):
✗ Branch 59 → 60 not taken.
✓ Branch 59 → 61 taken 845 times.
|
861 | assert(calleeParentScope != nullptr); |
| 709 | |||
| 710 | // Save the pointer to the operator function in the AST node | ||
| 711 | 861 | std::vector<const Function *> &opFctPointers = typeChecker->getOpFctPointers(node); | |
| 712 |
3/4spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<1ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 1ul> const&, unsigned long):
✗ Branch 56 → 57 not taken.
✓ Branch 56 → 59 taken 16 times.
spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<2ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 2ul> const&, unsigned long):
✓ Branch 63 → 64 taken 68 times.
✓ Branch 63 → 66 taken 777 times.
|
861 | if (opFctPointers.size() <= opIdx) |
| 713 |
1/4spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<1ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 1ul> const&, unsigned long):
✗ Branch 57 → 58 not taken.
✗ Branch 57 → 124 not taken.
spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<2ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 2ul> const&, unsigned long):
✓ Branch 64 → 65 taken 68 times.
✗ Branch 64 → 133 not taken.
|
68 | opFctPointers.resize(opIdx + 1, nullptr); |
| 714 | 861 | opFctPointers.at(opIdx) = callee; | |
| 715 | |||
| 716 | // Check if we need to request a re-visit, because the function body was not type-checked yet | ||
| 717 | 861 | typeChecker->requestRevisitIfRequired(callee); | |
| 718 | |||
| 719 | // Check if the called function has sufficient visibility | ||
| 720 |
6/8spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<1ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 1ul> const&, unsigned long):
✓ Branch 61 → 62 taken 16 times.
✗ Branch 61 → 65 not taken.
✓ Branch 63 → 64 taken 14 times.
✓ Branch 63 → 65 taken 2 times.
spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<2ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 2ul> const&, unsigned long):
✓ Branch 68 → 69 taken 845 times.
✗ Branch 68 → 72 not taken.
✓ Branch 70 → 71 taken 386 times.
✓ Branch 70 → 72 taken 459 times.
|
861 | const bool isImported = calleeParentScope != nullptr && calleeParentScope->isImportedBy(typeChecker->rootScope); |
| 721 | 861 | const SymbolTableEntry *calleeEntry = callee->entry; | |
| 722 |
8/12spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<1ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 1ul> const&, unsigned long):
✓ Branch 66 → 67 taken 14 times.
✓ Branch 66 → 71 taken 2 times.
✗ Branch 69 → 70 not taken.
✓ Branch 69 → 71 taken 14 times.
✗ Branch 72 → 73 not taken.
✓ Branch 72 → 82 taken 16 times.
spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<2ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 2ul> const&, unsigned long):
✓ Branch 73 → 74 taken 386 times.
✓ Branch 73 → 78 taken 459 times.
✗ Branch 76 → 77 not taken.
✓ Branch 76 → 78 taken 386 times.
✗ Branch 79 → 80 not taken.
✓ Branch 79 → 89 taken 845 times.
|
861 | if (isImported && !calleeEntry->getQualType().isPublic()) |
| 723 | ✗ | throw SemanticError(node, INSUFFICIENT_VISIBILITY, | |
| 724 | ✗ | "Overloaded operator '" + callee->getSignature() + "' has insufficient visibility"); | |
| 725 | |||
| 726 | // Procedures always have the return type 'bool' | ||
| 727 |
4/4spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<1ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 1ul> const&, unsigned long):
✓ Branch 85 → 86 taken 14 times.
✓ Branch 85 → 88 taken 2 times.
spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<2ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 2ul> const&, unsigned long):
✓ Branch 92 → 93 taken 143 times.
✓ Branch 92 → 95 taken 702 times.
|
861 | if (callee->isProcedure()) |
| 728 | 157 | return ExprResult(QualType(TY_BOOL)); | |
| 729 | 704 | const QualType &returnType = callee->returnType; | |
| 730 | |||
| 731 | // Add anonymous symbol to keep track of dtor call, if non-trivially destructible | ||
| 732 | 704 | SymbolTableEntry *anonymousSymbol = nullptr; | |
| 733 |
8/12spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<1ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 1ul> const&, unsigned long):
✗ Branch 89 → 90 not taken.
✓ Branch 89 → 93 taken 2 times.
✗ Branch 91 → 92 not taken.
✗ Branch 91 → 93 not taken.
✗ Branch 94 → 95 not taken.
✓ Branch 94 → 97 taken 2 times.
spice::compiler::ExprResult spice::compiler::OpRuleManager::isOperatorOverloadingFctAvailable<2ul>(spice::compiler::ASTNode*, char const*, std::array<spice::compiler::ExprResult, 2ul> const&, unsigned long):
✓ Branch 96 → 97 taken 77 times.
✓ Branch 96 → 100 taken 625 times.
✓ Branch 98 → 99 taken 71 times.
✓ Branch 98 → 100 taken 6 times.
✓ Branch 101 → 102 taken 71 times.
✓ Branch 101 → 104 taken 631 times.
|
704 | if (returnType.is(TY_STRUCT) && !returnType.isTriviallyDestructible(node)) |
| 734 | 71 | anonymousSymbol = typeChecker->currentScope->symbolTable.insertAnonymous(returnType, node, opIdx); | |
| 735 | |||
| 736 | 704 | return {typeChecker->mapImportedScopeTypeToLocalType(calleeParentScope, returnType), anonymousSymbol}; | |
| 737 | } | ||
| 738 | |||
| 739 | 2884 | QualType OpRuleManager::validateUnaryOperation(const ASTNode *node, const UnaryOpRule opRules[], size_t opRulesSize, | |
| 740 | const char *name, const QualType &lhs) { | ||
| 741 |
2/2✓ Branch 11 → 3 taken 6907 times.
✓ Branch 11 → 12 taken 2 times.
|
6909 | for (size_t i = 0; i < opRulesSize; i++) { |
| 742 | 6907 | const UnaryOpRule &rule = opRules[i]; | |
| 743 |
2/2✓ Branch 5 → 6 taken 2882 times.
✓ Branch 5 → 10 taken 4025 times.
|
6907 | if (std::get<0>(rule) == lhs.getSuperType()) |
| 744 |
1/2✓ Branch 7 → 8 taken 2882 times.
✗ Branch 7 → 16 not taken.
|
2882 | return QualType(std::get<1>(rule)); |
| 745 | } | ||
| 746 |
1/2✓ Branch 13 → 14 taken 2 times.
✗ Branch 13 → 17 not taken.
|
2 | throw getExceptionUnary(node, name, lhs); |
| 747 | } | ||
| 748 | |||
| 749 | 33478 | QualType OpRuleManager::validateBinaryOperation(const ASTNode *node, const BinaryOpRule opRules[], size_t opRulesSize, | |
| 750 | const char *name, const QualType &lhs, const QualType &rhs, | ||
| 751 | bool preserveQualifiersFromLhs, const char *customMessagePrefix) { | ||
| 752 |
2/2✓ Branch 19 → 3 taken 308475 times.
✓ Branch 19 → 20 taken 19 times.
|
308494 | for (size_t i = 0; i < opRulesSize; i++) { |
| 753 | 308475 | const BinaryOpRule &rule = opRules[i]; | |
| 754 |
6/6✓ Branch 5 → 6 taken 66413 times.
✓ Branch 5 → 10 taken 242062 times.
✓ Branch 8 → 9 taken 33459 times.
✓ Branch 8 → 10 taken 32954 times.
✓ Branch 11 → 12 taken 33459 times.
✓ Branch 11 → 18 taken 275016 times.
|
308475 | if (std::get<0>(rule) == lhs.getSuperType() && std::get<1>(rule) == rhs.getSuperType()) { |
| 755 |
1/2✓ Branch 13 → 14 taken 33459 times.
✗ Branch 13 → 24 not taken.
|
33459 | QualType resultType((std::get<2>(rule))); |
| 756 |
2/2✓ Branch 14 → 15 taken 19206 times.
✓ Branch 14 → 17 taken 14253 times.
|
33459 | if (preserveQualifiersFromLhs) |
| 757 | 19206 | resultType.setQualifiers(lhs.getQualifiers()); | |
| 758 | 33459 | return resultType; | |
| 759 | } | ||
| 760 | } | ||
| 761 |
1/2✓ Branch 21 → 22 taken 19 times.
✗ Branch 21 → 25 not taken.
|
19 | throw getExceptionBinary(node, name, lhs, rhs, customMessagePrefix); |
| 762 | } | ||
| 763 | |||
| 764 | 2 | SemanticError OpRuleManager::getExceptionUnary(const ASTNode *node, const char *name, const QualType &lhs) { | |
| 765 |
6/12✓ Branch 2 → 3 taken 2 times.
✗ Branch 2 → 35 not taken.
✓ Branch 5 → 6 taken 2 times.
✗ Branch 5 → 27 not taken.
✓ Branch 6 → 7 taken 2 times.
✗ Branch 6 → 25 not taken.
✓ Branch 7 → 8 taken 2 times.
✗ Branch 7 → 23 not taken.
✓ Branch 8 → 9 taken 2 times.
✗ Branch 8 → 21 not taken.
✓ Branch 9 → 10 taken 2 times.
✗ Branch 9 → 19 not taken.
|
8 | return {node, OPERATOR_WRONG_DATA_TYPE, "Cannot apply '" + std::string(name) + "' operator on type " + lhs.getName(true)}; |
| 766 | } | ||
| 767 | |||
| 768 | 19 | SemanticError OpRuleManager::getExceptionBinary(const ASTNode *node, const char *name, const QualType &lhs, const QualType &rhs, | |
| 769 | const char *messagePrefix) { | ||
| 770 | // Build error message | ||
| 771 |
1/2✓ Branch 2 → 3 taken 19 times.
✗ Branch 2 → 50 not taken.
|
19 | std::stringstream errorMsg; |
| 772 |
2/2✓ Branch 3 → 4 taken 4 times.
✓ Branch 3 → 14 taken 15 times.
|
19 | if (strlen(messagePrefix) != 0) |
| 773 |
7/14✓ Branch 4 → 5 taken 4 times.
✗ Branch 4 → 48 not taken.
✓ Branch 5 → 6 taken 4 times.
✗ Branch 5 → 48 not taken.
✓ Branch 6 → 7 taken 4 times.
✗ Branch 6 → 37 not taken.
✓ Branch 7 → 8 taken 4 times.
✗ Branch 7 → 35 not taken.
✓ Branch 8 → 9 taken 4 times.
✗ Branch 8 → 35 not taken.
✓ Branch 9 → 10 taken 4 times.
✗ Branch 9 → 34 not taken.
✓ Branch 10 → 11 taken 4 times.
✗ Branch 10 → 32 not taken.
|
4 | errorMsg << messagePrefix << ". Expected " << lhs.getName(true) << " but got " << rhs.getName(true); |
| 774 | else | ||
| 775 |
8/16✓ Branch 14 → 15 taken 15 times.
✗ Branch 14 → 48 not taken.
✓ Branch 15 → 16 taken 15 times.
✗ Branch 15 → 48 not taken.
✓ Branch 16 → 17 taken 15 times.
✗ Branch 16 → 48 not taken.
✓ Branch 17 → 18 taken 15 times.
✗ Branch 17 → 43 not taken.
✓ Branch 18 → 19 taken 15 times.
✗ Branch 18 → 41 not taken.
✓ Branch 19 → 20 taken 15 times.
✗ Branch 19 → 41 not taken.
✓ Branch 20 → 21 taken 15 times.
✗ Branch 20 → 40 not taken.
✓ Branch 21 → 22 taken 15 times.
✗ Branch 21 → 38 not taken.
|
15 | errorMsg << "Cannot apply '" << name << "' operator on types " << lhs.getName(true) << " and " << rhs.getName(true); |
| 776 | |||
| 777 | // Return the exception | ||
| 778 |
2/4✓ Branch 25 → 26 taken 19 times.
✗ Branch 25 → 46 not taken.
✓ Branch 26 → 27 taken 19 times.
✗ Branch 26 → 44 not taken.
|
57 | return {node, OPERATOR_WRONG_DATA_TYPE, errorMsg.str()}; |
| 779 | 19 | } | |
| 780 | |||
| 781 | 9 | void OpRuleManager::ensureUnsafeAllowed(const ASTNode *node, const char *name, const QualType &lhs) const { | |
| 782 |
2/4✓ Branch 2 → 3 taken 9 times.
✗ Branch 2 → 43 not taken.
✓ Branch 3 → 4 taken 9 times.
✗ Branch 3 → 5 not taken.
|
9 | if (typeChecker->currentScope->doesAllowUnsafeOperations()) |
| 783 | 9 | return; | |
| 784 | // Print error message | ||
| 785 | ✗ | const std::string lhsName = lhs.getName(true); | |
| 786 | ✗ | const std::string errorMsg = "Cannot apply '" + std::string(name) + "' operator on type " + lhsName + | |
| 787 | ✗ | " as this is an unsafe operation. Please use unsafe blocks if you know what you are doing."; | |
| 788 | ✗ | SOFT_ERROR_VOID(node, UNSAFE_OPERATION_IN_SAFE_CONTEXT, errorMsg) | |
| 789 | ✗ | } | |
| 790 | |||
| 791 | 865 | void OpRuleManager::ensureUnsafeAllowed(const ASTNode *node, const char *name, const QualType &lhs, const QualType &rhs) const { | |
| 792 |
3/4✓ Branch 2 → 3 taken 865 times.
✗ Branch 2 → 57 not taken.
✓ Branch 3 → 4 taken 864 times.
✓ Branch 3 → 5 taken 1 time.
|
865 | if (typeChecker->currentScope->doesAllowUnsafeOperations()) |
| 793 | 864 | return; | |
| 794 | // Print error message | ||
| 795 |
1/2✓ Branch 5 → 6 taken 1 time.
✗ Branch 5 → 57 not taken.
|
1 | const std::string lhsName = lhs.getName(true); |
| 796 |
1/2✓ Branch 6 → 7 taken 1 time.
✗ Branch 6 → 55 not taken.
|
1 | const std::string rhsName = rhs.getName(true); |
| 797 |
6/12✓ Branch 9 → 10 taken 1 time.
✗ Branch 9 → 42 not taken.
✓ Branch 10 → 11 taken 1 time.
✗ Branch 10 → 40 not taken.
✓ Branch 11 → 12 taken 1 time.
✗ Branch 11 → 38 not taken.
✓ Branch 12 → 13 taken 1 time.
✗ Branch 12 → 36 not taken.
✓ Branch 13 → 14 taken 1 time.
✗ Branch 13 → 34 not taken.
✓ Branch 14 → 15 taken 1 time.
✗ Branch 14 → 32 not taken.
|
2 | const std::string errorMsg = "Cannot apply '" + std::string(name) + "' operator on types " + lhsName + " and " + rhsName + |
| 798 |
1/2✓ Branch 15 → 16 taken 1 time.
✗ Branch 15 → 30 not taken.
|
1 | " as this is an unsafe operation. Please use unsafe blocks if you know what you are doing."; |
| 799 |
1/2✓ Branch 23 → 24 taken 1 time.
✗ Branch 23 → 51 not taken.
|
1 | SOFT_ERROR_VOID(node, UNSAFE_OPERATION_IN_SAFE_CONTEXT, errorMsg) |
| 800 | 1 | } | |
| 801 | |||
| 802 | 27434 | void OpRuleManager::ensureNoConstAssign(const ASTNode *node, const QualType &lhs, bool isDecl, bool isReturn) const { | |
| 803 | // Check if we try to assign a constant value | ||
| 804 |
10/12✓ Branch 2 → 3 taken 27434 times.
✗ Branch 2 → 18 not taken.
✓ Branch 3 → 4 taken 27434 times.
✗ Branch 3 → 18 not taken.
✓ Branch 4 → 5 taken 2828 times.
✓ Branch 4 → 8 taken 24606 times.
✓ Branch 5 → 6 taken 55 times.
✓ Branch 5 → 8 taken 2773 times.
✓ Branch 6 → 7 taken 14 times.
✓ Branch 6 → 8 taken 41 times.
✓ Branch 9 → 10 taken 14 times.
✓ Branch 9 → 17 taken 27420 times.
|
27434 | if (lhs.removeReferenceWrapper().isConst() && !isDecl && !isReturn) { |
| 805 |
2/4✓ Branch 10 → 11 taken 14 times.
✗ Branch 10 → 21 not taken.
✓ Branch 11 → 12 taken 14 times.
✗ Branch 11 → 19 not taken.
|
14 | const std::string errorMessage = "Trying to assign value to an immutable variable of type " + lhs.getName(true); |
| 806 |
1/2✓ Branch 13 → 14 taken 14 times.
✗ Branch 13 → 22 not taken.
|
14 | SOFT_ERROR_VOID(node, REASSIGN_CONST_VARIABLE, errorMessage); |
| 807 | 14 | } | |
| 808 | } | ||
| 809 | |||
| 810 | } // namespace spice::compiler | ||
| 811 |