[clang] [Clang][Comments] Attach comments to decl even if preproc directives are in between (PR #88367)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 3 00:21:53 PDT 2024


================
@@ -107,6 +107,24 @@
 ///    The 2nd source tile. Max size is 1024 Bytes.
 #define _tile_cmmrlfp16ps(dst, a, b) __builtin_ia32_tcmmrlfp16ps(dst, a, b)
 
+/// Perform matrix multiplication of two tiles containing complex elements and
----------------
hdoc wrote:

This is not an unrelated change, I describe the issue in the "Complications" section of the PR body. In short, the `-Wdocumentation` warning gets triggered here because the macro for the `#define` on line 108 has a doc comment which Clang attributes to the function on line 128. Since the params documented in the macro's doc comment don't match the params in the function, `-Wdocumentation` throws an error. 

As a hack, I originally put semicolons on their own line because that effectively splits the decls from `-Wdocumentation`'s point of view, but it's a bit of a dirty hack. Instead, I just added a proper doc comment for the function here which stops the warning without changing the underlying comment parsing functionality. Still a workaround, but cleaner.

Changing that underlying functionality would be a much more involved since the comment parser operates on the AST, at which point most of the preproc info is gone because of how Clang is structured (please correct me if I'm wrong here).

https://github.com/llvm/llvm-project/pull/88367


More information about the cfe-commits mailing list