1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-15 15:02:42 +01:00

libutil: Document hacks and problems around Pos class

This should provide context for follow-up commits in
the patch series.

(cherry picked from commit bf12aedf2e)
This commit is contained in:
Sergei Zimmerman 2025-03-13 12:55:42 +00:00 committed by Mergify
parent b540c2419f
commit 8c2a792d2b
3 changed files with 20 additions and 0 deletions

View file

@ -50,6 +50,14 @@ struct LinesOfCode {
std::optional<std::string> nextLineOfCode;
};
/* NOTE: position.hh recursively depends on source-path.hh -> source-accessor.hh
-> hash.hh -> config.hh -> experimental-features.hh -> error.hh -> Pos.
There are other such cycles.
Thus, Pos has to be an incomplete type in this header. But since ErrorInfo/Trace
have to refer to Pos, they have to use pointer indirection via std::shared_ptr
to break the recursive header dependency.
FIXME: Untangle this mess. Should there be AbstractPos as there used to be before
4feb7d9f71? */
struct Pos;
void printCodeLines(std::ostream & out,