Skip to content

Commit

Permalink
fix: Exclude functions with nospecialize from semgrep
Browse files Browse the repository at this point in the history
  • Loading branch information
kshyatt-aws committed Jun 28, 2024
1 parent 0261b33 commit 208b0e0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Quasar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,8 @@ function evaluate_unary_op(op::Symbol, arg::BitVector)
op == :~ && return .!arg
end

# semgrep rules can't handle this macro properly yet
# nosemgrep
function evaluate_binary_op(op::Symbol, @nospecialize(lhs), @nospecialize(rhs))
op == :< && return lhs < rhs
op == :> && return lhs > rhs
Expand Down Expand Up @@ -1446,6 +1448,8 @@ function evaluate_qubits(v::AbstractVisitor, qubit_targets::Vector{QasmExpressio
end
evaluate_qubits(v::AbstractVisitor, qubit_targets::QasmExpression) = evaluate_qubits(v::AbstractVisitor, [qubit_targets])

# semgrep rules can't handle this macro properly yet
# nosemgrep
function process_gate_arguments(v::AbstractVisitor, gate_name::String, defined_arguments::Vector{String}, called_arguments::Vector{QasmExpression}, @nospecialize(gate_body::Vector{Instruction}))
def_has_arguments = !isempty(defined_arguments)
call_has_arguments = !isempty(called_arguments)
Expand Down Expand Up @@ -1896,6 +1900,8 @@ function Braket.Circuit(v::QasmProgramVisitor)
return c
end

# semgrep rules can't handle this macro properly yet
# nosemgrep
function Braket.Circuit(qasm_source::String, @nospecialize(inputs::Dict{String, <:Any}=Dict{String, Any}()))
input_qasm = if endswith(qasm_source, ".qasm") && isfile(qasm_source)
read(qasm_source, String)
Expand Down

0 comments on commit 208b0e0

Please sign in to comment.