Skip to content

UsingEnumDecl's expectedCursorKind #633

@danieljennings

Description

@danieljennings

internal UsingEnumDecl(CXCursor handle) : base(handle, CXCursor_UnexposedDecl, CX_DeclKind_UsingEnum)

As you can see here, the expectedCursorKind for UsingEnumDecl is CXCursor_UnexposedDecl, but when we run this code against a using enum XXX; statement in our codebase, the cursor.kind is CXCursor_EnumDecl, instead. This means that the UsingEnumDecl constructor (via it's most-base class Cursor) throws an exception because handle.kind is CXCursor_EnumDecl but expectedCursorKind is CXCursor_UnexposedDecl.

I believe this is a bug, and I've changed it locally to expect CXCursor_EnumDecl instead (and it constructs without error), but I think it goes a little bit deeper than that - namely, the usingEnumDecl.EnumDecl returns an EnumDecl via Handle.Definition, when for me Handle.Definition is actually an OverloadedDeclRef... so I'm not really sure what's going on here, but my enum is very boring, and my using enum XXX; is similarly very boring... this is just the first time we've used one in a part of our codebase that's under the purview of our ClangSharp-using tools.

I will note that we're currently only on ClangSharp 18.1.0.2 (upgrading for us is more involved than just the ClangSharp component so it's non-trivial work) but the code I referenced above is from the main branch and still looks the same (and I doubt that Clang itself has gone backwards back to CXCursor_UnexposedDecl for something like this?).

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions