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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon May 13 05:48:42 PDT 2024


https://github.com/AaronBallman commented:

Because doxygen supports documenting macros (https://www.doxygen.nl/manual/commands.html#cmddef), I am worried how often this will cause us to associate comments incorrectly on the declaration.

I wonder if we should be a bit smarter and check for `#define` at the start of a line when we encounter a `#`. e.g.,
```
/*!
  \def DERP(x)
  Does a derpy thing with x
*/
#define DERP(x) (x)

void derp(void); // Does not get the doxygen comment
```
while
```
/// Does amazing things, like works in the presence of
/// #define doing stupid things.
void func(); // does get the doxygen comment
```

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


More information about the cfe-commits mailing list