mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
Merge pull request #13666 from jketema/ir-test
C++: Add IR tests that cause regressions after extractor frontend update
This commit is contained in:
@@ -14462,6 +14462,106 @@ ir.cpp:
|
||||
# 1911| getExpr(): [VariableAccess] x
|
||||
# 1911| Type = [IntType] int
|
||||
# 1911| ValueCategory = prvalue(load)
|
||||
# 1914| [TopLevelFunction] int static_function(int)
|
||||
# 1914| <params>:
|
||||
# 1914| getParameter(0): [Parameter] x
|
||||
# 1914| Type = [IntType] int
|
||||
# 1914| getEntryPoint(): [BlockStmt] { ... }
|
||||
# 1915| getStmt(0): [ReturnStmt] return ...
|
||||
# 1915| getExpr(): [VariableAccess] x
|
||||
# 1915| Type = [IntType] int
|
||||
# 1915| ValueCategory = prvalue(load)
|
||||
# 1918| [TopLevelFunction] void test_static_functions_with_assignments()
|
||||
# 1918| <params>:
|
||||
# 1918| getEntryPoint(): [BlockStmt] { ... }
|
||||
# 1919| getStmt(0): [DeclStmt] declaration
|
||||
# 1919| getDeclarationEntry(0): [VariableDeclarationEntry] definition of c
|
||||
# 1919| Type = [Class] C
|
||||
# 1919| getVariable().getInitializer(): [Initializer] initializer for c
|
||||
# 1919| getExpr(): [ConstructorCall] call to C
|
||||
# 1919| Type = [VoidType] void
|
||||
# 1919| ValueCategory = prvalue
|
||||
# 1920| getStmt(1): [DeclStmt] declaration
|
||||
# 1920| getDeclarationEntry(0): [VariableDeclarationEntry] definition of x
|
||||
# 1920| Type = [IntType] int
|
||||
# 1921| getStmt(2): [ExprStmt] ExprStmt
|
||||
# 1921| getExpr(): [AssignExpr] ... = ...
|
||||
# 1921| Type = [IntType] int
|
||||
# 1921| ValueCategory = lvalue
|
||||
# 1921| getLValue(): [VariableAccess] x
|
||||
# 1921| Type = [IntType] int
|
||||
# 1921| ValueCategory = lvalue
|
||||
# 1921| getRValue(): [FunctionCall] call to StaticMemberFunction
|
||||
# 1921| Type = [IntType] int
|
||||
# 1921| ValueCategory = prvalue
|
||||
# 1921| getQualifier(): [VariableAccess] c
|
||||
# 1921| Type = [Class] C
|
||||
# 1921| ValueCategory = lvalue
|
||||
# 1921| getArgument(0): [Literal] 10
|
||||
# 1921| Type = [IntType] int
|
||||
# 1921| Value = [Literal] 10
|
||||
# 1921| ValueCategory = prvalue
|
||||
# 1922| getStmt(3): [DeclStmt] declaration
|
||||
# 1922| getDeclarationEntry(0): [VariableDeclarationEntry] definition of y
|
||||
# 1922| Type = [IntType] int
|
||||
# 1923| getStmt(4): [ExprStmt] ExprStmt
|
||||
# 1923| getExpr(): [AssignExpr] ... = ...
|
||||
# 1923| Type = [IntType] int
|
||||
# 1923| ValueCategory = lvalue
|
||||
# 1923| getLValue(): [VariableAccess] y
|
||||
# 1923| Type = [IntType] int
|
||||
# 1923| ValueCategory = lvalue
|
||||
# 1923| getRValue(): [FunctionCall] call to StaticMemberFunction
|
||||
# 1923| Type = [IntType] int
|
||||
# 1923| ValueCategory = prvalue
|
||||
# 1923| getArgument(0): [Literal] 10
|
||||
# 1923| Type = [IntType] int
|
||||
# 1923| Value = [Literal] 10
|
||||
# 1923| ValueCategory = prvalue
|
||||
# 1924| getStmt(5): [DeclStmt] declaration
|
||||
# 1924| getDeclarationEntry(0): [VariableDeclarationEntry] definition of z
|
||||
# 1924| Type = [IntType] int
|
||||
# 1925| getStmt(6): [ExprStmt] ExprStmt
|
||||
# 1925| getExpr(): [AssignExpr] ... = ...
|
||||
# 1925| Type = [IntType] int
|
||||
# 1925| ValueCategory = lvalue
|
||||
# 1925| getLValue(): [VariableAccess] z
|
||||
# 1925| Type = [IntType] int
|
||||
# 1925| ValueCategory = lvalue
|
||||
# 1925| getRValue(): [FunctionCall] call to static_function
|
||||
# 1925| Type = [IntType] int
|
||||
# 1925| ValueCategory = prvalue
|
||||
# 1925| getArgument(0): [Literal] 10
|
||||
# 1925| Type = [IntType] int
|
||||
# 1925| Value = [Literal] 10
|
||||
# 1925| ValueCategory = prvalue
|
||||
# 1926| getStmt(7): [ReturnStmt] return ...
|
||||
# 1928| [TopLevelFunction] void test_double_assign()
|
||||
# 1928| <params>:
|
||||
# 1928| getEntryPoint(): [BlockStmt] { ... }
|
||||
# 1929| getStmt(0): [DeclStmt] declaration
|
||||
# 1929| getDeclarationEntry(0): [VariableDeclarationEntry] definition of i
|
||||
# 1929| Type = [IntType] int
|
||||
# 1929| getDeclarationEntry(1): [VariableDeclarationEntry] definition of j
|
||||
# 1929| Type = [IntType] int
|
||||
# 1930| getStmt(1): [ExprStmt] ExprStmt
|
||||
# 1930| getExpr(): [AssignExpr] ... = ...
|
||||
# 1930| Type = [IntType] int
|
||||
# 1930| ValueCategory = lvalue
|
||||
# 1930| getLValue(): [VariableAccess] i
|
||||
# 1930| Type = [IntType] int
|
||||
# 1930| ValueCategory = lvalue
|
||||
# 1930| getRValue(): [AssignExpr] ... = ...
|
||||
# 1930| Type = [IntType] int
|
||||
# 1930| ValueCategory = prvalue
|
||||
# 1930| getLValue(): [VariableAccess] j
|
||||
# 1930| Type = [IntType] int
|
||||
# 1930| ValueCategory = lvalue
|
||||
# 1930| getRValue(): [Literal] 40
|
||||
# 1930| Type = [IntType] int
|
||||
# 1930| Value = [Literal] 40
|
||||
# 1930| ValueCategory = prvalue
|
||||
# 1931| getStmt(2): [ReturnStmt] return ...
|
||||
perf-regression.cpp:
|
||||
# 4| [CopyAssignmentOperator] Big& Big::operator=(Big const&)
|
||||
# 4| <params>:
|
||||
|
||||
@@ -1911,4 +1911,23 @@ int noreturnTest2(int x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
int static_function(int x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
void test_static_functions_with_assignments() {
|
||||
C c;
|
||||
int x;
|
||||
x = c.StaticMemberFunction(10);
|
||||
int y;
|
||||
y = C::StaticMemberFunction(10);
|
||||
int z;
|
||||
z = static_function(10);
|
||||
}
|
||||
|
||||
void test_double_assign() {
|
||||
int i, j;
|
||||
i = j = 40;
|
||||
}
|
||||
|
||||
// semmle-extractor-options: -std=c++17 --clang
|
||||
|
||||
@@ -8821,6 +8821,62 @@
|
||||
| ir.cpp:1911:12:1911:12 | Address | &:r1911_2 |
|
||||
| ir.cpp:1911:12:1911:12 | Load | m1907_6 |
|
||||
| ir.cpp:1911:12:1911:12 | StoreValue | r1911_3 |
|
||||
| ir.cpp:1914:5:1914:19 | Address | &:r1914_7 |
|
||||
| ir.cpp:1914:5:1914:19 | ChiPartial | partial:m1914_3 |
|
||||
| ir.cpp:1914:5:1914:19 | ChiTotal | total:m1914_2 |
|
||||
| ir.cpp:1914:5:1914:19 | Load | m1915_4 |
|
||||
| ir.cpp:1914:5:1914:19 | SideEffect | m1914_3 |
|
||||
| ir.cpp:1914:25:1914:25 | Address | &:r1914_5 |
|
||||
| ir.cpp:1915:5:1915:13 | Address | &:r1915_1 |
|
||||
| ir.cpp:1915:12:1915:12 | Address | &:r1915_2 |
|
||||
| ir.cpp:1915:12:1915:12 | Load | m1914_6 |
|
||||
| ir.cpp:1915:12:1915:12 | StoreValue | r1915_3 |
|
||||
| ir.cpp:1918:6:1918:43 | ChiPartial | partial:m1918_3 |
|
||||
| ir.cpp:1918:6:1918:43 | ChiTotal | total:m1918_2 |
|
||||
| ir.cpp:1918:6:1918:43 | SideEffect | ~m1925_5 |
|
||||
| ir.cpp:1919:7:1919:7 | Address | &:r1919_1 |
|
||||
| ir.cpp:1919:7:1919:7 | Address | &:r1919_1 |
|
||||
| ir.cpp:1919:7:1919:7 | Arg(this) | this:r1919_1 |
|
||||
| ir.cpp:1919:7:1919:7 | CallTarget | func:r1919_3 |
|
||||
| ir.cpp:1919:7:1919:7 | ChiPartial | partial:m1919_5 |
|
||||
| ir.cpp:1919:7:1919:7 | ChiPartial | partial:m1919_7 |
|
||||
| ir.cpp:1919:7:1919:7 | ChiTotal | total:m1918_4 |
|
||||
| ir.cpp:1919:7:1919:7 | ChiTotal | total:m1919_2 |
|
||||
| ir.cpp:1919:7:1919:7 | SideEffect | ~m1918_4 |
|
||||
| ir.cpp:1920:9:1920:9 | Address | &:r1920_1 |
|
||||
| ir.cpp:1921:5:1921:5 | Address | &:r1921_7 |
|
||||
| ir.cpp:1921:11:1921:30 | CallTarget | func:r1921_2 |
|
||||
| ir.cpp:1921:11:1921:30 | ChiPartial | partial:m1921_5 |
|
||||
| ir.cpp:1921:11:1921:30 | ChiTotal | total:m1919_6 |
|
||||
| ir.cpp:1921:11:1921:30 | SideEffect | ~m1919_6 |
|
||||
| ir.cpp:1921:11:1921:30 | StoreValue | r1921_4 |
|
||||
| ir.cpp:1921:32:1921:33 | Arg(0) | 0:r1921_3 |
|
||||
| ir.cpp:1922:9:1922:9 | Address | &:r1922_1 |
|
||||
| ir.cpp:1923:5:1923:5 | Address | &:r1923_6 |
|
||||
| ir.cpp:1923:9:1923:31 | CallTarget | func:r1923_1 |
|
||||
| ir.cpp:1923:9:1923:31 | ChiPartial | partial:m1923_4 |
|
||||
| ir.cpp:1923:9:1923:31 | ChiTotal | total:m1921_6 |
|
||||
| ir.cpp:1923:9:1923:31 | SideEffect | ~m1921_6 |
|
||||
| ir.cpp:1923:9:1923:31 | StoreValue | r1923_3 |
|
||||
| ir.cpp:1923:33:1923:34 | Arg(0) | 0:r1923_2 |
|
||||
| ir.cpp:1924:9:1924:9 | Address | &:r1924_1 |
|
||||
| ir.cpp:1925:5:1925:5 | Address | &:r1925_6 |
|
||||
| ir.cpp:1925:9:1925:23 | CallTarget | func:r1925_1 |
|
||||
| ir.cpp:1925:9:1925:23 | ChiPartial | partial:m1925_4 |
|
||||
| ir.cpp:1925:9:1925:23 | ChiTotal | total:m1923_5 |
|
||||
| ir.cpp:1925:9:1925:23 | SideEffect | ~m1923_5 |
|
||||
| ir.cpp:1925:9:1925:23 | StoreValue | r1925_3 |
|
||||
| ir.cpp:1925:25:1925:26 | Arg(0) | 0:r1925_2 |
|
||||
| ir.cpp:1928:6:1928:23 | ChiPartial | partial:m1928_3 |
|
||||
| ir.cpp:1928:6:1928:23 | ChiTotal | total:m1928_2 |
|
||||
| ir.cpp:1928:6:1928:23 | SideEffect | m1928_3 |
|
||||
| ir.cpp:1929:7:1929:7 | Address | &:r1929_1 |
|
||||
| ir.cpp:1929:10:1929:10 | Address | &:r1929_3 |
|
||||
| ir.cpp:1930:3:1930:3 | Address | &:r1930_5 |
|
||||
| ir.cpp:1930:7:1930:7 | Address | &:r1930_2 |
|
||||
| ir.cpp:1930:7:1930:12 | StoreValue | r1930_4 |
|
||||
| ir.cpp:1930:11:1930:12 | StoreValue | r1930_1 |
|
||||
| ir.cpp:1930:11:1930:12 | Unary | r1930_1 |
|
||||
| perf-regression.cpp:6:3:6:5 | Address | &:r6_5 |
|
||||
| perf-regression.cpp:6:3:6:5 | Address | &:r6_5 |
|
||||
| perf-regression.cpp:6:3:6:5 | Address | &:r6_7 |
|
||||
|
||||
@@ -10167,6 +10167,83 @@ ir.cpp:
|
||||
# 1907| v1907_9(void) = AliasedUse : ~m?
|
||||
# 1907| v1907_10(void) = ExitFunction :
|
||||
|
||||
# 1914| int static_function(int)
|
||||
# 1914| Block 0
|
||||
# 1914| v1914_1(void) = EnterFunction :
|
||||
# 1914| mu1914_2(unknown) = AliasedDefinition :
|
||||
# 1914| mu1914_3(unknown) = InitializeNonLocal :
|
||||
# 1914| r1914_4(glval<int>) = VariableAddress[x] :
|
||||
# 1914| mu1914_5(int) = InitializeParameter[x] : &:r1914_4
|
||||
# 1915| r1915_1(glval<int>) = VariableAddress[#return] :
|
||||
# 1915| r1915_2(glval<int>) = VariableAddress[x] :
|
||||
# 1915| r1915_3(int) = Load[x] : &:r1915_2, ~m?
|
||||
# 1915| mu1915_4(int) = Store[#return] : &:r1915_1, r1915_3
|
||||
# 1914| r1914_6(glval<int>) = VariableAddress[#return] :
|
||||
# 1914| v1914_7(void) = ReturnValue : &:r1914_6, ~m?
|
||||
# 1914| v1914_8(void) = AliasedUse : ~m?
|
||||
# 1914| v1914_9(void) = ExitFunction :
|
||||
|
||||
# 1918| void test_static_functions_with_assignments()
|
||||
# 1918| Block 0
|
||||
# 1918| v1918_1(void) = EnterFunction :
|
||||
# 1918| mu1918_2(unknown) = AliasedDefinition :
|
||||
# 1918| mu1918_3(unknown) = InitializeNonLocal :
|
||||
# 1919| r1919_1(glval<C>) = VariableAddress[c] :
|
||||
# 1919| mu1919_2(C) = Uninitialized[c] : &:r1919_1
|
||||
# 1919| r1919_3(glval<unknown>) = FunctionAddress[C] :
|
||||
# 1919| v1919_4(void) = Call[C] : func:r1919_3, this:r1919_1
|
||||
# 1919| mu1919_5(unknown) = ^CallSideEffect : ~m?
|
||||
# 1919| mu1919_6(C) = ^IndirectMayWriteSideEffect[-1] : &:r1919_1
|
||||
# 1920| r1920_1(glval<int>) = VariableAddress[x] :
|
||||
# 1920| mu1920_2(int) = Uninitialized[x] : &:r1920_1
|
||||
# 1921| r1921_1(glval<C>) = VariableAddress[c] :
|
||||
# 1921| r1921_2(glval<unknown>) = FunctionAddress[StaticMemberFunction] :
|
||||
# 1921| r1921_3(int) = Constant[10] :
|
||||
# 1921| r1921_4(int) = Call[StaticMemberFunction] : func:r1921_2, 0:r1921_3
|
||||
# 1921| mu1921_5(unknown) = ^CallSideEffect : ~m?
|
||||
# 1921| r1921_6(glval<int>) = VariableAddress[x] :
|
||||
# 1921| mu1921_7(int) = Store[x] : &:r1921_6, r1921_4
|
||||
# 1922| r1922_1(glval<int>) = VariableAddress[y] :
|
||||
# 1922| mu1922_2(int) = Uninitialized[y] : &:r1922_1
|
||||
# 1923| r1923_1(glval<unknown>) = FunctionAddress[StaticMemberFunction] :
|
||||
# 1923| r1923_2(int) = Constant[10] :
|
||||
# 1923| r1923_3(int) = Call[StaticMemberFunction] : func:r1923_1, 0:r1923_2
|
||||
# 1923| mu1923_4(unknown) = ^CallSideEffect : ~m?
|
||||
# 1923| r1923_5(glval<int>) = VariableAddress[y] :
|
||||
# 1923| mu1923_6(int) = Store[y] : &:r1923_5, r1923_3
|
||||
# 1924| r1924_1(glval<int>) = VariableAddress[z] :
|
||||
# 1924| mu1924_2(int) = Uninitialized[z] : &:r1924_1
|
||||
# 1925| r1925_1(glval<unknown>) = FunctionAddress[static_function] :
|
||||
# 1925| r1925_2(int) = Constant[10] :
|
||||
# 1925| r1925_3(int) = Call[static_function] : func:r1925_1, 0:r1925_2
|
||||
# 1925| mu1925_4(unknown) = ^CallSideEffect : ~m?
|
||||
# 1925| r1925_5(glval<int>) = VariableAddress[z] :
|
||||
# 1925| mu1925_6(int) = Store[z] : &:r1925_5, r1925_3
|
||||
# 1926| v1926_1(void) = NoOp :
|
||||
# 1918| v1918_4(void) = ReturnVoid :
|
||||
# 1918| v1918_5(void) = AliasedUse : ~m?
|
||||
# 1918| v1918_6(void) = ExitFunction :
|
||||
|
||||
# 1928| void test_double_assign()
|
||||
# 1928| Block 0
|
||||
# 1928| v1928_1(void) = EnterFunction :
|
||||
# 1928| mu1928_2(unknown) = AliasedDefinition :
|
||||
# 1928| mu1928_3(unknown) = InitializeNonLocal :
|
||||
# 1929| r1929_1(glval<int>) = VariableAddress[i] :
|
||||
# 1929| mu1929_2(int) = Uninitialized[i] : &:r1929_1
|
||||
# 1929| r1929_3(glval<int>) = VariableAddress[j] :
|
||||
# 1929| mu1929_4(int) = Uninitialized[j] : &:r1929_3
|
||||
# 1930| r1930_1(int) = Constant[40] :
|
||||
# 1930| r1930_2(glval<int>) = VariableAddress[j] :
|
||||
# 1930| mu1930_3(int) = Store[j] : &:r1930_2, r1930_1
|
||||
# 1930| r1930_4(int) = CopyValue : r1930_1
|
||||
# 1930| r1930_5(glval<int>) = VariableAddress[i] :
|
||||
# 1930| mu1930_6(int) = Store[i] : &:r1930_5, r1930_4
|
||||
# 1931| v1931_1(void) = NoOp :
|
||||
# 1928| v1928_4(void) = ReturnVoid :
|
||||
# 1928| v1928_5(void) = AliasedUse : ~m?
|
||||
# 1928| v1928_6(void) = ExitFunction :
|
||||
|
||||
perf-regression.cpp:
|
||||
# 6| void Big::Big()
|
||||
# 6| Block 0
|
||||
|
||||
Reference in New Issue
Block a user