Lancern wrote:

> Cannot we at least extend mlir-tblgen not to need postprocessing?

I think this is achievable actually. The amount of work needed to be done to 
make `mlir-tblgen` generate a whole page in its entirety should be moderate.

But then we would have another reason to keep a small script. Imagine that 
`mlir-tblgen` could directly generate `CIRLangRef.rst` into the 
`clang/docs/CIR` subdirectory. Since CIR is opt-in behind a CMake flag 
`CLANG_ENABLE_CIR`, the `CIRLangRef.rst` page is generated only when CIR is 
included in the build.

A somewhat annoying feature of Sphinx is that you have to list your pages 
explicitly in parent pages. So in `clang/docs/CIR/index.rst`, you have to 
explicitly list the `CIRLangRef.rst` page inside a `toctree::` directive. But 
if CIR is not included in the build, you would get a Sphinx build error since 
this page won't exist when CIR is not enabled. So you need a small script to 
tweak the `toctree::` directives based on whether the `CIRLangRef.rst` page is 
present.

I'm not a Sphinx expert so I'm not sure whether we could have a cleaner way to 
resolve similar problems. But I don't think this is a problem in the long-term 
since eventually we will make CIR enabled by default.

https://github.com/llvm/llvm-project/pull/190354
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to