Swift: extract ImportDecl and ModuleDecl

As `ASTMangler` crashes when called on `ModuleDecl`, we simply use
its name.

This might probably not work reliably in a scenario where multiple
modules are compiled with the same name (like `main`), but this is left
for future work. At the moment this cannot create DB inconsistencies.
This commit is contained in:
Paolo Tranquilli
2022-07-01 15:17:21 +02:00
parent 7a7440a115
commit 3a975174c3
22 changed files with 180 additions and 24 deletions

View File

@@ -0,0 +1,15 @@
// generated by codegen/codegen.py
import codeql.swift.elements
import TestUtils
from
ModuleDecl x, Type getInterfaceType, string getName, string isBuiltinModule, string isSystemModule
where
toBeTested(x) and
not x.isUnknown() and
getInterfaceType = x.getInterfaceType() and
getName = x.getName() and
(if x.isBuiltinModule() then isBuiltinModule = "yes" else isBuiltinModule = "no") and
if x.isSystemModule() then isSystemModule = "yes" else isSystemModule = "no"
select x, "getInterfaceType:", getInterfaceType, "getName:", getName, "isBuiltinModule:",
isBuiltinModule, "isSystemModule:", isSystemModule