[cfe-dev] [clang-tidy] Is there any way to change function return type for all declarations?

Piotr Padlewski via cfe-dev cfe-dev at lists.llvm.org
Fri May 20 07:17:37 PDT 2016


Hi folks,
Is there any way to change function return type for all declarations? My
use case is:

int foo(); // may be in header

int foo() {
    return true;
    return false;
}

I would like to find functions that have return type of int, but they have
all return statements returning bool, and then change the return type of
this function (for each declaration) to bool.
The matching is duable, but I am wondering if it is possible to do this
fixit. Is there any way to get all declarations of some function?
Also, what happen if I would not see one declaration in this TU, f.e.
because this TU would not include header. I would't want it to result in UB.

Best
Piotr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160520/d6611e1f/attachment.html>


More information about the cfe-dev mailing list