mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Swift: add ImplicitConversionExpr test
This commit is contained in:
@@ -618,6 +618,4 @@ codeql::UnresolvedPatternExpr ExprVisitor::translateUnresolvedPatternExpr(
|
||||
entry.sub_pattern = dispatcher_.fetchLabel(expr.getSubPattern());
|
||||
return entry;
|
||||
}
|
||||
|
||||
static_assert(detail::HasTranslateUnresolvedPatternExpr<ExprVisitor>::value);
|
||||
} // namespace codeql
|
||||
|
||||
@@ -95,7 +95,6 @@ class ExprVisitor : public AstVisitorBase<ExprVisitor> {
|
||||
void fillAbstractClosureExpr(const swift::AbstractClosureExpr& expr,
|
||||
codeql::AbstractClosureExpr& entry);
|
||||
TrapLabel<ArgumentTag> emitArgument(const swift::Argument& arg);
|
||||
|
||||
void emitExplicitCastExpr(swift::ExplicitCastExpr* expr, TrapLabel<ExplicitCastExprTag> label);
|
||||
void fillIdentityExpr(const swift::IdentityExpr& expr, codeql::IdentityExpr& entry);
|
||||
void emitAnyTryExpr(swift::AnyTryExpr* expr, TrapLabel<AnyTryExprTag> label);
|
||||
|
||||
@@ -58,8 +58,8 @@ DEFINE_TRANSLATE_CHECKER(TypeRepr, , )
|
||||
#include "swift/AST/TypeReprNodes.def"
|
||||
} // namespace detail
|
||||
|
||||
// we want to override the define_visit swift visitor behaviour of chaining calls to immediate
|
||||
// superclasses by define_visit and instead provide our own TBD define_visit (using the exact type).
|
||||
// we want to override the default swift visitor behaviour of chaining calls to immediate
|
||||
// superclasses by default and instead provide our own TBD default (using the exact type).
|
||||
// Moreover, if the implementation class has translate##CLASS##KIND (that uses generated C++
|
||||
// classes), for the class of for a parent thereof, we want to use that. We detect that by using the
|
||||
// type traits HasTranslate##CLASS##KIND defined above
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -0,0 +1,3 @@
|
||||
| implicit_conversions.swift:2:3:2:3 | (UnsafePointer<CChar>) ... | getSubExpr: | implicit_conversions.swift:2:3:2:3 | Hello |
|
||||
| implicit_conversions.swift:4:16:4:16 | (Int?) ... | getSubExpr: | implicit_conversions.swift:4:16:4:16 | 42 |
|
||||
| implicit_conversions.swift:5:25:5:25 | (Equatable) ... | getSubExpr: | implicit_conversions.swift:5:25:5:25 | 42 |
|
||||
@@ -0,0 +1,10 @@
|
||||
// generated by codegen/codegen.py
|
||||
import codeql.swift.elements
|
||||
import TestUtils
|
||||
|
||||
from ImplicitConversionExpr x, Expr getSubExpr
|
||||
where
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
getSubExpr = x.getSubExpr()
|
||||
select x, "getSubExpr:", getSubExpr
|
||||
@@ -0,0 +1,3 @@
|
||||
| implicit_conversions.swift:2:3:2:3 | (UnsafePointer<CChar>) ... | UnsafePointer<CChar> |
|
||||
| implicit_conversions.swift:4:16:4:16 | (Int?) ... | Int? |
|
||||
| implicit_conversions.swift:5:25:5:25 | (Equatable) ... | Equatable |
|
||||
@@ -0,0 +1,7 @@
|
||||
// generated by codegen/codegen.py
|
||||
import codeql.swift.elements
|
||||
import TestUtils
|
||||
|
||||
from ImplicitConversionExpr x
|
||||
where toBeTested(x) and not x.isUnknown()
|
||||
select x, x.getType()
|
||||
@@ -0,0 +1,5 @@
|
||||
func f(_: UnsafePointer<CChar>) {}
|
||||
f("Hello") // StringToPointerExpr
|
||||
|
||||
let a : Int? = 42 // InjectIntoOptionalExpr
|
||||
let b : any Equatable = 42 // ErasureExpr
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -1,4 +0,0 @@
|
||||
// generated by codegen/codegen.py
|
||||
|
||||
After a swift source file is added in this directory and codegen/codegen.py is run again, test queries
|
||||
will appear and this file will be deleted
|
||||
@@ -310,6 +310,7 @@ class IfExpr(Expr):
|
||||
then_expr: Expr | child
|
||||
else_expr: Expr | child
|
||||
|
||||
@qltest.collapse_hierarchy
|
||||
class ImplicitConversionExpr(Expr):
|
||||
sub_expr: Expr | child
|
||||
|
||||
|
||||
Reference in New Issue
Block a user