#pragma once #include #include #include #include #include #include #include namespace vls::features::call_hierarchy { struct Position { std::uint32_t line{}, character{}; auto operator<=>(const Position &) const = default; }; struct Range { Position start, end; auto operator<=>(const Range &) const = default; }; // A compiler-proven function definition. struct Definition { std::string name; std::string path; Range range; auto operator<=>(const Definition &) const = default; }; // One resolved call site. struct Call { std::string callee; std::optional callee_definition; std::string path; Range range; }; struct Incoming { std::string name; std::string path; Range range; // the caller definition, or the call itself when unknown std::vector from_ranges; // True when an enclosing compiler-proven definition named the caller; // false means the caller is reported at file level. bool resolved_definition{}; auto operator<=>(const Incoming &) const = default; }; struct Limits { std::size_t callers{256}; std::size_t ranges{512}; std::size_t nameBytes{256}; }; // Incoming calls of TARGET: every resolved call to it, grouped by the // innermost known definition containing the call site in that file. When no // definition contains it, the caller is reported at file level with the call // range, never as a guessed function. [[nodiscard]] std::vector incoming(std::span, std::span known, const Definition &target, const Limits & = Limits{}); struct Outgoing { Definition to; std::vector from_ranges; auto operator<=>(const Outgoing &) const = default; }; // Calls made inside CALLER, grouped by their resolved callee definition. // A call is attributed to the innermost known definition containing it in the // same file, so calls inside nested functions are not reported for CALLER. // Calls without a resolved callee are omitted: an item must point somewhere. [[nodiscard]] std::vector outgoing(std::span, std::span known, const Definition &caller, const Limits & = Limits{}); } // namespace vls::features::call_hierarchy