Before making a link to a reference it is required to check that the reference has a path (eg. primitives won't have paths).
This was done by checking if the path was empty; that worked because when generating paths the outdirectory was included, so if the path was assigned it had that outdirectory at least.
The path generation was changed, it's now only the composite of the namespaces without the outdirectory. So if the info is in the global namespace the path would be empty and the old check wouldn't work as expected.
A new attribute has been added to the Reference struct that indicates if the info's parent is the global namespace.
Paths generation now fails if the path is empty and if the info is not in the global namespace.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Under what circumstances, exactly, is the path not set where you would need to create a link despite that? Is it only in the global namespace case? If so, could you special-case that and ignore other empty paths?
clang-tools-extra/clang-doc/Representation.h | ||
---|---|---|
137 ↗ | (On Diff #210698) | Is this field actually set anywhere? |
clang-tools-extra/clang-doc/Representation.h | ||
---|---|---|
137 ↗ | (On Diff #210698) | Yes, in the constructors where a path is assigned. |
It's not specifically in the GlobalNamespace info file. It happens in that one but also in any info whose parent namespace is the global namespace.
Change attribute used to check special case of global namespace; IsPathValid changed to IsInGlobalNamespace. This attribute is true when its first parent is the global namespace or if the info is the global namespace,
The code looks fine to me but I don't understand the global details of this. Hopefully Julie can still review things from there but if not we don't get timely reviews then we can still land this.
clang-tools-extra/clang-doc/Representation.h | ||
---|---|---|
140–141 ↗ | (On Diff #211979) | Here and below perhaps favor putting the comments above the line rather than to the side to make the formatter produce nicer looking code. |
clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp | ||
83–84 ↗ | (On Diff #211979) | Maybe put the comment above this line so that the formatter doesn't get all wonky. |