Skip to content

UE-style single-line export-macro class headers (class ENGINE_API Foo : public Bar) are misdetected as C and their class definitions are dropped #1159

Description

@luoyxy

Summary

In a .h header, a class declared with an all-caps export/visibility macro between the class/struct keyword and the type name — the ubiquitous Unreal Engine / library form class ENGINE_API Foo : public Bar — is misclassified by the header language heuristic as C instead of C++. Parsed with the C grammar, the class definition is never recovered and disappears from the graph.

Reproduction

Header Foo.h:

class ENGINE_API Foo : public Bar
{
public:
    void Tick();
};

Index the file → there is no class node for Foo and no extends Bar edge.

Impact

Any .h using the class MODULE_API Type : Base form — standard across Unreal Engine and the many C/C++ libraries that use *_API / *_EXPORT export macros — loses its class definition, its base clause, and its members. That breaks type-hierarchy, callers, and blast-radius queries that flow through the type.

Root cause

looksLikeCpp (src/extraction/grammars.ts) recognizes class Foo : Base but not class MACRO Foo : Base: the macro token between the keyword and the identifier defeats the C++ signal, so ambiguous .h files fall back to the C grammar.

Fix

PR #1133 — extend the looksLikeCpp pattern to also accept an all-caps macro between class/struct and the identifier before the : / {.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions