This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Tweak diagnostics for bugprone-assign-in-if-condition
ClosedPublic

Authored by njames93 on Aug 27 2022, 12:45 PM.

Details

Summary

Currently the diagnostic is printed at the start of the assignment expression, This can be misleading.
Having the location for the diagnostic be the location of the assignment operator is much more intuitive.

Diff Detail

Event Timeline

njames93 created this revision.Aug 27 2022, 12:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2022, 12:45 PM
njames93 requested review of this revision.Aug 27 2022, 12:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2022, 12:45 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
njames93 updated this revision to Diff 456144.Aug 27 2022, 12:46 PM

Remove unnecessary includes added.

gribozavr2 accepted this revision.Aug 27 2022, 3:08 PM
gribozavr2 added inline comments.
clang-tools-extra/clang-tidy/bugprone/AssignmentInIfConditionCheck.cpp
66–67

Drive-by comment -- an Expr is not a Decl (feel free to defer to a separate patch).

This revision is now accepted and ready to land.Aug 27 2022, 3:08 PM
This revision was automatically updated to reflect the committed changes.
njames93 marked an inline comment as done.