• Paul Chaignon's avatar
    Fix bpf_dins_pkt rewrite in BinaryOperator · 47b74fe0
    Paul Chaignon authored
    Binary operator expressions where the left hand-side expression is a
    reference to the packet are replaced by a call to the bpf_dins_pkt
    helper. When replacing text, the Clang Rewriter tries to maintain a
    list of offsets between the original and the new position of tokens.
    
    Replacing the whole binary operator expression with the call to
    bpf_dins_pkt confuses the Rewriter and it is unable to track the new
    position of the right hand-side expression. Rewriting the binary
    operator expression in two times without rewriting the right
    hand-side expression itself solves the issue.
    47b74fe0
test_clang.py 10.5 KB