Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 805b4d6

Browse files
committed
C++: Add a failing testcase.
1 parent 774efb5 commit 805b4d6

10 files changed

Lines changed: 98 additions & 0 deletions

cpp/ql/test/library-tests/ir/ir/PrintAST.expected

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20198,6 +20198,28 @@ ir.cpp:
2019820198
# 2430| Type = [ClassTemplateInstantiation,Struct] iterator<random_access_iterator_tag, char, ptrdiff_t, char *, char &>
2019920199
# 2430| ValueCategory = lvalue
2020020200
# 2432| getStmt(6): [ReturnStmt] return ...
20201+
# 2434| [TopLevelFunction] void rethrow_with_destruction(int)
20202+
# 2434| <params>:
20203+
# 2434| getParameter(0): [Parameter] x
20204+
# 2434| Type = [IntType] int
20205+
# 2434| getEntryPoint(): [BlockStmt] { ... }
20206+
# 2435| getStmt(0): [DeclStmt] declaration
20207+
# 2435| getDeclarationEntry(0): [VariableDeclarationEntry] definition of c
20208+
# 2435| Type = [Class] ClassWithDestructor
20209+
# 2435| getVariable().getInitializer(): [Initializer] initializer for c
20210+
# 2435| getExpr(): [ConstructorCall] call to ClassWithDestructor
20211+
# 2435| Type = [VoidType] void
20212+
# 2435| ValueCategory = prvalue
20213+
# 2436| getStmt(1): [ExprStmt] ExprStmt
20214+
# 2436| getExpr(): [ReThrowExpr] re-throw exception
20215+
# 2436| Type = [VoidType] void
20216+
# 2436| ValueCategory = prvalue
20217+
# 2437| getImplicitDestructorCall(0): [DestructorCall] call to ~ClassWithDestructor
20218+
# 2437| Type = [VoidType] void
20219+
# 2437| ValueCategory = prvalue
20220+
# 2437| getQualifier(): [VariableAccess] c
20221+
# 2437| Type = [Class] ClassWithDestructor
20222+
# 2437| ValueCategory = lvalue
2020120223
perf-regression.cpp:
2020220224
# 4| [CopyAssignmentOperator] Big& Big::operator=(Big const&)
2020320225
# 4| <params>:

cpp/ql/test/library-tests/ir/ir/aliased_ir.expected

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15901,6 +15901,24 @@ ir.cpp:
1590115901
# 2410| Block 13
1590215902
# 2410| v2410_8(void) = Unreached :
1590315903

15904+
# 2434| void rethrow_with_destruction(int)
15905+
# 2434| Block 0
15906+
# 2434| v2434_1(void) = EnterFunction :
15907+
# 2434| m2434_2(unknown) = AliasedDefinition :
15908+
# 2434| m2434_3(unknown) = InitializeNonLocal :
15909+
# 2434| m2434_4(unknown) = Chi : total:m2434_2, partial:m2434_3
15910+
# 2434| r2434_5(glval<int>) = VariableAddress[x] :
15911+
# 2434| m2434_6(int) = InitializeParameter[x] : &:r2434_5
15912+
# 2435| r2435_1(glval<ClassWithDestructor>) = VariableAddress[c] :
15913+
# 2435| m2435_2(ClassWithDestructor) = Uninitialized[c] : &:r2435_1
15914+
# 2435| r2435_3(glval<unknown>) = FunctionAddress[ClassWithDestructor] :
15915+
# 2435| v2435_4(void) = Call[ClassWithDestructor] : func:r2435_3, this:r2435_1
15916+
# 2435| m2435_5(unknown) = ^CallSideEffect : ~m2434_4
15917+
# 2435| m2435_6(unknown) = Chi : total:m2434_4, partial:m2435_5
15918+
# 2435| m2435_7(ClassWithDestructor) = ^IndirectMayWriteSideEffect[-1] : &:r2435_1
15919+
# 2435| m2435_8(ClassWithDestructor) = Chi : total:m2435_2, partial:m2435_7
15920+
# 2436| v2436_1(void) = ReThrow :
15921+
1590415922
perf-regression.cpp:
1590515923
# 6| void Big::Big()
1590615924
# 6| Block 0

cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ missingOperandType
66
duplicateChiOperand
77
sideEffectWithoutPrimary
88
instructionWithoutSuccessor
9+
| ir.cpp:2436:5:2436:9 | ReThrow: re-throw exception | Instruction 'ReThrow: re-throw exception ' has no successors in function '$@'. | ir.cpp:2434:6:2434:29 | void rethrow_with_destruction(int) | void rethrow_with_destruction(int) |
910
ambiguousSuccessors
1011
unexplainedLoop
1112
unnecessaryPhiInstruction

cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ missingOperandType
99
duplicateChiOperand
1010
sideEffectWithoutPrimary
1111
instructionWithoutSuccessor
12+
| ir.cpp:2436:5:2436:9 | ReThrow: re-throw exception | Instruction 'ReThrow: re-throw exception ' has no successors in function '$@'. | ir.cpp:2434:6:2434:29 | void rethrow_with_destruction(int) | void rethrow_with_destruction(int) |
1213
ambiguousSuccessors
1314
unexplainedLoop
1415
unnecessaryPhiInstruction

cpp/ql/test/library-tests/ir/ir/ir.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2431,4 +2431,9 @@ void initialization_with_temp_destructor() {
24312431
y += x;
24322432
}
24332433

2434+
void rethrow_with_destruction(int x) {
2435+
ClassWithDestructor c;
2436+
throw;
2437+
}
2438+
24342439
// semmle-extractor-options: -std=c++20 --clang

cpp/ql/test/library-tests/ir/ir/operand_locations.expected

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13367,6 +13367,18 @@
1336713367
| ir.cpp:2431:14:2431:14 | Load | m2430_25 |
1336813368
| ir.cpp:2431:14:2431:14 | Right | r2431_3 |
1336913369
| ir.cpp:2431:14:2431:14 | Unary | r2431_2 |
13370+
| ir.cpp:2434:6:2434:29 | ChiPartial | partial:m2434_3 |
13371+
| ir.cpp:2434:6:2434:29 | ChiTotal | total:m2434_2 |
13372+
| ir.cpp:2434:35:2434:35 | Address | &:r2434_5 |
13373+
| ir.cpp:2435:25:2435:25 | Address | &:r2435_1 |
13374+
| ir.cpp:2435:25:2435:25 | Address | &:r2435_1 |
13375+
| ir.cpp:2435:25:2435:25 | Arg(this) | this:r2435_1 |
13376+
| ir.cpp:2435:25:2435:25 | CallTarget | func:r2435_3 |
13377+
| ir.cpp:2435:25:2435:25 | ChiPartial | partial:m2435_5 |
13378+
| ir.cpp:2435:25:2435:25 | ChiPartial | partial:m2435_7 |
13379+
| ir.cpp:2435:25:2435:25 | ChiTotal | total:m2434_4 |
13380+
| ir.cpp:2435:25:2435:25 | ChiTotal | total:m2435_2 |
13381+
| ir.cpp:2435:25:2435:25 | SideEffect | ~m2434_4 |
1337013382
| perf-regression.cpp:6:3:6:5 | Address | &:r6_5 |
1337113383
| perf-regression.cpp:6:3:6:5 | Address | &:r6_5 |
1337213384
| perf-regression.cpp:6:3:6:5 | Address | &:r6_7 |

cpp/ql/test/library-tests/ir/ir/raw_consistency.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ missingOperandType
66
duplicateChiOperand
77
sideEffectWithoutPrimary
88
instructionWithoutSuccessor
9+
| ir.cpp:2436:5:2436:9 | ReThrow: re-throw exception | Instruction 'ReThrow: re-throw exception ' has no successors in function '$@'. | ir.cpp:2434:6:2434:29 | void rethrow_with_destruction(int) | void rethrow_with_destruction(int) |
10+
| ir.cpp:2437:1:2437:1 | IndirectMayWriteSideEffect: c | Instruction 'IndirectMayWriteSideEffect: c' has no successors in function '$@'. | ir.cpp:2434:6:2434:29 | void rethrow_with_destruction(int) | void rethrow_with_destruction(int) |
911
ambiguousSuccessors
1012
unexplainedLoop
1113
unnecessaryPhiInstruction

