[PATCH] D55640: [clang-tidy] Implement a check for large Objective-C type encodings 🔍

Stephane Moore via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 12 19:25:29 PST 2018


stephanemoore created this revision.
Herald added subscribers: cfe-commits, jfb, xazax.hun, mgorny.

Objective-C type encodings are normally pretty small but they it is
pretty easy for them to bloat to undesirable levels. Bloated Objective-C
type encodings are particularly common for Objective-C methods with
templated C++ types in their interface in Objective-C++. For example,
in Objective-C type encodings `std::string` expands to 277 bytes and
`std::map<std::string, std::string>` expands to 1219 bytes. The bloat
isn't particularly important for larger binaries but SDKs sometimes
optimize their binary size to ease adoption. This check aims to provide
some level of visibility into the size of generated Objective-C type
encodings so that developers can address them if they want.

Related article:
https://medium.com/@dmaclach/objective-c-encoding-and-you-866624cc02de

Test Notes:
Verified clang-tidy tests pass successfully.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D55640

Files:
  clang-tidy/objc/CMakeLists.txt
  clang-tidy/objc/ObjCTidyModule.cpp
  clang-tidy/objc/TypeEncodingSizeCheck.cpp
  clang-tidy/objc/TypeEncodingSizeCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/objc-type-encoding-size.rst
  test/clang-tidy/objc-type-encoding-size.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55640.177995.patch
Type: text/x-patch
Size: 10168 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181213/eb18a0d9/attachment-0001.bin>


More information about the cfe-commits mailing list