Files
codeql/cpp/ql/test/library-tests/specifiers2/specifiers2.ql
Jeroen Ketema 3e7a60c1a6 C++: Add additional test cases for explict and explicit(bool) specifiers
Note that the `explict(bool)` specifiers currently do not end up in the
database.
2024-07-25 14:41:44 +02:00

34 lines
907 B
Plaintext

import cpp
string interesting(Element e) {
e instanceof Class and result = "Class"
or
e instanceof Function and result = "Function"
or
e instanceof FunctionDeclarationEntry and result = "FunctionDeclarationEntry"
or
e instanceof TypedefType and result = "TypedefType"
or
e instanceof Variable and result = "Variable"
or
e instanceof VariableDeclarationEntry and result = "VariableDeclarationEntry"
}
from Element e, string name, string specifiers
where
(
name = e.(Declaration).getName() or
name = e.(DeclarationEntry).getName() or
name = e.(Type).toString()
) and
specifiers =
concat(string s |
s = e.(Declaration).getASpecifier().toString() or
s = e.(DeclarationEntry).getASpecifier() or
s = e.(TypedefType).getBaseType().getASpecifier().toString()
|
s, ", "
) and
specifiers != ""
select interesting(e), e, name, specifiers