mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
C++: Add a test.
This commit is contained in:
@@ -1815,6 +1815,42 @@ ir.c:
|
||||
# 15| Type = [CharPointerType] char *
|
||||
# 15| ValueCategory = prvalue
|
||||
# 16| getStmt(1): [ReturnStmt] return ...
|
||||
# 18| [TopLevelFunction] void ExRaiseAccessViolation(int)
|
||||
# 18| <params>:
|
||||
# 18| getParameter(0): [Parameter] (unnamed parameter 0)
|
||||
# 18| Type = [IntType] int
|
||||
# 21| [TopLevelFunction] int TryExceptTest(int)
|
||||
# 21| <params>:
|
||||
# 21| getParameter(0): [Parameter] x
|
||||
# 21| Type = [IntType] int
|
||||
# 21| getEntryPoint(): [BlockStmt] { ... }
|
||||
# 22| getStmt(0): [DeclStmt] declaration
|
||||
# 22| getDeclarationEntry(0): [VariableDeclarationEntry] definition of localPtr
|
||||
# 22| Type = [IntPointerType] int *
|
||||
# 24| getStmt(1): [MicrosoftTryExceptStmt] __try { ... } __except( ... ) { ... }
|
||||
# 24| getStmt(): [BlockStmt] { ... }
|
||||
# 25| getStmt(0): [ExprStmt] ExprStmt
|
||||
# 25| getExpr(): [FunctionCall] call to ExRaiseAccessViolation
|
||||
# 25| Type = [VoidType] void
|
||||
# 25| ValueCategory = prvalue
|
||||
# 25| getArgument(0): [VariableAccess] x
|
||||
# 25| Type = [IntType] int
|
||||
# 25| ValueCategory = prvalue(load)
|
||||
# 26| getCondition(): [Literal] 1
|
||||
# 26| Type = [IntType] int
|
||||
# 26| Value = [Literal] 1
|
||||
# 26| ValueCategory = prvalue
|
||||
# 26| getExcept(): [BlockStmt] { ... }
|
||||
# 27| getStmt(0): [ReturnStmt] return ...
|
||||
# 27| getExpr(): [Literal] 1
|
||||
# 27| Type = [IntType] int
|
||||
# 27| Value = [Literal] 1
|
||||
# 27| ValueCategory = prvalue
|
||||
# 29| getStmt(2): [ReturnStmt] return ...
|
||||
# 29| getExpr(): [Literal] 0
|
||||
# 29| Type = [IntType] int
|
||||
# 29| Value = [Literal] 0
|
||||
# 29| ValueCategory = prvalue
|
||||
ir.cpp:
|
||||
# 1| [TopLevelFunction] void Constants()
|
||||
# 1| <params>:
|
||||
|
||||
@@ -809,6 +809,33 @@ ir.c:
|
||||
# 13| v13_11(void) = AliasedUse : m13_3
|
||||
# 13| v13_12(void) = ExitFunction :
|
||||
|
||||
# 21| int TryExceptTest(int)
|
||||
# 21| Block 0
|
||||
# 21| v21_1(void) = EnterFunction :
|
||||
# 21| m21_2(unknown) = AliasedDefinition :
|
||||
# 21| m21_3(unknown) = InitializeNonLocal :
|
||||
# 21| m21_4(unknown) = Chi : total:m21_2, partial:m21_3
|
||||
# 21| r21_5(glval<int>) = VariableAddress[x] :
|
||||
# 21| m21_6(int) = InitializeParameter[x] : &:r21_5
|
||||
# 22| r22_1(glval<int *>) = VariableAddress[localPtr] :
|
||||
# 22| m22_2(int *) = Uninitialized[localPtr] : &:r22_1
|
||||
# 25| r25_1(glval<unknown>) = FunctionAddress[ExRaiseAccessViolation] :
|
||||
# 25| r25_2(glval<int>) = VariableAddress[x] :
|
||||
# 25| r25_3(int) = Load[x] : &:r25_2, m21_6
|
||||
# 25| v25_4(void) = Call[ExRaiseAccessViolation] : func:r25_1, 0:r25_3
|
||||
# 25| m25_5(unknown) = ^CallSideEffect : ~m21_4
|
||||
# 25| m25_6(unknown) = Chi : total:m21_4, partial:m25_5
|
||||
# 29| r29_1(glval<int>) = VariableAddress[#return] :
|
||||
# 29| r29_2(int) = Constant[0] :
|
||||
# 29| m29_3(int) = Store[#return] : &:r29_1, r29_2
|
||||
# 21| r21_7(glval<int>) = VariableAddress[#return] :
|
||||
# 21| v21_8(void) = ReturnValue : &:r21_7, m29_3
|
||||
# 21| v21_9(void) = AliasedUse : ~m25_6
|
||||
# 21| v21_10(void) = ExitFunction :
|
||||
|
||||
# 21| Block 1
|
||||
# 21| v21_11(void) = Unreached :
|
||||
|
||||
ir.cpp:
|
||||
# 1| void Constants()
|
||||
# 1| Block 0
|
||||
|
||||
@@ -15,4 +15,18 @@ void CStyleCast(void *src)
|
||||
char *dst = (char*)src;
|
||||
}
|
||||
|
||||
void ExRaiseAccessViolation(int);
|
||||
#define EXCEPTION_EXECUTE_HANDLER 1
|
||||
|
||||
int TryExceptTest(int x) {
|
||||
int *localPtr;
|
||||
|
||||
__try {
|
||||
ExRaiseAccessViolation(x);
|
||||
} __except(EXCEPTION_EXECUTE_HANDLER) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// semmle-extractor-options: --microsoft
|
||||
|
||||
@@ -1005,6 +1005,22 @@
|
||||
| ir.c:15:24:15:26 | Address | &:r15_2 |
|
||||
| ir.c:15:24:15:26 | Load | m13_6 |
|
||||
| ir.c:15:24:15:26 | Unary | r15_3 |
|
||||
| ir.c:21:5:21:17 | Address | &:r21_7 |
|
||||
| ir.c:21:5:21:17 | ChiPartial | partial:m21_3 |
|
||||
| ir.c:21:5:21:17 | ChiTotal | total:m21_2 |
|
||||
| ir.c:21:5:21:17 | Load | m29_3 |
|
||||
| ir.c:21:5:21:17 | SideEffect | ~m25_6 |
|
||||
| ir.c:21:23:21:23 | Address | &:r21_5 |
|
||||
| ir.c:22:8:22:15 | Address | &:r22_1 |
|
||||
| ir.c:25:5:25:26 | CallTarget | func:r25_1 |
|
||||
| ir.c:25:5:25:26 | ChiPartial | partial:m25_5 |
|
||||
| ir.c:25:5:25:26 | ChiTotal | total:m21_4 |
|
||||
| ir.c:25:5:25:26 | SideEffect | ~m21_4 |
|
||||
| ir.c:25:28:25:28 | Address | &:r25_2 |
|
||||
| ir.c:25:28:25:28 | Arg(0) | 0:r25_3 |
|
||||
| ir.c:25:28:25:28 | Load | m21_6 |
|
||||
| ir.c:29:3:29:11 | Address | &:r29_1 |
|
||||
| ir.c:29:10:29:10 | StoreValue | r29_2 |
|
||||
| ir.cpp:1:6:1:14 | ChiPartial | partial:m1_3 |
|
||||
| ir.cpp:1:6:1:14 | ChiTotal | total:m1_2 |
|
||||
| ir.cpp:1:6:1:14 | SideEffect | m1_3 |
|
||||
|
||||
@@ -20,6 +20,8 @@ multipleIRTypes
|
||||
lostReachability
|
||||
backEdgeCountMismatch
|
||||
useNotDominatedByDefinition
|
||||
| ir.c:26:14:26:38 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | ir.c:21:5:21:17 | int TryExceptTest(int) | int TryExceptTest(int) |
|
||||
| ir.c:26:14:26:38 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | ir.c:21:5:21:17 | int TryExceptTest(int) | int TryExceptTest(int) |
|
||||
| ir.cpp:1486:8:1486:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() |
|
||||
| try_except.c:13:13:13:13 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.c:6:6:6:6 | void f() | void f() |
|
||||
| try_except.c:13:13:13:13 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.c:6:6:6:6 | void f() | void f() |
|
||||
|
||||
@@ -786,6 +786,65 @@ ir.c:
|
||||
# 13| v13_10(void) = AliasedUse : ~m?
|
||||
# 13| v13_11(void) = ExitFunction :
|
||||
|
||||
# 21| int TryExceptTest(int)
|
||||
# 21| Block 0
|
||||
# 21| v21_1(void) = EnterFunction :
|
||||
# 21| mu21_2(unknown) = AliasedDefinition :
|
||||
# 21| mu21_3(unknown) = InitializeNonLocal :
|
||||
# 21| r21_4(glval<int>) = VariableAddress[x] :
|
||||
# 21| mu21_5(int) = InitializeParameter[x] : &:r21_4
|
||||
# 22| r22_1(glval<int *>) = VariableAddress[localPtr] :
|
||||
# 22| mu22_2(int *) = Uninitialized[localPtr] : &:r22_1
|
||||
# 25| r25_1(glval<unknown>) = FunctionAddress[ExRaiseAccessViolation] :
|
||||
# 25| r25_2(glval<int>) = VariableAddress[x] :
|
||||
# 25| r25_3(int) = Load[x] : &:r25_2, ~m?
|
||||
# 25| v25_4(void) = Call[ExRaiseAccessViolation] : func:r25_1, 0:r25_3
|
||||
# 25| mu25_5(unknown) = ^CallSideEffect : ~m?
|
||||
#-----| Goto -> Block 7
|
||||
|
||||
# 21| Block 1
|
||||
# 21| r21_6(glval<int>) = VariableAddress[#return] :
|
||||
# 21| v21_7(void) = ReturnValue : &:r21_6, ~m?
|
||||
# 21| v21_8(void) = AliasedUse : ~m?
|
||||
# 21| v21_9(void) = ExitFunction :
|
||||
|
||||
# 26| Block 2
|
||||
# 26| r26_1(int) = Constant[0] :
|
||||
# 26| r26_2(bool) = CompareEQ : r26_8, r26_1
|
||||
# 26| v26_3(void) = ConditionalBranch : r26_2
|
||||
#-----| False -> Block 3
|
||||
#-----| True -> Block 4
|
||||
|
||||
# 26| Block 3
|
||||
# 26| r26_4(int) = Constant[1] :
|
||||
# 26| r26_5(bool) = CompareEQ : r26_8, r26_4
|
||||
# 26| v26_6(void) = ConditionalBranch : r26_5
|
||||
#-----| True -> Block 6
|
||||
|
||||
# 26| Block 4
|
||||
# 26| v26_7(void) = Unwind :
|
||||
#-----| Goto -> Block 7
|
||||
|
||||
# 26| Block 5
|
||||
# 26| r26_8(int) = Constant[1] :
|
||||
# 26| r26_9(int) = Constant[-1] :
|
||||
# 26| r26_10(bool) = CompareEQ : r26_8, r26_9
|
||||
# 26| v26_11(void) = ConditionalBranch : r26_10
|
||||
#-----| False -> Block 2
|
||||
#-----| True -> Block 4
|
||||
|
||||
# 27| Block 6
|
||||
# 27| r27_1(glval<int>) = VariableAddress[#return] :
|
||||
# 27| r27_2(int) = Constant[1] :
|
||||
# 27| mu27_3(int) = Store[#return] : &:r27_1, r27_2
|
||||
#-----| Goto -> Block 1
|
||||
|
||||
# 29| Block 7
|
||||
# 29| r29_1(glval<int>) = VariableAddress[#return] :
|
||||
# 29| r29_2(int) = Constant[0] :
|
||||
# 29| mu29_3(int) = Store[#return] : &:r29_1, r29_2
|
||||
#-----| Goto -> Block 1
|
||||
|
||||
ir.cpp:
|
||||
# 1| void Constants()
|
||||
# 1| Block 0
|
||||
|
||||
Reference in New Issue
Block a user