[PATCH] D66706: [Wdocumentation] fixes an assertion failure with typedefed function and block pointer
Mark de Wever via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 25 11:08:06 PDT 2019
Mordante marked 2 inline comments as done.
Mordante added inline comments.
================
Comment at: clang/lib/AST/Comment.cpp:151
+static bool getFunctionTypeLoc(TypeLoc TL, FunctionTypeLoc &ResFTL,
+ bool testTypedefTypeLoc = false) {
TypeLoc PrevTL;
----------------
gribozavr wrote:
> Why is the new functionality turned off sometimes? It seems to me that we always want to look through typedefs.
Setting `testTypedefTypeLoc` to `true` breaks a unit test in `test/Sema/warn-documentation.cpp:358`
```
typedef int (*test_not_function_like_typedef1)(int aaa);
// expected-warning at +1 {{'\param' command used in a comment that is not attached to a function declaration}}
/// \param aaa Meow.
typedef test_not_function_like_typedef1 test_not_function_like_typedef2;
```
and its corresponding test using a `using` instead of `typedef`. This has been introduced in:
```
commit 49fdf8d3f5e114e6f8b49fde29a30b0eaaa3c5dd
Author: Dmitri Gribenko <gribozavr at gmail.com>
Date: Sat Sep 15 21:13:36 2012 +0000
Comment parsing: don't treat typedef to a typedef to a function as a
'function-like' type that can be annotated with \param.
Thanks to Eli Friedman for noticing!
llvm-svn: 163985
```
I'm not sure whether or not we should allow this typedef documentation. I just tested with Doxygen. It doesn't complain and shows the parameter documentation for `test_not_function_like_typedef2`. So on that basis we could remove this `expected-warning` and `testTypedefTypeLoc`.
What do you think?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66706/new/
https://reviews.llvm.org/D66706
More information about the cfe-commits
mailing list