This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Ignore blank spaces between cast's ")" and its sub expr.
ClosedPublic

Authored by hokein on Apr 4 2017, 11:55 PM.

Details

Summary

Before the change:

auto i = (Enum) 5; => auto i = static_cast<Enum>( 5);

After the change:

auto i = (Enum) 5; => auto i = static_cast<Enum>(5);

Diff Detail

Repository
rL LLVM

Event Timeline

hokein created this revision.Apr 4 2017, 11:55 PM
hokein added a subscriber: cfe-commits.
alexfh accepted this revision.May 16 2017, 7:57 AM

Sorry, missed your patch somehow. LG with one nit.

clang-tidy/google/AvoidCStyleCastsCheck.cpp
139 ↗(On Diff #94165)

Why is this only done on non-parenthesized expressions? Will (int) (b) turn into static_cast<int> (b) as well?

This revision is now accepted and ready to land.May 16 2017, 7:57 AM

You might want to commit this at some point ;]

hokein updated this revision to Diff 106219.Jul 12 2017, 8:14 AM
hokein marked an inline comment as done.

Support more cases.

You might want to commit this at some point ;]

I somewhat forgot this minor patch.

clang-tidy/google/AvoidCStyleCastsCheck.cpp
139 ↗(On Diff #94165)

Good point, I have updated the patch to cover more cases. Please take a look again.

alexfh accepted this revision.Jul 12 2017, 9:03 AM

LG. Thanks!

This revision was automatically updated to reflect the committed changes.