cpp/ql/test/library-tests/ir/ir/raw_ir.expected

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14644,6 +14644,41 @@ ir.cpp:
1464414644
# 2410| v2410_5(void) = AliasedUse : ~m?
1464514645
# 2410| v2410_6(void) = ExitFunction :
1464614646

14647+
# 2434| void rethrow_with_destruction(int)
14648+
# 2434| Block 0
14649+
# 2434| v2434_1(void) = EnterFunction :
14650+
# 2434| mu2434_2(unknown) = AliasedDefinition :
14651+
# 2434| mu2434_3(unknown) = InitializeNonLocal :
14652+
# 2434| r2434_4(glval<int>) = VariableAddress[x] :
14653+
# 2434| mu2434_5(int) = InitializeParameter[x] : &:r2434_4
14654+
# 2435| r2435_1(glval<ClassWithDestructor>) = VariableAddress[c] :
14655+
# 2435| mu2435_2(ClassWithDestructor) = Uninitialized[c] : &:r2435_1
14656+
# 2435| r2435_3(glval<unknown>) = FunctionAddress[ClassWithDestructor] :
14657+
# 2435| v2435_4(void) = Call[ClassWithDestructor] : func:r2435_3, this:r2435_1
14658+
# 2435| mu2435_5(unknown) = ^CallSideEffect : ~m?
14659+
# 2435| mu2435_6(ClassWithDestructor) = ^IndirectMayWriteSideEffect[-1] : &:r2435_1
14660+
# 2436| v2436_1(void) = ReThrow :
14661+
14662+
# 2434| Block 1
14663+
# 2434| v2434_6(void) = AliasedUse : ~m?
14664+
# 2434| v2434_7(void) = ExitFunction :
14665+
14666+
# 2434| Block 2
14667+
# 2434| v2434_8(void) = ReturnVoid :
14668+
#-----| Goto -> Block 1
14669+
14670+
# 2434| Block 3
14671+
# 2434| v2434_9(void) = Unwind :
14672+
#-----| Goto -> Block 1
14673+
14674+
# 2437| Block 4
14675+
# 2437| r2437_1(glval<ClassWithDestructor>) = VariableAddress[c] :
14676+
# 2437| r2437_2(glval<unknown>) = FunctionAddress[~ClassWithDestructor] :
14677+
# 2437| v2437_3(void) = Call[~ClassWithDestructor] : func:r2437_2, this:r2437_1
14678+
# 2437| mu2437_4(unknown) = ^CallSideEffect : ~m?
14679+
# 2437| v2437_5(void) = ^IndirectReadSideEffect[-1] : &:r2437_1, ~m?
14680+
# 2437| mu2437_6(ClassWithDestructor) = ^IndirectMayWriteSideEffect[-1] : &:r2437_1
14681+
1464714682
perf-regression.cpp:
1464814683
# 6| void Big::Big()
1464914684
# 6| Block 0

cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ missingOperandType
66
duplicateChiOperand
77
sideEffectWithoutPrimary
88
instructionWithoutSuccessor
9+
| ir.cpp:2436:5:2436:9 | ReThrow: re-throw exception | Instruction 'ReThrow: re-throw exception ' has no successors in function '$@'. | ir.cpp:2434:6:2434:29 | void rethrow_with_destruction(int) | void rethrow_with_destruction(int) |
910
ambiguousSuccessors
1011
unexplainedLoop
1112
unnecessaryPhiInstruction

cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ missingOperandType
66
duplicateChiOperand
77
sideEffectWithoutPrimary
88
instructionWithoutSuccessor
9+
| ir.cpp:2436:5:2436:9 | ReThrow: re-throw exception | Instruction 'ReThrow: re-throw exception ' has no successors in function '$@'. | ir.cpp:2434:6:2434:29 | void rethrow_with_destruction(int) | void rethrow_with_destruction(int) |
910
ambiguousSuccessors
1011
unexplainedLoop
1112
unnecessaryPhiInstruction

0 commit comments

Comments
 (0)