/** * \brief Determine the lexical parent of the given cursor. * * The lexical parent of a cursor is the cursor in which the given \p cursor * was actually written. For many declarations, the lexical and semantic parents * are equivalent (the semantic parent is returned by * \c clang_getCursorSemanticParent()). They diverge when declarations or * definitions are provided out-of-line. For example: * * \code * class C { * void f(); * }; * * void C::f() { } * \endcode * * In the out-of-line definition of \c C::f, the semantic parent is the * the class \c C, of which this function is a member. The lexical parent is * the place where the declaration actually occurs in the source code; in this * case, the definition occurs in the translation unit. In general, the * lexical parent for a given entity can change without affecting the semantics * of the program, and the lexical parent of different declarations of the * same entity may be different. Changing the semantic parent of a declaration, * on the other hand, can have a major impact on semantics, and redeclarations * of a particular entity should all have the same semantic context. * * In the example above, both declarations of \c C::f have \c C as their * semantic context, while the lexical context of the first \c C::f is \c C * and the lexical context of the second \c C::f is the translation unit. * * For declarations written in the global scope, the lexical parent is * the translation unit. */ func (c Cursor) LexicalParent() Cursor { o := C.clang_getCursorLexicalParent(c.c) return Cursor{o} }
/* Determine the lexical parent of the given cursor. The lexical parent of a cursor is the cursor in which the given \p cursor was actually written. For many declarations, the lexical and semantic parents are equivalent (the semantic parent is returned by clang_getCursorSemanticParent()). They diverge when declarations or definitions are provided out-of-line. For example: \code class C { void f(); }; void C::f() { } \endcode In the out-of-line definition of C::f, the semantic parent is the class C, of which this function is a member. The lexical parent is the place where the declaration actually occurs in the source code; in this case, the definition occurs in the translation unit. In general, the lexical parent for a given entity can change without affecting the semantics of the program, and the lexical parent of different declarations of the same entity may be different. Changing the semantic parent of a declaration, on the other hand, can have a major impact on semantics, and redeclarations of a particular entity should all have the same semantic context. In the example above, both declarations of C::f have C as their semantic context, while the lexical context of the first C::f is C and the lexical context of the second C::f is the translation unit. For declarations written in the global scope, the lexical parent is the translation unit. */ func (c Cursor) LexicalParent() Cursor { return Cursor{C.clang_getCursorLexicalParent(c.c)} }