clang-tidy in the command line you gave didn't seem to modify the file for me, did it modify the file for you?
Are you objecting to the suggestion, or that it was automatically applied? I would think it'd be a bug to apply any fixit/hint if there are multiple possible suggestions. But the existence of the suggestion (without the application of it) to the user seems right to me. The use of extra () to suppress the assignment-in-conditional warning (-Wparentheses) has been around for quite a while, so it's possible that the user intended assignment rather than comparison when they added the extra parentheses. - Dave On Sun, Oct 27, 2019 at 11:32 AM Robert Ankeney via cfe-users < cfe-users@lists.llvm.org> wrote: > For the following code (wrong.cpp): > > bool check(bool isValid) > { > bool retVal = false; > > if (( isValid == true )) > { > retVal = true; > } > > return retVal; > } > > when I run: > clang-tidy -checks=modernize-use-default-member-init wrong.cpp > > I get: > 4 warnings and 1 error generated. > Error while processing /llvm/match/ctBad/wrong.cpp. > /llvm/match/ctBad/wrong.cpp:5:19: error: equality comparison with > extraneous parentheses [clang-diagnostic-parentheses-equality] > if (( isValid == true )) > ~ ^~ ~ > = > /llvm/match/ctBad/wrong.cpp:5:19: note: remove extraneous parentheses > around the comparison to silence this warning > /llvm/match/ctBad/wrong.cpp:5:19: note: use '=' to turn this equality > comparison into an assignment > > Note it turns the if into: > if ( isValid = true ) > > Seems like a very bad idea. Removing the redundant parentheses seems fine, > but changing the comparison to an assignment does not. Is this a bug? > > Thanks, > Robert > > _______________________________________________ > cfe-users mailing list > cfe-users@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users >
_______________________________________________ cfe-users mailing list cfe-users@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users