This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy/google-readability-casting] Disable check for Objective-C++
ClosedPublic

Authored by benhamilton on May 9 2018, 12:17 PM.

Details

Summary

Previously, google-readability-casting was disabled for Objective-C.

The Google Objective-C++ style allows both Objective-C and
C++ style in the same file. Since clang-tidy doesn't have a good
way to allow multiple styles per file, this disables the
check for Objective-C++.

Test Plan: New tests added. Ran tests with:

% make -j16 check-clang-tools
Before diff, confirmed tests failed:
https://reviews.llvm.org/P8081
After diff, confirrmed tests passed.

Diff Detail

Repository
rL LLVM

Event Timeline

benhamilton created this revision.May 9 2018, 12:17 PM
benhamilton edited the summary of this revision. (Show Details)May 9 2018, 12:21 PM
Wizard accepted this revision.May 9 2018, 12:55 PM
This revision is now accepted and ready to land.May 9 2018, 12:55 PM

An alternative implementation would be to allow C-style casts (either always or only for ObjC objects) within Objective-C methods inside Objective-C++ files, but that may get messy with things like shared macros.

  • Change to simply disable check for Objective-C++
benhamilton retitled this revision from [clang-tidy/google-readability-casting] Allow C-style casts to/from Objective-C object types to [clang-tidy/google-readability-casting] Disable check for Objective-C++.May 16 2018, 8:36 AM
benhamilton edited the summary of this revision. (Show Details)

After discussion, I changed this diff to simply disable the check altogether for Objective-C++.

stephanemoore accepted this revision.May 16 2018, 12:23 PM
stephanemoore added inline comments.
clang-tidy/google/AvoidCStyleCastsCheck.cpp
103–104 ↗(On Diff #147102)

In the future it would probably be good to allow configuring whether or not this is disabled but I think that disabling it for Objective-C++ completely in the interim is a positive change.

benhamilton added inline comments.May 16 2018, 1:10 PM
clang-tidy/google/AvoidCStyleCastsCheck.cpp
103–104 ↗(On Diff #147102)
This revision was automatically updated to reflect the committed changes.