зеркало из https://github.com/github/codeql.git
C++: Add testcase with two destructor calls without a temporary object expression at the top-level.
This commit is contained in:
Родитель
febd06063a
Коммит
9c25ce4079
|
@ -2367,6 +2367,42 @@ destructors_for_temps.cpp:
|
|||
# 99| Type = [Struct] ClassWithDestructor3
|
||||
# 99| ValueCategory = xvalue
|
||||
# 100| getStmt(1): [ReturnStmt] return ...
|
||||
# 102| [TopLevelFunction] void temp_test12(ClassWithDestructor3)
|
||||
# 102| <params>:
|
||||
# 102| getParameter(0): [Parameter] x
|
||||
# 102| Type = [Struct] ClassWithDestructor3
|
||||
# 102| getEntryPoint(): [BlockStmt] { ... }
|
||||
# 103| getStmt(0): [ExprStmt] ExprStmt
|
||||
# 103| getExpr(): [AddExpr] ... + ...
|
||||
# 103| Type = [IntType] int
|
||||
# 103| ValueCategory = prvalue
|
||||
# 103| getLeftOperand(): [FunctionCall] call to get_x
|
||||
# 103| Type = [PlainCharType] char
|
||||
# 103| ValueCategory = prvalue
|
||||
# 103| getQualifier(): [FunctionCall] call to getClassWithDestructor2
|
||||
# 103| Type = [Class] ClassWithDestructor2
|
||||
# 103| ValueCategory = prvalue
|
||||
# 103| getQualifier(): [VariableAccess] x
|
||||
# 103| Type = [Struct] ClassWithDestructor3
|
||||
# 103| ValueCategory = lvalue
|
||||
# 103| getQualifier().getFullyConverted(): [TemporaryObjectExpr] temporary object
|
||||
# 103| Type = [Class] ClassWithDestructor2
|
||||
# 103| ValueCategory = prvalue(load)
|
||||
# 103| getRightOperand(): [Literal] 5
|
||||
# 103| Type = [IntType] int
|
||||
# 103| Value = [Literal] 5
|
||||
# 103| ValueCategory = prvalue
|
||||
# 103| getImplicitDestructorCall(0): [DestructorCall] call to ~ClassWithDestructor2
|
||||
# 103| Type = [VoidType] void
|
||||
# 103| ValueCategory = prvalue
|
||||
# 103| getQualifier(): [ReuseExpr] reuse of temporary object
|
||||
# 103| Type = [Class] ClassWithDestructor2
|
||||
# 103| ValueCategory = xvalue
|
||||
# 103| getLeftOperand().getFullyConverted(): [CStyleCast] (int)...
|
||||
# 103| Conversion = [IntegralConversion] integral conversion
|
||||
# 103| Type = [IntType] int
|
||||
# 103| ValueCategory = prvalue
|
||||
# 104| getStmt(1): [ReturnStmt] return ...
|
||||
ir.c:
|
||||
# 5| [TopLevelFunction] int getX(MyCoords*)
|
||||
# 5| <params>:
|
||||
|
|
|
@ -1544,6 +1544,47 @@ destructors_for_temps.cpp:
|
|||
# 94| v94_6(void) = AliasedUse : ~m99_28
|
||||
# 94| v94_7(void) = ExitFunction :
|
||||
|
||||
# 102| void temp_test12(ClassWithDestructor3)
|
||||
# 102| Block 0
|
||||
# 102| v102_1(void) = EnterFunction :
|
||||
# 102| m102_2(unknown) = AliasedDefinition :
|
||||
# 102| m102_3(unknown) = InitializeNonLocal :
|
||||
# 102| m102_4(unknown) = Chi : total:m102_2, partial:m102_3
|
||||
# 102| r102_5(glval<ClassWithDestructor3>) = VariableAddress[x] :
|
||||
# 102| m102_6(ClassWithDestructor3) = InitializeParameter[x] : &:r102_5
|
||||
# 103| r103_1(glval<ClassWithDestructor2>) = VariableAddress[#temp103:5] :
|
||||
# 103| r103_2(glval<ClassWithDestructor3>) = VariableAddress[x] :
|
||||
# 103| r103_3(glval<unknown>) = FunctionAddress[getClassWithDestructor2] :
|
||||
# 103| r103_4(ClassWithDestructor2) = Call[getClassWithDestructor2] : func:r103_3, this:r103_2
|
||||
# 103| m103_5(unknown) = ^CallSideEffect : ~m102_4
|
||||
# 103| m103_6(unknown) = Chi : total:m102_4, partial:m103_5
|
||||
# 103| v103_7(void) = ^IndirectReadSideEffect[-1] : &:r103_2, m102_6
|
||||
# 103| m103_8(ClassWithDestructor3) = ^IndirectMayWriteSideEffect[-1] : &:r103_2
|
||||
# 103| m103_9(ClassWithDestructor3) = Chi : total:m102_6, partial:m103_8
|
||||
# 103| m103_10(ClassWithDestructor2) = Store[#temp103:5] : &:r103_1, r103_4
|
||||
# 103| r103_11(glval<unknown>) = FunctionAddress[get_x] :
|
||||
# 103| r103_12(char) = Call[get_x] : func:r103_11, this:r103_1
|
||||
# 103| m103_13(unknown) = ^CallSideEffect : ~m103_6
|
||||
# 103| m103_14(unknown) = Chi : total:m103_6, partial:m103_13
|
||||
# 103| v103_15(void) = ^IndirectReadSideEffect[-1] : &:r103_1, m103_10
|
||||
# 103| m103_16(ClassWithDestructor2) = ^IndirectMayWriteSideEffect[-1] : &:r103_1
|
||||
# 103| m103_17(ClassWithDestructor2) = Chi : total:m103_10, partial:m103_16
|
||||
# 103| r103_18(int) = Convert : r103_12
|
||||
# 103| r103_19(int) = Constant[5] :
|
||||
# 103| r103_20(int) = Add : r103_18, r103_19
|
||||
# 103| r103_21(glval<ClassWithDestructor2>) = CopyValue : r103_1
|
||||
# 103| r103_22(glval<unknown>) = FunctionAddress[~ClassWithDestructor2] :
|
||||
# 103| v103_23(void) = Call[~ClassWithDestructor2] : func:r103_22, this:r103_21
|
||||
# 103| m103_24(unknown) = ^CallSideEffect : ~m103_14
|
||||
# 103| m103_25(unknown) = Chi : total:m103_14, partial:m103_24
|
||||
# 103| v103_26(void) = ^IndirectReadSideEffect[-1] : &:r103_21, m103_17
|
||||
# 103| m103_27(ClassWithDestructor2) = ^IndirectMayWriteSideEffect[-1] : &:r103_21
|
||||
# 103| m103_28(ClassWithDestructor2) = Chi : total:m103_17, partial:m103_27
|
||||
# 104| v104_1(void) = NoOp :
|
||||
# 102| v102_7(void) = ReturnVoid :
|
||||
# 102| v102_8(void) = AliasedUse : ~m103_25
|
||||
# 102| v102_9(void) = ExitFunction :
|
||||
|
||||
ir.c:
|
||||
# 7| void MyCoordsTest(int)
|
||||
# 7| Block 0
|
||||
|
|
|
@ -97,4 +97,8 @@ void temp_test11() {
|
|||
// First, ~ClassWithDestructor2::ClassWithDestructor2(), and then the call
|
||||
// to `~ClassWithDestructor3::ClassWithDestructor3()`.
|
||||
makeClassWithDestructor3().getClassWithDestructor2();
|
||||
}
|
||||
|
||||
void temp_test12(ClassWithDestructor3 x) {
|
||||
x.getClassWithDestructor2().get_x() + 5;
|
||||
}
|
|
@ -1375,6 +1375,46 @@
|
|||
| destructors_for_temps.cpp:99:32:99:54 | ChiTotal | total:m99_6 |
|
||||
| destructors_for_temps.cpp:99:32:99:54 | SideEffect | ~m99_6 |
|
||||
| destructors_for_temps.cpp:99:32:99:54 | StoreValue | r99_9 |
|
||||
| destructors_for_temps.cpp:102:6:102:16 | ChiPartial | partial:m102_3 |
|
||||
| destructors_for_temps.cpp:102:6:102:16 | ChiTotal | total:m102_2 |
|
||||
| destructors_for_temps.cpp:102:6:102:16 | SideEffect | ~m103_25 |
|
||||
| destructors_for_temps.cpp:102:39:102:39 | Address | &:r102_5 |
|
||||
| destructors_for_temps.cpp:103:5:103:5 | Address | &:r103_2 |
|
||||
| destructors_for_temps.cpp:103:5:103:5 | Address | &:r103_2 |
|
||||
| destructors_for_temps.cpp:103:5:103:5 | Arg(this) | this:r103_2 |
|
||||
| destructors_for_temps.cpp:103:5:103:5 | ChiPartial | partial:m103_8 |
|
||||
| destructors_for_temps.cpp:103:5:103:5 | ChiTotal | total:m102_6 |
|
||||
| destructors_for_temps.cpp:103:5:103:5 | SideEffect | m102_6 |
|
||||
| destructors_for_temps.cpp:103:5:103:31 | Address | &:r103_1 |
|
||||
| destructors_for_temps.cpp:103:5:103:31 | Address | &:r103_1 |
|
||||
| destructors_for_temps.cpp:103:5:103:31 | Address | &:r103_1 |
|
||||
| destructors_for_temps.cpp:103:5:103:31 | Address | &:r103_21 |
|
||||
| destructors_for_temps.cpp:103:5:103:31 | Address | &:r103_21 |
|
||||
| destructors_for_temps.cpp:103:5:103:31 | Arg(this) | this:r103_1 |
|
||||
| destructors_for_temps.cpp:103:5:103:31 | Arg(this) | this:r103_21 |
|
||||
| destructors_for_temps.cpp:103:5:103:31 | CallTarget | func:r103_22 |
|
||||
| destructors_for_temps.cpp:103:5:103:31 | ChiPartial | partial:m103_16 |
|
||||
| destructors_for_temps.cpp:103:5:103:31 | ChiPartial | partial:m103_24 |
|
||||
| destructors_for_temps.cpp:103:5:103:31 | ChiPartial | partial:m103_27 |
|
||||
| destructors_for_temps.cpp:103:5:103:31 | ChiTotal | total:m103_10 |
|
||||
| destructors_for_temps.cpp:103:5:103:31 | ChiTotal | total:m103_14 |
|
||||
| destructors_for_temps.cpp:103:5:103:31 | ChiTotal | total:m103_17 |
|
||||
| destructors_for_temps.cpp:103:5:103:31 | SideEffect | m103_10 |
|
||||
| destructors_for_temps.cpp:103:5:103:31 | SideEffect | m103_17 |
|
||||
| destructors_for_temps.cpp:103:5:103:31 | SideEffect | ~m103_14 |
|
||||
| destructors_for_temps.cpp:103:5:103:31 | Unary | r103_1 |
|
||||
| destructors_for_temps.cpp:103:5:103:39 | Left | r103_18 |
|
||||
| destructors_for_temps.cpp:103:7:103:29 | CallTarget | func:r103_3 |
|
||||
| destructors_for_temps.cpp:103:7:103:29 | ChiPartial | partial:m103_5 |
|
||||
| destructors_for_temps.cpp:103:7:103:29 | ChiTotal | total:m102_4 |
|
||||
| destructors_for_temps.cpp:103:7:103:29 | SideEffect | ~m102_4 |
|
||||
| destructors_for_temps.cpp:103:7:103:29 | StoreValue | r103_4 |
|
||||
| destructors_for_temps.cpp:103:33:103:37 | CallTarget | func:r103_11 |
|
||||
| destructors_for_temps.cpp:103:33:103:37 | ChiPartial | partial:m103_13 |
|
||||
| destructors_for_temps.cpp:103:33:103:37 | ChiTotal | total:m103_6 |
|
||||
| destructors_for_temps.cpp:103:33:103:37 | SideEffect | ~m103_6 |
|
||||
| destructors_for_temps.cpp:103:33:103:37 | Unary | r103_12 |
|
||||
| destructors_for_temps.cpp:103:43:103:43 | Right | r103_19 |
|
||||
| file://:0:0:0:0 | Address | &:r0_1 |
|
||||
| file://:0:0:0:0 | Address | &:r0_1 |
|
||||
| file://:0:0:0:0 | Address | &:r0_1 |
|
||||
|
|
|
@ -1399,6 +1399,40 @@ destructors_for_temps.cpp:
|
|||
# 94| v94_5(void) = AliasedUse : ~m?
|
||||
# 94| v94_6(void) = ExitFunction :
|
||||
|
||||
# 102| void temp_test12(ClassWithDestructor3)
|
||||
# 102| Block 0
|
||||
# 102| v102_1(void) = EnterFunction :
|
||||
# 102| mu102_2(unknown) = AliasedDefinition :
|
||||
# 102| mu102_3(unknown) = InitializeNonLocal :
|
||||
# 102| r102_4(glval<ClassWithDestructor3>) = VariableAddress[x] :
|
||||
# 102| mu102_5(ClassWithDestructor3) = InitializeParameter[x] : &:r102_4
|
||||
# 103| r103_1(glval<ClassWithDestructor2>) = VariableAddress[#temp103:5] :
|
||||
# 103| r103_2(glval<ClassWithDestructor3>) = VariableAddress[x] :
|
||||
# 103| r103_3(glval<unknown>) = FunctionAddress[getClassWithDestructor2] :
|
||||
# 103| r103_4(ClassWithDestructor2) = Call[getClassWithDestructor2] : func:r103_3, this:r103_2
|
||||
# 103| mu103_5(unknown) = ^CallSideEffect : ~m?
|
||||
# 103| v103_6(void) = ^IndirectReadSideEffect[-1] : &:r103_2, ~m?
|
||||
# 103| mu103_7(ClassWithDestructor3) = ^IndirectMayWriteSideEffect[-1] : &:r103_2
|
||||
# 103| mu103_8(ClassWithDestructor2) = Store[#temp103:5] : &:r103_1, r103_4
|
||||
# 103| r103_9(glval<unknown>) = FunctionAddress[get_x] :
|
||||
# 103| r103_10(char) = Call[get_x] : func:r103_9, this:r103_1
|
||||
# 103| mu103_11(unknown) = ^CallSideEffect : ~m?
|
||||
# 103| v103_12(void) = ^IndirectReadSideEffect[-1] : &:r103_1, ~m?
|
||||
# 103| mu103_13(ClassWithDestructor2) = ^IndirectMayWriteSideEffect[-1] : &:r103_1
|
||||
# 103| r103_14(int) = Convert : r103_10
|
||||
# 103| r103_15(int) = Constant[5] :
|
||||
# 103| r103_16(int) = Add : r103_14, r103_15
|
||||
# 103| r103_17(glval<ClassWithDestructor2>) = CopyValue : r103_1
|
||||
# 103| r103_18(glval<unknown>) = FunctionAddress[~ClassWithDestructor2] :
|
||||
# 103| v103_19(void) = Call[~ClassWithDestructor2] : func:r103_18, this:r103_17
|
||||
# 103| mu103_20(unknown) = ^CallSideEffect : ~m?
|
||||
# 103| v103_21(void) = ^IndirectReadSideEffect[-1] : &:r103_17, ~m?
|
||||
# 103| mu103_22(ClassWithDestructor2) = ^IndirectMayWriteSideEffect[-1] : &:r103_17
|
||||
# 104| v104_1(void) = NoOp :
|
||||
# 102| v102_6(void) = ReturnVoid :
|
||||
# 102| v102_7(void) = AliasedUse : ~m?
|
||||
# 102| v102_8(void) = ExitFunction :
|
||||
|
||||
ir.c:
|
||||
# 7| void MyCoordsTest(int)
|
||||
# 7| Block 0
|
||||
|
|
Загрузка…
Ссылка в новой задаче