C++: Fix missing result for 'getFunction' and accept test changes.

This commit is contained in:
Mathias Vorreiter Pedersen
2023-04-26 18:01:39 +01:00
parent 1dcac76992
commit b18e096f7f
5 changed files with 6 additions and 8 deletions

View File

@@ -28,7 +28,11 @@ abstract class TranslatedCondition extends TranslatedElement {
final Expr getExpr() { result = expr }
final override Function getFunction() { result = getEnclosingFunction(expr) }
final override Declaration getFunction() {
result = getEnclosingFunction(expr) or
result = getEnclosingVariable(expr).(GlobalOrNamespaceVariable) or
result = getEnclosingVariable(expr).(StaticInitializedStaticLocalVariable)
}
final Type getResultType() { result = expr.getUnspecifiedType() }
}

View File

@@ -993,7 +993,7 @@ class TranslatedConstructorBareInit extends TranslatedElement, TTranslatedConstr
override TranslatedElement getChild(int id) { none() }
override Function getFunction() { result = getParent().getFunction() }
override Declaration getFunction() { result = getParent().getFunction() }
override Instruction getInstructionSuccessor(InstructionTag tag, EdgeKind kind) { none() }

View File

@@ -20,7 +20,6 @@ unexplainedLoop
unnecessaryPhiInstruction
memoryOperandDefinitionIsUnmodeled
operandAcrossFunctions
| test.c:245:31:245:31 | Condition | Operand 'Condition' is used on instruction 'ConditionalBranch: 0' in function '$@', but is defined on instruction 'Constant: 0' in function '$@'. | file://:0:0:0:0 | <Missing IRFunction> | <Missing IRFunction> | test.c:245:24:245:24 | const void *[] a | const void *[] a |
instructionWithoutUniqueBlock
containsLoopOfForwardEdges
lostReachability
@@ -31,7 +30,6 @@ notMarkedAsConflated
wronglyMarkedAsConflated
invalidOverlap
nonUniqueEnclosingIRFunction
| test.c:245:31:245:31 | ConditionalBranch: 0 | Instruction 'ConditionalBranch: 0' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | <Missing IRFunction> | <Missing IRFunction> |
fieldAddressOnNonPointer
thisArgumentIsNonPointer
| pmcallexpr.cpp:10:2:10:15 | Call: call to expression | Call instruction 'Call: call to expression' has a `this` argument operand that is not an address, in function '$@'. | pmcallexpr.cpp:8:13:8:13 | void f() | void f() |

View File

@@ -33,7 +33,6 @@ unexplainedLoop
unnecessaryPhiInstruction
memoryOperandDefinitionIsUnmodeled
operandAcrossFunctions
| test.c:245:31:245:31 | Condition | Operand 'Condition' is used on instruction 'ConditionalBranch: 0' in function '$@', but is defined on instruction 'Constant: 0' in function '$@'. | file://:0:0:0:0 | <Missing IRFunction> | <Missing IRFunction> | test.c:245:24:245:24 | const void *[] a | const void *[] a |
instructionWithoutUniqueBlock
containsLoopOfForwardEdges
lostReachability
@@ -53,7 +52,6 @@ notMarkedAsConflated
wronglyMarkedAsConflated
invalidOverlap
nonUniqueEnclosingIRFunction
| test.c:245:31:245:31 | ConditionalBranch: 0 | Instruction 'ConditionalBranch: 0' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | <Missing IRFunction> | <Missing IRFunction> |
fieldAddressOnNonPointer
thisArgumentIsNonPointer
| pmcallexpr.cpp:10:2:10:15 | Call: call to expression | Call instruction 'Call: call to expression' has a `this` argument operand that is not an address, in function '$@'. | pmcallexpr.cpp:8:13:8:13 | void f() | void f() |

View File

@@ -20,7 +20,6 @@ unexplainedLoop
unnecessaryPhiInstruction
memoryOperandDefinitionIsUnmodeled
operandAcrossFunctions
| test.c:245:31:245:31 | Condition | Operand 'Condition' is used on instruction 'ConditionalBranch: 0' in function '$@', but is defined on instruction 'Constant: 0' in function '$@'. | file://:0:0:0:0 | <Missing IRFunction> | <Missing IRFunction> | test.c:245:24:245:24 | const void *[] a | const void *[] a |
instructionWithoutUniqueBlock
containsLoopOfForwardEdges
lostReachability
@@ -31,7 +30,6 @@ notMarkedAsConflated
wronglyMarkedAsConflated
invalidOverlap
nonUniqueEnclosingIRFunction
| test.c:245:31:245:31 | ConditionalBranch: 0 | Instruction 'ConditionalBranch: 0' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | <Missing IRFunction> | <Missing IRFunction> |
fieldAddressOnNonPointer
thisArgumentIsNonPointer
| pmcallexpr.cpp:10:2:10:15 | Call: call to expression | Call instruction 'Call: call to expression' has a `this` argument operand that is not an address, in function '$@'. | pmcallexpr.cpp:8:13:8:13 | void f() | void f() |