ojhunt wrote: > I have no idea what is going on here... @AaronBallman probably needs to take > a better look. Else, could the author please give me an ELI5 sorta thing here > or show me what the change looks like on the generated stuff?
Sure! This example will cover the docs used in the [above screenshot](#issuecomment-2516159888) So currently the documentation for the attribute is: ```markdown def NoSanitizeMemoryDocs : Documentation { let Category = DocCatFunction; let Heading = "no_sanitize_memory"; let Content = [{ .. _langext-memory_sanitizer: Use ``__attribute__((no_sanitize_memory))`` on a function declaration to .... }]; } ``` this results in generated docs like this: ```rst no_sanitize_memory ------------------ .. csv-table:: Supported Syntaxes :header: "GNU", "C++11", "C23", "``__declspec``", "Keyword", "``#pragma``", "HLSL Annotation", "``#pragma clang attribute``" "``no_address_safety_analysis`` |br| ``no_sanitize_address`` |br| ``no_sanitize_thread`` |br| ``no_sanitize_memory``","``gnu::no_address_safety_analysis`` |br| ``gnu::no_sanitize_address`` |br| ``gnu::no_sanitize_thread`` |br| ``clang::no_sanitize_memory``","``gnu::no_address_safety_analysis`` |br| ``gnu::no_sanitize_address`` |br| ``gnu::no_sanitize_thread`` |br| ``clang::no_sanitize_memory``","","","","","Yes" .. _langext-memory_sanitizer: <!-- NOTE: This is where the manually specified label is --> Use ``__attribute__((no_sanitize_memory))`` on a function declaration to ... ``` The result is that a `:ref:langext-memory_sanitizer` link goes into the middle of the attribute documentation, after the name and spelling table. This change simply adds a `Label` field to the root Documentation object and updates the codgen to use it, and removes the currently manually specified labels, after which we can remove the manual label from the doc string above and use the explicit Label field which then results in this generated documentation: ```rst .. _langext-memory_sanitizer: <!-- NOTE: This is where the manually specified label is now --> no_sanitize_memory ------------------ .. csv-table:: Supported Syntaxes :header: "GNU", "C++11", "C23", "``__declspec``", "Keyword", "``#pragma``", "HLSL Annotation", "``#pragma clang attribute``" "``no_address_safety_analysis`` |br| ``no_sanitize_address`` |br| ``no_sanitize_thread`` |br| ``no_sanitize_memory``","``gnu::no_address_safety_analysis`` |br| ``gnu::no_sanitize_address`` |br| ``gnu::no_sanitize_thread`` |br| ``clang::no_sanitize_memory``","``gnu::no_address_safety_analysis`` |br| ``gnu::no_sanitize_address`` |br| ``gnu::no_sanitize_thread`` |br| ``clang::no_sanitize_memory``","","","","","Yes" Use ``__attribute__((no_sanitize_memory))`` on a function declaration to ... ``` This puts the link in a much better location for cross linking documentation https://github.com/llvm/llvm-project/pull/118428 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits