Skip to content

clang_getCursorLexicalParent() doesn't yield translation unit for global declarations #9455

@llvmbot

Description

@llvmbot
Bugzilla Link 9083
Resolution FIXED
Resolved on Apr 30, 2012 18:41
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @DougGregor

Extended Description

The documentation for clang_getCursorLexicalParent() states that, for declarations in the global scope, the lexical parent is the translation unit itself.

I couldn't reproduce this with any input. Specifically, I tried:

CXChildVisitResult my_visitor(CXCursor parent, CXCursor cursor, CXClientData d)
{
ASGTranslator translator = static_cast<ASGTranslator>(d);

CXCursor tu = clang_getTranslationUnitCursor(translator->tu_);
CXCursor lp = clang_getCursorLexicalParent(c);
std::cout << "lexical parent equals TU :" << clang_equalCursors(lp, tu) << std::endl;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions