This is an archive of the discontinued LLVM Phabricator instance.

[Clang-Tidy] Quick fix for bug in bugprone-macro-parentheses 43804
ClosedPublic

Authored by baloghadamsoftware on Nov 29 2019, 4:38 AM.

Details

Summary

Applying parentheses for statement leads to compilation error. Bug [[ 43804 | https://bugs.llvm.org/show_bug.cgi?id=43804 ]] is a compilation error suggested by a wrong fix of this checker. This patch is a quick fix for this issue.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptNov 29 2019, 4:38 AM
aaron.ballman accepted this revision.Dec 1 2019, 7:58 AM

LGTM, but we may have other things to test (or bugs to fix) here.

clang-tools-extra/test/clang-tidy/checkers/bugprone-macro-parentheses.cpp
46

I'm surprised that do { /* whatever */ } while (0) is not tested as being good -- that's a very common idiom.

This revision is now accepted and ready to land.Dec 1 2019, 7:58 AM

LGTM, but we may have other things to test (or bugs to fix) here.

Oh yes, this check seems a bit incomplete, more statements are missing, but this particular issue was a showstopper in our internal CI loop. (We had to disable this check because of this.)

This revision was automatically updated to reflect the committed changes.