Rust: separate attribute macro and macro call expansions

This commit is contained in:
Paolo Tranquilli
2025-04-29 16:18:40 +02:00
parent 2d32c366d8
commit a7a887c828
90 changed files with 442 additions and 244 deletions

View File

@@ -3,9 +3,9 @@ import codeql.rust.elements
import TestUtils
from
Struct x, string hasExtendedCanonicalPath, string hasCrateOrigin, string hasExpanded,
int getNumberOfAttrs, string hasFieldList, string hasGenericParamList, string hasName,
string hasVisibility, string hasWhereClause
Struct x, string hasExtendedCanonicalPath, string hasCrateOrigin,
string hasAttributeMacroExpansion, int getNumberOfAttrs, string hasFieldList,
string hasGenericParamList, string hasName, string hasVisibility, string hasWhereClause
where
toBeTested(x) and
not x.isUnknown() and
@@ -15,7 +15,11 @@ where
else hasExtendedCanonicalPath = "no"
) and
(if x.hasCrateOrigin() then hasCrateOrigin = "yes" else hasCrateOrigin = "no") and
(if x.hasExpanded() then hasExpanded = "yes" else hasExpanded = "no") and
(
if x.hasAttributeMacroExpansion()
then hasAttributeMacroExpansion = "yes"
else hasAttributeMacroExpansion = "no"
) and
getNumberOfAttrs = x.getNumberOfAttrs() and
(if x.hasFieldList() then hasFieldList = "yes" else hasFieldList = "no") and
(if x.hasGenericParamList() then hasGenericParamList = "yes" else hasGenericParamList = "no") and
@@ -23,6 +27,6 @@ where
(if x.hasVisibility() then hasVisibility = "yes" else hasVisibility = "no") and
if x.hasWhereClause() then hasWhereClause = "yes" else hasWhereClause = "no"
select x, "hasExtendedCanonicalPath:", hasExtendedCanonicalPath, "hasCrateOrigin:", hasCrateOrigin,
"hasExpanded:", hasExpanded, "getNumberOfAttrs:", getNumberOfAttrs, "hasFieldList:", hasFieldList,
"hasGenericParamList:", hasGenericParamList, "hasName:", hasName, "hasVisibility:", hasVisibility,
"hasWhereClause:", hasWhereClause
"hasAttributeMacroExpansion:", hasAttributeMacroExpansion, "getNumberOfAttrs:", getNumberOfAttrs,
"hasFieldList:", hasFieldList, "hasGenericParamList:", hasGenericParamList, "hasName:", hasName,
"hasVisibility:", hasVisibility, "hasWhereClause:", hasWhereClause