mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
C++: Add tests involving various non-const and const smart pointers.
This commit is contained in:
@@ -11445,6 +11445,145 @@ smart_ptr.cpp:
|
||||
# 19| Type = [ClassTemplateInstantiation] shared_ptr<float>
|
||||
# 19| ValueCategory = lvalue
|
||||
# 20| getStmt(2): [ReturnStmt] return ...
|
||||
# 22| [TopLevelFunction] void shared_ptr_const_int(std::shared_ptr<int const>)
|
||||
# 22| <params>:
|
||||
# 22| getParameter(0): [Parameter] (unnamed parameter 0)
|
||||
# 22| Type = [ClassTemplateInstantiation] shared_ptr<const int>
|
||||
# 23| [TopLevelFunction] void shared_ptr_const_int_ptr(std::shared_ptr<int* const>)
|
||||
# 23| <params>:
|
||||
# 23| getParameter(0): [Parameter] (unnamed parameter 0)
|
||||
# 23| Type = [ClassTemplateInstantiation] shared_ptr<int *const>
|
||||
# 24| [TopLevelFunction] void shared_ptr_shared_ptr_const_int(std::shared_ptr<std::shared_ptr<int const>>)
|
||||
# 24| <params>:
|
||||
# 24| getParameter(0): [Parameter] (unnamed parameter 0)
|
||||
# 24| Type = [ClassTemplateInstantiation] shared_ptr<shared_ptr<const int>>
|
||||
# 25| [TopLevelFunction] void shared_ptr_const_shared_ptr_int(std::shared_ptr<std::shared_ptr<int> const>)
|
||||
# 25| <params>:
|
||||
# 25| getParameter(0): [Parameter] (unnamed parameter 0)
|
||||
# 25| Type = [ClassTemplateInstantiation] shared_ptr<const shared_ptr<int>>
|
||||
# 26| [TopLevelFunction] void shared_ptr_const_shared_ptr_const_int(std::shared_ptr<std::shared_ptr<int const> const>)
|
||||
# 26| <params>:
|
||||
# 26| getParameter(0): [Parameter] (unnamed parameter 0)
|
||||
# 26| Type = [ClassTemplateInstantiation] shared_ptr<const shared_ptr<const int>>
|
||||
# 28| [TopLevelFunction] void call_shared_ptr_consts()
|
||||
# 28| <params>:
|
||||
# 28| getEntryPoint(): [BlockStmt] { ... }
|
||||
# 29| getStmt(0): [DeclStmt] declaration
|
||||
# 29| getDeclarationEntry(0): [VariableDeclarationEntry] definition of sp_const_int
|
||||
# 29| Type = [ClassTemplateInstantiation] shared_ptr<const int>
|
||||
# 31| getStmt(1): [ExprStmt] ExprStmt
|
||||
# 31| getExpr(): [FunctionCall] call to shared_ptr_const_int
|
||||
# 31| Type = [VoidType] void
|
||||
# 31| ValueCategory = prvalue
|
||||
# 31| getArgument(0): [ConstructorCall] call to shared_ptr
|
||||
# 31| Type = [VoidType] void
|
||||
# 31| ValueCategory = prvalue
|
||||
# 31| getArgument(0): [VariableAccess] sp_const_int
|
||||
# 31| Type = [ClassTemplateInstantiation] shared_ptr<const int>
|
||||
# 31| ValueCategory = lvalue
|
||||
# 31| getArgument(0).getFullyConverted(): [ReferenceToExpr] (reference to)
|
||||
# 31| Type = [LValueReferenceType] const shared_ptr<const int> &
|
||||
# 31| ValueCategory = prvalue
|
||||
# 31| getExpr(): [CStyleCast] (const shared_ptr<const int>)...
|
||||
# 31| Conversion = [GlvalueConversion] glvalue conversion
|
||||
# 31| Type = [SpecifiedType] const shared_ptr<const int>
|
||||
# 31| ValueCategory = lvalue
|
||||
# 31| getArgument(0).getFullyConverted(): [TemporaryObjectExpr] temporary object
|
||||
# 31| Type = [ClassTemplateInstantiation] shared_ptr<const int>
|
||||
# 31| ValueCategory = lvalue
|
||||
# 33| getStmt(2): [DeclStmt] declaration
|
||||
# 33| getDeclarationEntry(0): [VariableDeclarationEntry] definition of sp_const_int_pointer
|
||||
# 33| Type = [ClassTemplateInstantiation] shared_ptr<int *const>
|
||||
# 35| getStmt(3): [ExprStmt] ExprStmt
|
||||
# 35| getExpr(): [FunctionCall] call to shared_ptr_const_int_ptr
|
||||
# 35| Type = [VoidType] void
|
||||
# 35| ValueCategory = prvalue
|
||||
# 35| getArgument(0): [ConstructorCall] call to shared_ptr
|
||||
# 35| Type = [VoidType] void
|
||||
# 35| ValueCategory = prvalue
|
||||
# 35| getArgument(0): [VariableAccess] sp_const_int_pointer
|
||||
# 35| Type = [ClassTemplateInstantiation] shared_ptr<int *const>
|
||||
# 35| ValueCategory = lvalue
|
||||
# 35| getArgument(0).getFullyConverted(): [ReferenceToExpr] (reference to)
|
||||
# 35| Type = [LValueReferenceType] const shared_ptr<int *const> &
|
||||
# 35| ValueCategory = prvalue
|
||||
# 35| getExpr(): [CStyleCast] (const shared_ptr<int *const>)...
|
||||
# 35| Conversion = [GlvalueConversion] glvalue conversion
|
||||
# 35| Type = [SpecifiedType] const shared_ptr<int *const>
|
||||
# 35| ValueCategory = lvalue
|
||||
# 35| getArgument(0).getFullyConverted(): [TemporaryObjectExpr] temporary object
|
||||
# 35| Type = [ClassTemplateInstantiation] shared_ptr<int *const>
|
||||
# 35| ValueCategory = lvalue
|
||||
# 37| getStmt(4): [DeclStmt] declaration
|
||||
# 37| getDeclarationEntry(0): [VariableDeclarationEntry] definition of sp_sp_const_int
|
||||
# 37| Type = [ClassTemplateInstantiation] shared_ptr<shared_ptr<const int>>
|
||||
# 39| getStmt(5): [ExprStmt] ExprStmt
|
||||
# 39| getExpr(): [FunctionCall] call to shared_ptr_shared_ptr_const_int
|
||||
# 39| Type = [VoidType] void
|
||||
# 39| ValueCategory = prvalue
|
||||
# 39| getArgument(0): [ConstructorCall] call to shared_ptr
|
||||
# 39| Type = [VoidType] void
|
||||
# 39| ValueCategory = prvalue
|
||||
# 39| getArgument(0): [VariableAccess] sp_sp_const_int
|
||||
# 39| Type = [ClassTemplateInstantiation] shared_ptr<shared_ptr<const int>>
|
||||
# 39| ValueCategory = lvalue
|
||||
# 39| getArgument(0).getFullyConverted(): [ReferenceToExpr] (reference to)
|
||||
# 39| Type = [LValueReferenceType] const shared_ptr<shared_ptr<const int>> &
|
||||
# 39| ValueCategory = prvalue
|
||||
# 39| getExpr(): [CStyleCast] (const shared_ptr<shared_ptr<const int>>)...
|
||||
# 39| Conversion = [GlvalueConversion] glvalue conversion
|
||||
# 39| Type = [SpecifiedType] const shared_ptr<shared_ptr<const int>>
|
||||
# 39| ValueCategory = lvalue
|
||||
# 39| getArgument(0).getFullyConverted(): [TemporaryObjectExpr] temporary object
|
||||
# 39| Type = [ClassTemplateInstantiation] shared_ptr<shared_ptr<const int>>
|
||||
# 39| ValueCategory = lvalue
|
||||
# 41| getStmt(6): [DeclStmt] declaration
|
||||
# 41| getDeclarationEntry(0): [VariableDeclarationEntry] definition of sp_const_sp_int
|
||||
# 41| Type = [ClassTemplateInstantiation] shared_ptr<const shared_ptr<int>>
|
||||
# 43| getStmt(7): [ExprStmt] ExprStmt
|
||||
# 43| getExpr(): [FunctionCall] call to shared_ptr_const_shared_ptr_int
|
||||
# 43| Type = [VoidType] void
|
||||
# 43| ValueCategory = prvalue
|
||||
# 43| getArgument(0): [ConstructorCall] call to shared_ptr
|
||||
# 43| Type = [VoidType] void
|
||||
# 43| ValueCategory = prvalue
|
||||
# 43| getArgument(0): [VariableAccess] sp_const_sp_int
|
||||
# 43| Type = [ClassTemplateInstantiation] shared_ptr<const shared_ptr<int>>
|
||||
# 43| ValueCategory = lvalue
|
||||
# 43| getArgument(0).getFullyConverted(): [ReferenceToExpr] (reference to)
|
||||
# 43| Type = [LValueReferenceType] const shared_ptr<const shared_ptr<int>> &
|
||||
# 43| ValueCategory = prvalue
|
||||
# 43| getExpr(): [CStyleCast] (const shared_ptr<const shared_ptr<int>>)...
|
||||
# 43| Conversion = [GlvalueConversion] glvalue conversion
|
||||
# 43| Type = [SpecifiedType] const shared_ptr<const shared_ptr<int>>
|
||||
# 43| ValueCategory = lvalue
|
||||
# 43| getArgument(0).getFullyConverted(): [TemporaryObjectExpr] temporary object
|
||||
# 43| Type = [ClassTemplateInstantiation] shared_ptr<const shared_ptr<int>>
|
||||
# 43| ValueCategory = lvalue
|
||||
# 45| getStmt(8): [DeclStmt] declaration
|
||||
# 45| getDeclarationEntry(0): [VariableDeclarationEntry] definition of sp_const_sp_const_int
|
||||
# 45| Type = [ClassTemplateInstantiation] shared_ptr<const shared_ptr<const int>>
|
||||
# 47| getStmt(9): [ExprStmt] ExprStmt
|
||||
# 47| getExpr(): [FunctionCall] call to shared_ptr_const_shared_ptr_const_int
|
||||
# 47| Type = [VoidType] void
|
||||
# 47| ValueCategory = prvalue
|
||||
# 47| getArgument(0): [ConstructorCall] call to shared_ptr
|
||||
# 47| Type = [VoidType] void
|
||||
# 47| ValueCategory = prvalue
|
||||
# 47| getArgument(0): [VariableAccess] sp_const_sp_const_int
|
||||
# 47| Type = [ClassTemplateInstantiation] shared_ptr<const shared_ptr<const int>>
|
||||
# 47| ValueCategory = lvalue
|
||||
# 47| getArgument(0).getFullyConverted(): [ReferenceToExpr] (reference to)
|
||||
# 47| Type = [LValueReferenceType] const shared_ptr<const shared_ptr<const int>> &
|
||||
# 47| ValueCategory = prvalue
|
||||
# 47| getExpr(): [CStyleCast] (const shared_ptr<const shared_ptr<const int>>)...
|
||||
# 47| Conversion = [GlvalueConversion] glvalue conversion
|
||||
# 47| Type = [SpecifiedType] const shared_ptr<const shared_ptr<const int>>
|
||||
# 47| ValueCategory = lvalue
|
||||
# 47| getArgument(0).getFullyConverted(): [TemporaryObjectExpr] temporary object
|
||||
# 47| Type = [ClassTemplateInstantiation] shared_ptr<const shared_ptr<const int>>
|
||||
# 47| ValueCategory = lvalue
|
||||
# 48| getStmt(10): [ReturnStmt] return ...
|
||||
struct_init.cpp:
|
||||
# 1| [TopLevelFunction] int handler1(void*)
|
||||
# 1| <params>:
|
||||
|
||||
@@ -7977,6 +7977,101 @@ smart_ptr.cpp:
|
||||
# 17| v17_10(void) = AliasedUse : ~m?
|
||||
# 17| v17_11(void) = ExitFunction :
|
||||
|
||||
# 28| void call_shared_ptr_consts()
|
||||
# 28| Block 0
|
||||
# 28| v28_1(void) = EnterFunction :
|
||||
# 28| mu28_2(unknown) = AliasedDefinition :
|
||||
# 28| mu28_3(unknown) = InitializeNonLocal :
|
||||
# 29| r29_1(glval<shared_ptr<const int>>) = VariableAddress[sp_const_int] :
|
||||
# 29| mu29_2(shared_ptr<const int>) = Uninitialized[sp_const_int] : &:r29_1
|
||||
# 31| r31_1(glval<unknown>) = FunctionAddress[shared_ptr_const_int] :
|
||||
# 31| r31_2(glval<shared_ptr<const int>>) = VariableAddress[#temp31:26] :
|
||||
# 31| mu31_3(shared_ptr<const int>) = Uninitialized[#temp31:26] : &:r31_2
|
||||
# 31| r31_4(glval<unknown>) = FunctionAddress[shared_ptr] :
|
||||
# 31| r31_5(glval<shared_ptr<const int>>) = VariableAddress[sp_const_int] :
|
||||
# 31| r31_6(glval<shared_ptr<const int>>) = Convert : r31_5
|
||||
# 31| r31_7(shared_ptr<const int> &) = CopyValue : r31_6
|
||||
# 31| v31_8(void) = Call[shared_ptr] : func:r31_4, this:r31_2, 0:r31_7
|
||||
# 31| mu31_9(unknown) = ^CallSideEffect : ~m?
|
||||
# 31| mu31_10(shared_ptr<const int>) = ^IndirectMustWriteSideEffect[-1] : &:r31_2
|
||||
# 31| v31_11(void) = ^IndirectReadSideEffect[0] : &:r31_7, ~m?
|
||||
# 31| r31_12(shared_ptr<const int>) = Load[#temp31:26] : &:r31_2, ~m?
|
||||
# 31| v31_13(void) = Call[shared_ptr_const_int] : func:r31_1, 0:r31_12
|
||||
# 31| mu31_14(unknown) = ^CallSideEffect : ~m?
|
||||
# 31| v31_15(void) = ^BufferReadSideEffect[0] : &:r31_12, ~m?
|
||||
# 33| r33_1(glval<shared_ptr<int *const>>) = VariableAddress[sp_const_int_pointer] :
|
||||
# 33| mu33_2(shared_ptr<int *const>) = Uninitialized[sp_const_int_pointer] : &:r33_1
|
||||
# 35| r35_1(glval<unknown>) = FunctionAddress[shared_ptr_const_int_ptr] :
|
||||
# 35| r35_2(glval<shared_ptr<int *const>>) = VariableAddress[#temp35:30] :
|
||||
# 35| mu35_3(shared_ptr<int *const>) = Uninitialized[#temp35:30] : &:r35_2
|
||||
# 35| r35_4(glval<unknown>) = FunctionAddress[shared_ptr] :
|
||||
# 35| r35_5(glval<shared_ptr<int *const>>) = VariableAddress[sp_const_int_pointer] :
|
||||
# 35| r35_6(glval<shared_ptr<int *const>>) = Convert : r35_5
|
||||
# 35| r35_7(shared_ptr<int *const> &) = CopyValue : r35_6
|
||||
# 35| v35_8(void) = Call[shared_ptr] : func:r35_4, this:r35_2, 0:r35_7
|
||||
# 35| mu35_9(unknown) = ^CallSideEffect : ~m?
|
||||
# 35| mu35_10(shared_ptr<int *const>) = ^IndirectMustWriteSideEffect[-1] : &:r35_2
|
||||
# 35| v35_11(void) = ^IndirectReadSideEffect[0] : &:r35_7, ~m?
|
||||
# 35| r35_12(shared_ptr<int *const>) = Load[#temp35:30] : &:r35_2, ~m?
|
||||
# 35| v35_13(void) = Call[shared_ptr_const_int_ptr] : func:r35_1, 0:r35_12
|
||||
# 35| mu35_14(unknown) = ^CallSideEffect : ~m?
|
||||
# 35| v35_15(void) = ^BufferReadSideEffect[0] : &:r35_12, ~m?
|
||||
# 37| r37_1(glval<shared_ptr<shared_ptr<const int>>>) = VariableAddress[sp_sp_const_int] :
|
||||
# 37| mu37_2(shared_ptr<shared_ptr<const int>>) = Uninitialized[sp_sp_const_int] : &:r37_1
|
||||
# 39| r39_1(glval<unknown>) = FunctionAddress[shared_ptr_shared_ptr_const_int] :
|
||||
# 39| r39_2(glval<shared_ptr<shared_ptr<const int>>>) = VariableAddress[#temp39:37] :
|
||||
# 39| mu39_3(shared_ptr<shared_ptr<const int>>) = Uninitialized[#temp39:37] : &:r39_2
|
||||
# 39| r39_4(glval<unknown>) = FunctionAddress[shared_ptr] :
|
||||
# 39| r39_5(glval<shared_ptr<shared_ptr<const int>>>) = VariableAddress[sp_sp_const_int] :
|
||||
# 39| r39_6(glval<shared_ptr<shared_ptr<const int>>>) = Convert : r39_5
|
||||
# 39| r39_7(shared_ptr<shared_ptr<const int>> &) = CopyValue : r39_6
|
||||
# 39| v39_8(void) = Call[shared_ptr] : func:r39_4, this:r39_2, 0:r39_7
|
||||
# 39| mu39_9(unknown) = ^CallSideEffect : ~m?
|
||||
# 39| mu39_10(shared_ptr<shared_ptr<const int>>) = ^IndirectMustWriteSideEffect[-1] : &:r39_2
|
||||
# 39| v39_11(void) = ^IndirectReadSideEffect[0] : &:r39_7, ~m?
|
||||
# 39| r39_12(shared_ptr<shared_ptr<const int>>) = Load[#temp39:37] : &:r39_2, ~m?
|
||||
# 39| v39_13(void) = Call[shared_ptr_shared_ptr_const_int] : func:r39_1, 0:r39_12
|
||||
# 39| mu39_14(unknown) = ^CallSideEffect : ~m?
|
||||
# 39| v39_15(void) = ^BufferReadSideEffect[0] : &:r39_12, ~m?
|
||||
# 41| r41_1(glval<shared_ptr<const shared_ptr<int>>>) = VariableAddress[sp_const_sp_int] :
|
||||
# 41| mu41_2(shared_ptr<const shared_ptr<int>>) = Uninitialized[sp_const_sp_int] : &:r41_1
|
||||
# 43| r43_1(glval<unknown>) = FunctionAddress[shared_ptr_const_shared_ptr_int] :
|
||||
# 43| r43_2(glval<shared_ptr<const shared_ptr<int>>>) = VariableAddress[#temp43:37] :
|
||||
# 43| mu43_3(shared_ptr<const shared_ptr<int>>) = Uninitialized[#temp43:37] : &:r43_2
|
||||
# 43| r43_4(glval<unknown>) = FunctionAddress[shared_ptr] :
|
||||
# 43| r43_5(glval<shared_ptr<const shared_ptr<int>>>) = VariableAddress[sp_const_sp_int] :
|
||||
# 43| r43_6(glval<shared_ptr<const shared_ptr<int>>>) = Convert : r43_5
|
||||
# 43| r43_7(shared_ptr<const shared_ptr<int>> &) = CopyValue : r43_6
|
||||
# 43| v43_8(void) = Call[shared_ptr] : func:r43_4, this:r43_2, 0:r43_7
|
||||
# 43| mu43_9(unknown) = ^CallSideEffect : ~m?
|
||||
# 43| mu43_10(shared_ptr<const shared_ptr<int>>) = ^IndirectMustWriteSideEffect[-1] : &:r43_2
|
||||
# 43| v43_11(void) = ^IndirectReadSideEffect[0] : &:r43_7, ~m?
|
||||
# 43| r43_12(shared_ptr<const shared_ptr<int>>) = Load[#temp43:37] : &:r43_2, ~m?
|
||||
# 43| v43_13(void) = Call[shared_ptr_const_shared_ptr_int] : func:r43_1, 0:r43_12
|
||||
# 43| mu43_14(unknown) = ^CallSideEffect : ~m?
|
||||
# 43| v43_15(void) = ^BufferReadSideEffect[0] : &:r43_12, ~m?
|
||||
# 45| r45_1(glval<shared_ptr<const shared_ptr<const int>>>) = VariableAddress[sp_const_sp_const_int] :
|
||||
# 45| mu45_2(shared_ptr<const shared_ptr<const int>>) = Uninitialized[sp_const_sp_const_int] : &:r45_1
|
||||
# 47| r47_1(glval<unknown>) = FunctionAddress[shared_ptr_const_shared_ptr_const_int] :
|
||||
# 47| r47_2(glval<shared_ptr<const shared_ptr<const int>>>) = VariableAddress[#temp47:43] :
|
||||
# 47| mu47_3(shared_ptr<const shared_ptr<const int>>) = Uninitialized[#temp47:43] : &:r47_2
|
||||
# 47| r47_4(glval<unknown>) = FunctionAddress[shared_ptr] :
|
||||
# 47| r47_5(glval<shared_ptr<const shared_ptr<const int>>>) = VariableAddress[sp_const_sp_const_int] :
|
||||
# 47| r47_6(glval<shared_ptr<const shared_ptr<const int>>>) = Convert : r47_5
|
||||
# 47| r47_7(shared_ptr<const shared_ptr<const int>> &) = CopyValue : r47_6
|
||||
# 47| v47_8(void) = Call[shared_ptr] : func:r47_4, this:r47_2, 0:r47_7
|
||||
# 47| mu47_9(unknown) = ^CallSideEffect : ~m?
|
||||
# 47| mu47_10(shared_ptr<const shared_ptr<const int>>) = ^IndirectMustWriteSideEffect[-1] : &:r47_2
|
||||
# 47| v47_11(void) = ^IndirectReadSideEffect[0] : &:r47_7, ~m?
|
||||
# 47| r47_12(shared_ptr<const shared_ptr<const int>>) = Load[#temp47:43] : &:r47_2, ~m?
|
||||
# 47| v47_13(void) = Call[shared_ptr_const_shared_ptr_const_int] : func:r47_1, 0:r47_12
|
||||
# 47| mu47_14(unknown) = ^CallSideEffect : ~m?
|
||||
# 47| v47_15(void) = ^BufferReadSideEffect[0] : &:r47_12, ~m?
|
||||
# 48| v48_1(void) = NoOp :
|
||||
# 28| v28_4(void) = ReturnVoid :
|
||||
# 28| v28_5(void) = AliasedUse : ~m?
|
||||
# 28| v28_6(void) = ExitFunction :
|
||||
|
||||
struct_init.cpp:
|
||||
# 16| void let_info_escape(Info*)
|
||||
# 16| Block 0
|
||||
|
||||
@@ -18,3 +18,31 @@ void call_shared_ptr_arg(float* p) {
|
||||
shared_ptr<float> sp(p);
|
||||
shared_ptr_arg(sp);
|
||||
}
|
||||
|
||||
void shared_ptr_const_int(shared_ptr<const int>);
|
||||
void shared_ptr_const_int_ptr(shared_ptr<int* const>);
|
||||
void shared_ptr_shared_ptr_const_int(shared_ptr<shared_ptr<const int>>);
|
||||
void shared_ptr_const_shared_ptr_int(shared_ptr<const shared_ptr<int>>);
|
||||
void shared_ptr_const_shared_ptr_const_int(shared_ptr<const shared_ptr<const int>>);
|
||||
|
||||
void call_shared_ptr_consts() {
|
||||
shared_ptr<const int> sp_const_int;
|
||||
// cannot modify *sp_const_int
|
||||
shared_ptr_const_int(sp_const_int);
|
||||
|
||||
shared_ptr<int* const> sp_const_int_pointer;
|
||||
// can modify **sp_const_int_pointer
|
||||
shared_ptr_const_int_ptr(sp_const_int_pointer);
|
||||
|
||||
shared_ptr<shared_ptr<const int>> sp_sp_const_int;
|
||||
// can modify *sp_const_int_pointer
|
||||
shared_ptr_shared_ptr_const_int(sp_sp_const_int);
|
||||
|
||||
shared_ptr<const shared_ptr<int>> sp_const_sp_int;
|
||||
// can modify **sp_const_int_pointer
|
||||
shared_ptr_const_shared_ptr_int(sp_const_sp_int);
|
||||
|
||||
shared_ptr<const shared_ptr<const int>> sp_const_sp_const_int;
|
||||
// cannot modify *sp_const_int_pointer or **sp_const_int_pointer
|
||||
shared_ptr_const_shared_ptr_const_int(sp_const_sp_const_int);
|
||||
}
|
||||
Reference in New Issue
Block a user