In C++, entities without a name legally exist—anonymous namespaces and structs. For example, a nested struct class Widget { struct { int x, y; } coords; }; .
At first, we encountered this while parsing the XML from the old generator: it output empty <compoundname> tags for anonymous namespaces, causing our parser to crash with a scream. We taught it to painlessly collapse them into the global scope. But the real war began when we reached anonymous structs in our new native AST parser based on libclang .
The Chaos of Absolute Paths
When the native libclang parser encounters an anonymous struct, it needs to name it somehow inside the Abstract Syntax Tree (AST). And the compiler honestly generates a purely technical name for it: (unnamed struct at /home/user/workspace/repo/include/widget.h:42:5) .
The problem is that this name includes the absolute path to the file on the hard drive. On one developer's machine, the path is one thing; on the CI server, it's another.…