I am new to clang and I am trying to write a check to familiarize myself
with AST matchers. I am just looking for a confirmation here. When I
bind a node within a hasAncestor() matcher, am I guaranteed to get the
most direct (nearest) ancestor from the current node?
Consider the following example:
class MyClass {
public:
void myClassOp() { //<-- another parent CXXMemberDecl
class NestedClass {
void nestedClassOp() { //<-- parent CXXMemberDecl
(void) this; //<-- CXXThisExpr
}
};
}
};
I get the most direct ancestor (the desired behavior) when using a
matcher like:
I am new to clang and I am trying to write a check to familiarize myself
with AST matchers. I am just looking for a confirmation here. When I
bind a node within a hasAncestor() matcher, am I guaranteed to get the
most direct (nearest) ancestor from the current node?
Consider the following example:
class MyClass {
public:
void myClassOp() { //<-- another parent CXXMemberDecl
class NestedClass {
void nestedClassOp() { //<-- parent CXXMemberDecl
(void) this; //<-- CXXThisExpr
}
};
}
};
I get the most direct ancestor (the desired behavior) when using a
matcher like: