Files
codeql/cpp/ql/test/library-tests/CPP-205/elements.ql
2023-03-24 17:45:36 +00:00

34 lines
966 B
Plaintext

import cpp
import semmle.code.cpp.Print
string describe(Element e) {
e instanceof Function and
result = "function " + getIdentityString(e)
or
result =
"function declaration entry for " +
getIdentityString(e.(FunctionDeclarationEntry).getFunction())
or
result = "parameter for " + getIdentityString(e.(Parameter).getFunction())
or
result =
"parameter declaration entry for " +
getIdentityString(e.(ParameterDeclarationEntry).getFunctionDeclarationEntry().getFunction())
or
exists(Element template |
e.isFromTemplateInstantiation(template) and
result = "isFromTemplateInstantiation(" + template.toString() + ")"
)
or
exists(Element template |
e.isFromUninstantiatedTemplate(template) and
result = "isFromUninstantiatedTemplate(" + template.toString() + ")"
)
}
from Element e
where
e.getLocation().getFile().getBaseName() != "" and
not e instanceof Folder
select e, strictconcat(describe(e), ", ")