Skip to content

Commit 67684d1

Browse files
authored
Merge pull request #17948 from github/revert-17694-multiple-entry-point
Revert "C++: Do not generate IR for functions with multiple entry points"
2 parents 570260b + 2f032ec commit 67684d1

File tree

2 files changed

+67
-2
lines changed

2 files changed

+67
-2
lines changed

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,6 @@ private predicate isInvalidFunction(Function func) {
196196
expr.getEnclosingFunction() = func and
197197
not exists(expr.getType())
198198
)
199-
or
200-
count(func.getEntryPoint().getLocation()) > 1
201199
}
202200

203201
/**
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
test1.cpp:
2+
# 3| int foo(int)
3+
# 3| Block 0
4+
# 3| v3_1(void) = EnterFunction :
5+
test2.cpp:
6+
# 1| v3_1(void) = EnterFunction :
7+
test1.cpp:
8+
# 3| mu3_2(unknown) = AliasedDefinition :
9+
test2.cpp:
10+
# 1| mu3_2(unknown) = AliasedDefinition :
11+
test1.cpp:
12+
# 3| mu3_3(unknown) = InitializeNonLocal :
13+
test2.cpp:
14+
# 1| mu3_3(unknown) = InitializeNonLocal :
15+
test1.cpp:
16+
# 3| r3_4(glval<int>) = VariableAddress[i] :
17+
test2.cpp:
18+
# 1| r3_4(glval<int>) = VariableAddress[i] :
19+
test1.cpp:
20+
# 3| mu3_5(int) = InitializeParameter[i] : &:r1_4, &:r3_4
21+
test2.cpp:
22+
# 1| mu3_5(int) = InitializeParameter[i] : &:r1_4, &:r3_4
23+
#-----| Goto -> Block 2
24+
#-----| Goto -> Block 2
25+
26+
# 1| Block 0
27+
#-----| Goto -> Block 2
28+
#-----| Goto -> Block 2
29+
30+
test1.cpp:
31+
# 3| Block 1
32+
# 3| r3_6(glval<int>) = VariableAddress[#return] :
33+
test2.cpp:
34+
# 1| r3_6(glval<int>) = VariableAddress[#return] :
35+
test1.cpp:
36+
# 3| v3_7(void) = ReturnValue : &:r1_6, &:r3_6, ~m?
37+
test2.cpp:
38+
# 1| v3_7(void) = ReturnValue : &:r1_6, &:r3_6, ~m?
39+
test1.cpp:
40+
# 3| v3_8(void) = AliasedUse : ~m?
41+
test2.cpp:
42+
# 1| v3_8(void) = AliasedUse : ~m?
43+
test1.cpp:
44+
# 3| v3_9(void) = ExitFunction :
45+
test2.cpp:
46+
# 1| v3_9(void) = ExitFunction :
47+
48+
# 1| Block 1
49+
50+
test1.cpp:
51+
# 4| Block 2
52+
# 4| r4_1(glval<int>) = VariableAddress[#return] :
53+
# 4| r4_2(int) = Constant[42] :
54+
# 4| mu4_3(int) = Store[#return] : &:r4_1, r4_2
55+
#-----| Goto -> Block 1
56+
#-----| Goto -> Block 1
57+
58+
test2.cpp:
59+
# 2| Block 2
60+
# 2| r2_1(glval<int>) = VariableAddress[#return] :
61+
# 2| r2_2(glval<int>) = VariableAddress[i] :
62+
# 2| r2_3(int) = Load[i] : &:r2_2, ~m?
63+
# 2| mu2_4(int) = Store[#return] : &:r2_1, r2_3
64+
#-----| Goto -> Block 1
65+
#-----| Goto -> Block 1
66+
67+
# 1| int foo(int)

0 commit comments

Comments
 (0)