Skip to content

Commit f83f14b

Browse files
committed
C++: add calling convention specifier class
1 parent a8b19d2 commit f83f14b

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

cpp/ql/lib/semmle/code/cpp/Specifier.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,18 @@ class AccessSpecifier extends Specifier {
9797
override string getAPrimaryQlClass() { result = "AccessSpecifier" }
9898
}
9999

100+
/**
101+
* A C/C++ calling convention specifier: `cdecl`, `fastcall`, `stdcall`, `thiscall`,
102+
* `vectorcall`, or `clrcall`.
103+
*/
104+
class CallingConventionSpecifier extends Specifier {
105+
CallingConventionSpecifier() {
106+
this.hasName(["cdecl", "fastcall", "stdcall", "thiscall", "vectorcall", "clrcall"])
107+
}
108+
109+
override string getAPrimaryQlClass() { result = "CallingConventionSpecifier" }
110+
}
111+
100112
/**
101113
* An attribute introduced by GNU's `__attribute__((name))` syntax,
102114
* Microsoft's `__declspec(name)` syntax, Microsoft's `[name]` syntax, the
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import cpp
2+
3+
from FunctionDeclarationEntry func, CallingConventionSpecifier ccs
4+
where ccs.hasName(func.getASpecifier())
5+
select func, func.getASpecifier()

0 commit comments

Comments
 (0)