Skip to content

Commit 03ced17

Browse files
authored
Merge pull request github#17694 from jketema/multiple-entry-point
C++: Do not generate IR for functions with multiple entry points
2 parents 2b37c6c + 5e3748a commit 03ced17

File tree

5 files changed

+18
-0
lines changed

5 files changed

+18
-0
lines changed

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

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

201203
/**

cpp/ql/test/library-tests/ir/multiple-entry-points/raw_ir.expected

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* @kind graph
3+
*/
4+
5+
private import cpp
6+
private import semmle.code.cpp.ir.implementation.raw.PrintIR
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
int foo(int i);
2+
3+
int foo(int i) {
4+
return 42;
5+
}
6+
7+
int bar();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
int foo(int i) {
2+
return i;
3+
}

0 commit comments

Comments
 (0)