[cfe-dev] matcher acting wierd,imho

Farzad Sadeghi via cfe-dev cfe-dev at lists.llvm.org
Mon Nov 7 01:03:01 PST 2016


I have  a simple `if-else if` code I'm trying to match but clang-query
or clang itself match nothing.
here's the C code:
void myfunc (void)
{
        int a = 0U;
        int b = 10U;

        if (a == b)
        {
                a++;
        }
        else if (a > b )
        {
                b++;
        }

}

and this is my matcher:
ifStmt( allOf( hasDescendant(ifStmt()), hasElse(anything()) ,
unless(hasAncestor(ifStmt())) ) )

clang-query and clang don't match anything. Am i assuming wrong that I
should get one match or I'm misunderstanding something here?

-- 
Farzad Sadeghi



More information about the cfe-dev mailing list