[PATCH] D72217: [clang-tidy] Added readability-qualified-auto check

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 7 09:46:32 PST 2020


JonasToth added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/readability-qualified-auto.cpp:183
+
+  auto LambdaTest = [] { return 0; };
+  // CHECK-MESSAGES-NOT: :[[@LINE-1]]:3: warning: 'auto LambdaTest' can be declared as 'auto *LambdaTest'
----------------
njames93 wrote:
> JonasToth wrote:
> > How does that beatiful code-construct get handled?
> > 
> > ```
> > auto * function_ptr = +[](int) {};
> > ```
> > The lambda is actually converted to a function pointer through the `+`-operator. Not sure this happens anywhere, but it can happen.
> > So the case:
> > ```
> > auto unnotice_ptr = +[](int) {};
> > ```
> > should be transformed.
> It gets handled the same as retty (*)(params), I should probably make function pointers in general not be converted
Ok.
There exist function references, too  `int (&my_reference) (int);` ( i think that was the syntax).
They should then follow this as well (+ user-facing documentation).


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

https://reviews.llvm.org/D72217





More information about the cfe-commits mailing list