[cfe-dev] Help writing fixits in clang

Jonas Toth via cfe-dev cfe-dev at lists.llvm.org
Thu Dec 13 03:05:38 PST 2018


Hi Andy,


this sounds like a great clang-tidy check in the readability-module. You
can check out the documentation
(https://clang.llvm.org/extra/clang-tidy/) which has a section on
writing the check and emitting diagnostics with fixits.


If you want to produce a standalone tool that does the job, this
information will still be relevant, is it will use the same
functionality of clang.


Best, Jonas


Am 12.12.18 um 11:03 schrieb Andy Gibbs via cfe-dev:
> Hi,
>
> I'd like to add a fixit (or two) to suggest parentheses in the
> following expressions:
>
>   structS { floatvalue; };
>   S operator""_f(longdoublet);
>
>   voidtest() {
>     inti = 0x2e+'a';          // fixit: (0x2e)+'a'
>     floatj = 100.0_e-10.0;    // fixit: (100.0_e)-10.0
>     floatk = 100.0_f.value;   // fixit: (100.0_f).value
>     intl = 0x2e+i;            // fixit: (0x2e)+i
>   }
>
> However, I am not sure of the correct way to do this.
>
> Would someone, please, give me a quick tutorial or, if easier, point
> out an similar example in the clang code.
>
> Many thanks,
> Andy
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181213/57a2a321/attachment.html>


More information about the cfe-dev mailing list