Skip to content

Heavily-reflected Unreal Engine C++ classes are dropped from the index (in-body reflection macros / member *_API / mid-line annotation macros collapse the class) #1160

Description

@luoyxy

Summary

Large, heavily-reflected Unreal Engine C++ classes disappear from the index. UE reflection / visibility markup that tree-sitter's C++ grammar doesn't recognize accumulates parse errors until the enclosing class_specifier collapses into an ERROR node — taking the whole class, its base clause, and its members with it. UCharacterMovementComponent (~240 such macros) vanished entirely.

There are three distinct triggers:

  1. In-body reflection macro calls — line-leading, no-semicolon UPROPERTY(...), UFUNCTION(...), UCLASS(...), GENERATED_BODY(), UE_DEPRECATED_*(...), DECLARE_DELEGATE_*(...) decorating members.
  2. Member/method-level export macros*_API / *_EXPORT / *_ABI prefixing exported members (ENGINE_API virtual void Tick(...), static ENGINE_API void AddReferencedObjects(...)); the macro is read as an extra type token, so each declaration falls into error recovery.
  3. Mid-line annotation macrosUMETA(...) on an enum value, UPARAM(ref) on a parameter, or a deprecation tag inside a using alias (using FOnNetTick UE_DEPRECATED(5.5, "...") = ...;, which alone collapsed UWorld in World.h).

Reproduction

UCLASS(MinimalAPI)
class UMyMovement : public UPawnMovementComponent, public IRVOAvoidanceInterface
{
    GENERATED_BODY()
public:
    UPROPERTY(EditAnywhere) float MaxWalkSpeed;
    UFUNCTION(BlueprintCallable) float ComputeSpeed() const;
};

Index → no class node for UMyMovement; its base clause and members are gone.

Real engine headers that reproduce it: CharacterMovementComponent.h, Actor.h, World.h, ActorComponent.h, SkeletalMeshComponent.h, LightComponent.h.

Impact

Every subclass / type-hierarchy / inheritance-impact / blast-radius query that flows through these core UE classes is broken, because the classes are absent from the graph entirely.

Root cause

tree-sitter-cpp doesn't know these tokens are macros; each drops into error recovery and the errors compound until the class_specifier can't close and collapses.

Fix

PR #1158 — three offset-preserving, C++-only pre-parse passes (blankCppAnnotationMacroCalls, blankCppApiPrefixMacros, blankCppInlineAnnotationMacros) that blank the markup before parsing so the class survives. Verified on the real engine headers above (residual tree-sitter errors cut from hundreds to single/low-double digits).

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