mirror of
https://github.com/github/codeql.git
synced 2026-05-02 04:05:14 +02:00
C++: Test fun_decl for INVALID_KEYs
This commit is contained in:
7
cpp/ql/test/library-tests/fun_decl/compile1.cpp
Normal file
7
cpp/ql/test/library-tests/fun_decl/compile1.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "fwd.h"
|
||||
|
||||
void func1()
|
||||
{
|
||||
classA *a = create_an_a();
|
||||
}
|
||||
|
||||
15
cpp/ql/test/library-tests/fun_decl/compile2.cpp
Normal file
15
cpp/ql/test/library-tests/fun_decl/compile2.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "fwd.h"
|
||||
|
||||
class classA {
|
||||
public:
|
||||
~classA() { }
|
||||
};
|
||||
|
||||
classA *create_an_a() {
|
||||
return new classA;
|
||||
}
|
||||
|
||||
void func2()
|
||||
{
|
||||
classA *a = create_an_a();
|
||||
}
|
||||
3
cpp/ql/test/library-tests/fun_decl/fwd.h
Normal file
3
cpp/ql/test/library-tests/fun_decl/fwd.h
Normal file
@@ -0,0 +1,3 @@
|
||||
class classA;
|
||||
classA *create_an_a(); // permits creation of a classA while it is an incomplete type.
|
||||
typedef classA classA_typedef;
|
||||
8
cpp/ql/test/library-tests/fun_decl/test.expected
Normal file
8
cpp/ql/test/library-tests/fun_decl/test.expected
Normal file
@@ -0,0 +1,8 @@
|
||||
| compile1.cpp:3:6:3:10 | func1 |
|
||||
| compile2.cpp:3:7:3:7 | operator= |
|
||||
| compile2.cpp:5:2:5:8 | ~classA |
|
||||
| compile2.cpp:8:9:8:19 | create_an_a |
|
||||
| compile2.cpp:12:6:12:10 | func2 |
|
||||
| file://:0:0:0:0 | operator new |
|
||||
| file://:0:0:0:0 | operator= |
|
||||
| file://:0:0:0:0 | operator= |
|
||||
4
cpp/ql/test/library-tests/fun_decl/test.ql
Normal file
4
cpp/ql/test/library-tests/fun_decl/test.ql
Normal file
@@ -0,0 +1,4 @@
|
||||
import cpp
|
||||
|
||||
from Function f
|
||||
select f
|
||||
Reference in New Issue
Block a user