Skip to content

C++ static calls to UCLASS methods are not linked (calls edge dropped) -> affected under-reports #2348

Closed

Description

@PedroMourao

Summary

For C++, a scope-qualified static call Class::Method(...) is not linked with a calls edge when the callee method node exists only in qualified form (label Class::Method()). This happens systematically for Unreal Engine UCLASS() / GENERATED_BODY() classes: the macro-laden header declaration is not parsed, so the method node is created only from the .cpp definition (Class::Method), with a qualified label. The call resolver matches call-sites by the bare callee identifier, so it never matches the qualified-labeled node, and the edge is dropped.

Consequence: graphify affected "<Class>" misses every static-call caller of that class's methods — dangerous for impact analysis / refactor gating (an "only affects X" that is incomplete).

Environment: graphify 0.9.13 · tree-sitter-cpp 0.23.4 · Python 3.10 · Windows

Minimal reproduction

Case A — plain class (WORKS, control)

helper.h declares static Helper* FindNearest();, helper.cpp defines it, caller.cpp calls Helper::FindNearest(). Result: the method node is labeled FindNearest (bare, from the header) and the qualified call links correctly:

useQualified() --[calls]--> FindNearest   ✅

Case B — Unreal UCLASS (BUG)

// helper.h
#pragma once
#include "CoreMinimal.h"
#include "helper.generated.h"
UCLASS()
class AHelper : public AActor {
    GENERATED_BODY()
public:
    UFUNCTION()
    static AHelper* FindNearest(UWorld* W);
};

// helper.cpp
#include "helper.h"
AHelper* AHelper::FindNearest(UWorld* W) { return nullptr; }

// caller.cpp
#include "helper.h"
void useIt(UWorld* W) {
    AHelper* h = AHelper::FindNearest(W);   // qualified static call
    (void)h;
}

graphify extract . --code-only produces:

  • Node AHelper::FindNearest() (label qualified, sourced from helper.cpp — the header declaration inside GENERATED_BODY() was not extracted).
  • Edges from useIt(): --[references]--> AHelper, --[references]--> UWorld.
  • No calls edge useIt() --> AHelper::FindNearest(). ❌

The only difference between A and B is whether a bare-named method node exists. When the method exists only as a qualified node, the call is not linked.

Expected

useIt() --[calls]--> AHelper::FindNearest() should exist, and affected "AHelper" should list useIt as an impacted caller.

Suggested fixes (either resolves it)

  1. Call resolver: when a call callee is a qualified_identifier (Class::Method), match it against method nodes labeled Class::Method() (and/or by the bare method segment), not only against bare-named nodes.
  2. Header parsing: handle UCLASS() / GENERATED_BODY() / UFUNCTION() macro bodies so method declarations produce bare method nodes (as in the plain-class case).

Real-world impact

On an Unreal project, affected "AXylosHelperCharacter" returned 1 caller where git grep found 3 real Class::FindNearest(...) static call-sites — so the reported blast radius was 1/3 of the true one.

Activity

  1. safishamsi commented on Sep 20, 2026

    @safishamsi
    Member

    Fixed in v0.9.64 via #3613 — C++ scope-qualified static calls resolve to a definition in another translation unit. Thanks @ayushcodes10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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