Skip to content

Commit

Permalink
Merge pull request #17694 from jketema/multiple-entry-point
Browse files Browse the repository at this point in the history
C++: Do not generate IR for functions with multiple entry points
  • Loading branch information
jketema authored Oct 31, 2024
2 parents 2b37c6c + 5e3748a commit 03ced17
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ private predicate isInvalidFunction(Function func) {
expr.getEnclosingFunction() = func and
not exists(expr.getType())
)
or
count(func.getEntryPoint().getLocation()) > 1
}

/**
Expand Down
Empty file.
6 changes: 6 additions & 0 deletions cpp/ql/test/library-tests/ir/multiple-entry-points/raw_ir.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* @kind graph
*/

private import cpp
private import semmle.code.cpp.ir.implementation.raw.PrintIR
7 changes: 7 additions & 0 deletions cpp/ql/test/library-tests/ir/multiple-entry-points/test1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
int foo(int i);

int foo(int i) {
return 42;
}

int bar();
3 changes: 3 additions & 0 deletions cpp/ql/test/library-tests/ir/multiple-entry-points/test2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int foo(int i) {
return i;
}

0 comments on commit 03ced17

Please sign in to comment.