File tree Expand file tree Collapse file tree 6 files changed +70
-2
lines changed
lib/semmle/code/cpp/ir/internal Expand file tree Collapse file tree 6 files changed +70
-2
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ private int getTypeSizeWorkaround(Type type) {
11
11
exists ( Type unspecifiedType |
12
12
unspecifiedType = type .getUnspecifiedType ( ) and
13
13
(
14
- unspecifiedType instanceof FunctionReferenceType and
14
+ ( unspecifiedType instanceof FunctionReferenceType or unspecifiedType instanceof RoutineType ) and
15
15
result = getPointerSize ( )
16
16
or
17
17
exists ( PointerToMemberType ptmType |
@@ -176,7 +176,7 @@ private IRType getIRTypeForPRValue(Type type) {
176
176
isPointerIshType ( unspecifiedType ) and
177
177
result .( IRAddressType ) .getByteSize ( ) = getTypeSize ( unspecifiedType )
178
178
or
179
- unspecifiedType instanceof FunctionPointerIshType and
179
+ ( unspecifiedType instanceof FunctionPointerIshType or unspecifiedType instanceof RoutineType ) and
180
180
result .( IRFunctionAddressType ) .getByteSize ( ) = getTypeSize ( type )
181
181
or
182
182
unspecifiedType instanceof VoidType and result instanceof IRVoidType
Original file line number Diff line number Diff line change @@ -18076,6 +18076,25 @@ ir.cpp:
18076
18076
# 2317| getQualifier(): [VariableAccess] s
18077
18077
# 2317| Type = [Struct] String
18078
18078
# 2317| ValueCategory = lvalue
18079
+ # 2320| [CopyAssignmentOperator] return_routine_type::HasVoidToIntFunc& return_routine_type::HasVoidToIntFunc::operator=(return_routine_type::HasVoidToIntFunc const&)
18080
+ # 2320| <params>:
18081
+ #-----| getParameter(0): [Parameter] (unnamed parameter 0)
18082
+ #-----| Type = [LValueReferenceType] const HasVoidToIntFunc &
18083
+ # 2320| [MoveAssignmentOperator] return_routine_type::HasVoidToIntFunc& return_routine_type::HasVoidToIntFunc::operator=(return_routine_type::HasVoidToIntFunc&&)
18084
+ # 2320| <params>:
18085
+ #-----| getParameter(0): [Parameter] (unnamed parameter 0)
18086
+ #-----| Type = [RValueReferenceType] HasVoidToIntFunc &&
18087
+ # 2322| [MemberFunction] void return_routine_type::HasVoidToIntFunc::VoidToInt(int)
18088
+ # 2322| <params>:
18089
+ # 2322| getParameter(0): [Parameter] (unnamed parameter 0)
18090
+ # 2322| Type = [IntType] int
18091
+ # 2327| [TopLevelFunction] return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc()
18092
+ # 2327| <params>:
18093
+ # 2328| getEntryPoint(): [BlockStmt] { ... }
18094
+ # 2329| getStmt(0): [ReturnStmt] return ...
18095
+ # 2329| getExpr(): [FunctionAccess] VoidToInt
18096
+ # 2329| Type = [RoutineType] ..()(..)
18097
+ # 2329| ValueCategory = prvalue
18079
18098
perf-regression.cpp:
18080
18099
# 4| [CopyAssignmentOperator] Big& Big::operator=(Big const&)
18081
18100
# 4| <params>:
Original file line number Diff line number Diff line change @@ -14579,6 +14579,20 @@ ir.cpp:
14579
14579
# 2314| v2314_6(void) = AliasedUse : ~m2317_5
14580
14580
# 2314| v2314_7(void) = ExitFunction :
14581
14581
14582
+ # 2327| return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc()
14583
+ # 2327| Block 0
14584
+ # 2327| v2327_1(void) = EnterFunction :
14585
+ # 2327| m2327_2(unknown) = AliasedDefinition :
14586
+ # 2327| m2327_3(unknown) = InitializeNonLocal :
14587
+ # 2327| m2327_4(unknown) = Chi : total:m2327_2, partial:m2327_3
14588
+ # 2329| r2329_1(glval<..:: *>) = VariableAddress[#return] :
14589
+ # 2329| r2329_2(..()(..)) = FunctionAddress[VoidToInt] :
14590
+ # 2329| m2329_3(..:: *) = Store[#return] : &:r2329_1, r2329_2
14591
+ # 2327| r2327_5(glval<..:: *>) = VariableAddress[#return] :
14592
+ # 2327| v2327_6(void) = ReturnValue : &:r2327_5, m2329_3
14593
+ # 2327| v2327_7(void) = AliasedUse : m2327_3
14594
+ # 2327| v2327_8(void) = ExitFunction :
14595
+
14582
14596
perf-regression.cpp:
14583
14597
# 6| void Big::Big()
14584
14598
# 6| Block 0
Original file line number Diff line number Diff line change @@ -2316,4 +2316,19 @@ void VoidReturnDestructors() {
2316
2316
return VoidFunc ();
2317
2317
}
2318
2318
2319
+ namespace return_routine_type {
2320
+ struct HasVoidToIntFunc
2321
+ {
2322
+ void VoidToInt (int );
2323
+ };
2324
+
2325
+ typedef void (HasVoidToIntFunc::*VoidToIntMemberFunc)(int );
2326
+
2327
+ static VoidToIntMemberFunc GetVoidToIntFunc ()
2328
+ {
2329
+ return &HasVoidToIntFunc::VoidToInt;
2330
+ }
2331
+
2332
+ }
2333
+
2319
2334
// semmle-extractor-options: -std=c++20 --clang
Original file line number Diff line number Diff line change 12029
12029
| ir.cpp:2317:1:2317:1 | ChiTotal | total:m2316_4 |
12030
12030
| ir.cpp:2317:1:2317:1 | SideEffect | m2315_8 |
12031
12031
| ir.cpp:2317:1:2317:1 | SideEffect | ~m2316_4 |
12032
+ | ir.cpp:2327:32:2327:47 | Address | &:r2327_5 |
12033
+ | ir.cpp:2327:32:2327:47 | ChiPartial | partial:m2327_3 |
12034
+ | ir.cpp:2327:32:2327:47 | ChiTotal | total:m2327_2 |
12035
+ | ir.cpp:2327:32:2327:47 | Load | m2329_3 |
12036
+ | ir.cpp:2327:32:2327:47 | SideEffect | m2327_3 |
12037
+ | ir.cpp:2329:9:2329:44 | Address | &:r2329_1 |
12038
+ | ir.cpp:2329:16:2329:43 | StoreValue | r2329_2 |
12032
12039
| perf-regression.cpp:6:3:6:5 | Address | &:r6_5 |
12033
12040
| perf-regression.cpp:6:3:6:5 | Address | &:r6_5 |
12034
12041
| perf-regression.cpp:6:3:6:5 | Address | &:r6_7 |
Original file line number Diff line number Diff line change @@ -13510,6 +13510,19 @@ ir.cpp:
13510
13510
# 2314| v2314_5(void) = AliasedUse : ~m?
13511
13511
# 2314| v2314_6(void) = ExitFunction :
13512
13512
13513
+ # 2327| return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc()
13514
+ # 2327| Block 0
13515
+ # 2327| v2327_1(void) = EnterFunction :
13516
+ # 2327| mu2327_2(unknown) = AliasedDefinition :
13517
+ # 2327| mu2327_3(unknown) = InitializeNonLocal :
13518
+ # 2329| r2329_1(glval<..:: *>) = VariableAddress[#return] :
13519
+ # 2329| r2329_2(..()(..)) = FunctionAddress[VoidToInt] :
13520
+ # 2329| mu2329_3(..:: *) = Store[#return] : &:r2329_1, r2329_2
13521
+ # 2327| r2327_4(glval<..:: *>) = VariableAddress[#return] :
13522
+ # 2327| v2327_5(void) = ReturnValue : &:r2327_4, ~m?
13523
+ # 2327| v2327_6(void) = AliasedUse : ~m?
13524
+ # 2327| v2327_7(void) = ExitFunction :
13525
+
13513
13526
perf-regression.cpp:
13514
13527
# 6| void Big::Big()
13515
13528
# 6| Block 0
You can’t perform that action at this time.
0 commit comments