mirror of
https://github.com/github/codeql.git
synced 2025-12-18 09:43:15 +01:00
C++: Allow querying for "C" language linkage on routine types.
This commit is contained in:
@@ -1621,6 +1621,19 @@ class RoutineType extends Type, @routinetype {
|
||||
*/
|
||||
Type getReturnType() { routinetypes(underlyingElement(this), unresolveElement(result)) }
|
||||
|
||||
/**
|
||||
* Holds if this function type has "C" language linkage.
|
||||
*
|
||||
* This includes any function declared in a C source file, or explicitly marked as having "C" linkage:
|
||||
* ```
|
||||
* extern "C" void f();
|
||||
* extern "C" {
|
||||
* void g();
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
predicate hasCLinkage() { this.hasSpecifier("c_linkage") }
|
||||
|
||||
override string explain() {
|
||||
result =
|
||||
"function returning {" + this.getReturnType().explain() + "} with arguments (" +
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
| file://:0:0:0:0 | auto |
|
||||
| file://:0:0:0:0 | auto |
|
||||
| file://:0:0:0:0 | bool |
|
||||
| file://:0:0:0:0 | c_linkage |
|
||||
| file://:0:0:0:0 | char |
|
||||
| file://:0:0:0:0 | char8_t |
|
||||
| file://:0:0:0:0 | char16_t |
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
| file://:0:0:0:0 | auto |
|
||||
| file://:0:0:0:0 | auto |
|
||||
| file://:0:0:0:0 | bool |
|
||||
| file://:0:0:0:0 | c_linkage |
|
||||
| file://:0:0:0:0 | char |
|
||||
| file://:0:0:0:0 | char8_t |
|
||||
| file://:0:0:0:0 | char16_t |
|
||||
|
||||
@@ -17,12 +17,19 @@
|
||||
| Function | cpp20.cpp:7:19:7:40 | member_const_constexpr | member_const_constexpr | inline |
|
||||
| Function | cpp20.cpp:7:19:7:40 | member_const_constexpr | member_const_constexpr | is_constexpr |
|
||||
| Function | cpp20.cpp:7:19:7:40 | member_const_constexpr | member_const_constexpr | private |
|
||||
| Function | specifiers2.c:11:6:11:6 | f | f | c_linkage |
|
||||
| Function | specifiers2.c:11:6:11:6 | f | f | extern |
|
||||
| Function | specifiers2.c:12:13:12:13 | f | f | c_linkage |
|
||||
| Function | specifiers2.c:12:13:12:13 | f | f | extern |
|
||||
| Function | specifiers2.c:13:13:13:13 | f | f | c_linkage |
|
||||
| Function | specifiers2.c:13:13:13:13 | f | f | extern |
|
||||
| Function | specifiers2.c:15:13:15:13 | g | g | c_linkage |
|
||||
| Function | specifiers2.c:15:13:15:13 | g | g | extern |
|
||||
| Function | specifiers2.c:16:13:16:13 | g | g | c_linkage |
|
||||
| Function | specifiers2.c:16:13:16:13 | g | g | extern |
|
||||
| Function | specifiers2.c:21:6:21:12 | somefun | somefun | c_linkage |
|
||||
| Function | specifiers2.c:21:6:21:12 | somefun | somefun | extern |
|
||||
| Function | specifiers2.c:25:12:25:14 | add | add | c_linkage |
|
||||
| Function | specifiers2.c:25:12:25:14 | add | add | inline |
|
||||
| Function | specifiers2pp.cpp:8:7:8:7 | MyClass | MyClass | extern |
|
||||
| Function | specifiers2pp.cpp:8:7:8:7 | MyClass | MyClass | extern |
|
||||
@@ -96,8 +103,11 @@
|
||||
| Function | specifiers2pp.cpp:35:7:35:7 | operator= | operator= | public |
|
||||
| Function | specifiers2pp.cpp:35:7:35:7 | operator= | operator= | public |
|
||||
| Function | specifiers2pp.cpp:40:12:40:18 | someFun | someFun | extern |
|
||||
| Function | specifiers2pp.cpp:41:16:41:23 | someFun2 | someFun2 | c_linkage |
|
||||
| Function | specifiers2pp.cpp:41:16:41:23 | someFun2 | someFun2 | extern |
|
||||
| Function | specifiers2pp.cpp:43:9:43:16 | someFun3 | someFun3 | c_linkage |
|
||||
| Function | specifiers2pp.cpp:43:9:43:16 | someFun3 | someFun3 | extern |
|
||||
| Function | specifiers2pp.cpp:44:16:44:23 | someFun4 | someFun4 | c_linkage |
|
||||
| Function | specifiers2pp.cpp:44:16:44:23 | someFun4 | someFun4 | static |
|
||||
| Function | specifiers2pp.cpp:62:7:62:7 | operator= | operator= | extern |
|
||||
| Function | specifiers2pp.cpp:62:7:62:7 | operator= | operator= | extern |
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
| file://:0:0:0:0 | auto |
|
||||
| file://:0:0:0:0 | auto |
|
||||
| file://:0:0:0:0 | bool |
|
||||
| file://:0:0:0:0 | c_linkage |
|
||||
| file://:0:0:0:0 | char |
|
||||
| file://:0:0:0:0 | char8_t |
|
||||
| file://:0:0:0:0 | char16_t |
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
| file://:0:0:0:0 | auto | Other |
|
||||
| file://:0:0:0:0 | auto | Other |
|
||||
| file://:0:0:0:0 | bool | Other |
|
||||
| file://:0:0:0:0 | c_linkage | Other |
|
||||
| file://:0:0:0:0 | char | Other |
|
||||
| file://:0:0:0:0 | char8_t | Other |
|
||||
| file://:0:0:0:0 | char16_t | Other |
|
||||
|
||||
Reference in New Issue
Block a user