[cfe-dev] RFC: What does this matcher mean to you?
Vane, Edwin
edwin.vane at intel.com
Tue May 21 10:10:09 PDT 2013
We're trying to determine the semantics of the proposed new 'equalsBoundNode()' matcher. Before I present the aforementioned matcher expression let me illustrate what this new matcher does. Given that you've bound a node earlier in a matcher expression with a name "X", equalsBoundNode("X") allows you to refer back to that bound node and test for identity. For example, here's a matcher finding VarDecl's where the type matches the initializer type:
varDecl(hasType(qualType().bind("type")),
hasInitializer(ignoringParenImpCasts(hasType(qualType(equalsBoundNode("type"))))))));
Semantics get more interesting where forEach*() matchers are concerned. So this is where I ask: What would you expect the following matcher to do? How would you expect it to behave?
functionDecl(
forEachDescendant(
ifStmt(
forEachDescendant(
varDecl(hasType(qualType().bind("declType")))
)
)
),
has(compoundStmt(has(
callExpr(
callee(
functionDecl(
returns(qualType(equalsBoundNode("declType")))
)
)
)
)))
);
--
Edwin Vane
Software Developer
Intel of Canada, Inc.
More information about the cfe-dev
mailing list