[PATCH] D56160: [clang-tidy] modernize-use-trailing-return check

Bernhard Manfred Gruber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 2 16:17:58 PST 2019


bernhardmgruber marked 2 inline comments as done.
bernhardmgruber added inline comments.


================
Comment at: test/clang-tidy/modernize-use-trailing-return.cpp:2
+// RUN: %check_clang_tidy %s modernize-use-trailing-return %t -- -- --std=c++14
+
+namespace std {
----------------
aaron.ballman wrote:
> lebedev.ri wrote:
> > Missing test coverage:
> > * macros
> > * is there tests for implicit functions?
> > * Out-of-line function with body.
> Also:
>   * functions with attributes in the type position `int f() [[]];`
>   * functions without attributes in the type position `[[]] int f();` and `int f [[]] ();`
>   * lambdas?
>   * Special functions without return types, like constructors and destructors
>   * Conversion operators. `struct S {  operator int() const; };`
@lebedev.ri: I do not understand what kind of tests I should write for macros. Do you mean to rewrite functions inside macro definitions as well?

like rewriting
```
#define DEFINE_F int f();
```
into

```
#define DEFINE_F auto f() -> int;
```

Apart from that, I believe a lot of difficult trickery can be done with macros and I am fine without supporting those (i.e. omitting a possible rewrite, erroneus replacements should never happen). Can you come up with a particular example you would like to be rewritten?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56160/new/

https://reviews.llvm.org/D56160





More information about the cfe-commits mailing list