<div dir="ltr"><div dir="ltr"><div class="gmail_default">I was uncertain whether or not this change required new tests. A previous change which disabled this check in languages other than C++ did not include additional tests:</div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><a href="https://github.com/llvm/llvm-project/commit/ec3e5d6fd87862eb77a2b0320d79b9a4427d39df#diff-a491be84e1b831aeaea56c39b5eb898c">https://github.com/llvm/llvm-project/commit/ec3e5d6fd87862eb77a2b0320d79b9a4427d39df#diff-a491be84e1b831aeaea56c39b5eb898c</a></font><br></div><div class="gmail_default"><br></div><div class="gmail_default">If there is a preference to add tests for this change, I can do so.</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 13, 2019 at 3:21 PM Roman Lebedev <<a href="mailto:lebedev.ri@gmail.com">lebedev.ri@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">test?<br>
<br>
On Thu, Mar 14, 2019 at 1:17 AM Stephane Moore via Phabricator via<br>
cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br>
><br>
> stephanemoore created this revision.<br>
> Herald added subscribers: cfe-commits, jdoerfert, xazax.hun.<br>
> Herald added a project: clang.<br>
><br>
> In contrast to Google C++, Objective-C often uses built-in integer types<br>
> other than `int`. In fact, the Objective-C runtime itself defines the<br>
> types NSInteger¹ and NSUInteger² which are variant types depending on<br>
> the target architecture. The Objective-C style guide indicates that<br>
> usage of system types with variant sizes is appropriate when handling<br>
> values provided by system interfaces³. Objective-C++ is commonly the<br>
> result of conversion from Objective-C to Objective-C++ for the purpose<br>
> of integrating C++ functionality. The opposite of Objective-C++ being<br>
> used to expose Objective-C functionality to C++ is less common,<br>
> potentially because Objective-C has a signficantly more uneven presence<br>
> on different platforms compared to C++. This generally predisposes<br>
> Objective-C++ to commonly being more Objective-C than C++. Forcing<br>
> Objective-C++ developers to perform conversions between variant system types<br>
> and fixed size integer types depending on target architecture when<br>
> Objective-C++ commonly uses variant system types from Objective-C is<br>
> likely to lead to more bugs and overhead than benefit. For that reason,<br>
> this change proposes to disable google-runtime-int in Objective-C++.<br>
><br>
> [1] <a href="https://developer.apple.com/documentation/objectivec/nsinteger?language=objc" rel="noreferrer" target="_blank">https://developer.apple.com/documentation/objectivec/nsinteger?language=objc</a><br>
> [2] <a href="https://developer.apple.com/documentation/objectivec/nsuinteger?language=objc" rel="noreferrer" target="_blank">https://developer.apple.com/documentation/objectivec/nsuinteger?language=objc</a><br>
> [3] "Types long, NSInteger, NSUInteger, and CGFloat vary in size between<br>
> 32- and 64-bit builds. Use of these types is appropriate when handling<br>
> values exposed by system interfaces, but they should be avoided for most<br>
> other computations."<br>
> <a href="https://github.com/google/styleguide/blob/gh-pages/objcguide.md#types-with-inconsistent-sizes" rel="noreferrer" target="_blank">https://github.com/google/styleguide/blob/gh-pages/objcguide.md#types-with-inconsistent-sizes</a><br>
><br>
><br>
> Repository:<br>
>   rG LLVM Github Monorepo<br>
><br>
> <a href="https://reviews.llvm.org/D59336" rel="noreferrer" target="_blank">https://reviews.llvm.org/D59336</a><br>
><br>
> Files:<br>
>   clang-tools-extra/clang-tidy/google/IntegerTypesCheck.cpp<br>
><br>
><br>
> Index: clang-tools-extra/clang-tidy/google/IntegerTypesCheck.cpp<br>
> ===================================================================<br>
> --- clang-tools-extra/clang-tidy/google/IntegerTypesCheck.cpp<br>
> +++ clang-tools-extra/clang-tidy/google/IntegerTypesCheck.cpp<br>
> @@ -54,7 +54,9 @@<br>
><br>
>  void IntegerTypesCheck::registerMatchers(MatchFinder *Finder) {<br>
>    // Find all TypeLocs. The relevant Style Guide rule only applies to C++.<br>
> -  if (!getLangOpts().CPlusPlus)<br>
> +  // This check is also not applied in Objective-C++ sources as Objective-C<br>
> +  // often uses built-in integer types other than `int`.<br>
> +  if (!getLangOpts().CPlusPlus || getLangOpts().ObjC)<br>
>      return;<br>
>    // Match any integer types, unless they are passed to a printf-based API:<br>
>    //<br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div>