llvm-project/clang-tools-extra/clang-tidy/google
Ben Hamilton 969d63ea8c [clang-tidy/google-runtime-int] Allow passing non-bitwidth types to printf()-style APIs
Summary:
The `google-runtime-int` check currently fires on calls like:

  printf("%lu", (unsigned long)foo);

However, the style guide says:

> Where possible, avoid passing arguments of types specified by
> bitwidth typedefs to printf-based APIs.

http://google.github.io/styleguide/cppguide.html#64-bit_Portability

This diff relaxes the check to not fire on parameters to functions
with the `__format__` attribute. (I didn't specifically check
for `__printf__` since there are a few variations.)

Test Plan: New tests added. Ran tests with:
  % make -j16 check-clang-tools

Reviewers: alexfh, bkramer

Reviewed By: alexfh

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D46293

llvm-svn: 331268
2018-05-01 14:48:54 +00:00
..
AvoidCStyleCastsCheck.cpp [clang-tidy] Ignore blank spaces between cast's ")" and its sub expr. 2017-07-12 16:38:59 +00:00
AvoidCStyleCastsCheck.h [clang-tidy] update links to Google Code Style in docs 2016-02-25 14:31:10 +00:00
AvoidThrowingObjCExceptionCheck.cpp do not register matcher for objc-only checks when analyzing non-objc sources to save resources 2018-03-07 18:59:25 +00:00
AvoidThrowingObjCExceptionCheck.h add check to avoid throwing objc exception according to Google Objective-C guide 2017-11-16 01:28:29 +00:00
CMakeLists.txt [clang-tidy] Remove google-runtime-member-string-references 2018-04-05 14:51:01 +00:00
DefaultArgumentsCheck.cpp [clang-tidy] new google-default-arguments check 2016-05-09 13:43:58 +00:00
DefaultArgumentsCheck.h [clang-tidy] new google-default-arguments check 2016-05-09 13:43:58 +00:00
ExplicitConstructorCheck.cpp [clang-tidy] Fix google-explicit-constructor issue with out-of-line conversions 2017-04-18 17:26:00 +00:00
ExplicitConstructorCheck.h [clang-tidy] update links to Google Code Style in docs 2016-02-25 14:31:10 +00:00
ExplicitMakePairCheck.cpp [clang-tools-extra] Format sources with clang-format. NFC. 2016-11-08 07:50:19 +00:00
ExplicitMakePairCheck.h
GlobalNamesInHeadersCheck.cpp [clang-tidy] Unify the way IncludeStyle and HeaderFileExtesions options are used 2017-07-20 12:02:03 +00:00
GlobalNamesInHeadersCheck.h [clang-tidy] Fix/add style guide links. 2016-05-19 09:31:30 +00:00
GlobalVariableDeclarationCheck.cpp [clang-tidy/google] Improve the Objective-C global variable declaration check 🔧 2018-02-25 04:11:26 +00:00
GlobalVariableDeclarationCheck.h Add new check in google module for Objective-C code to ensure global variables follow the naming convention of Google Objective-C Style Guide 2017-11-07 08:53:37 +00:00
GoogleTidyModule.cpp [clang-tidy] Remove google-runtime-member-string-references 2018-04-05 14:51:01 +00:00
IntegerTypesCheck.cpp [clang-tidy/google-runtime-int] Allow passing non-bitwidth types to printf()-style APIs 2018-05-01 14:48:54 +00:00
IntegerTypesCheck.h
NonConstReferences.cpp modernize-use-auto NFC fixes 2016-12-14 15:29:23 +00:00
NonConstReferences.h [clang-tidy] Add a whitelist option in google-runtime-references. 2016-10-10 16:38:11 +00:00
OverloadedUnaryAndCheck.cpp [clang-tools-extra] Format sources with clang-format. NFC. 2016-11-08 07:50:19 +00:00
OverloadedUnaryAndCheck.h [clang-tidy] update links to Google Code Style in docs 2016-02-25 14:31:10 +00:00
TodoCommentCheck.cpp
TodoCommentCheck.h
UnnamedNamespaceInHeaderCheck.cpp [clang-tidy] Unify the way IncludeStyle and HeaderFileExtesions options are used 2017-07-20 12:02:03 +00:00
UnnamedNamespaceInHeaderCheck.h [clang-tidy] update links to Google Code Style in docs 2016-02-25 14:31:10 +00:00
UsingNamespaceDirectiveCheck.cpp Make google-build-using-namespace skip std::.*literals 2017-05-15 17:37:48 +00:00
UsingNamespaceDirectiveCheck.h Make google-build-using-namespace skip std::.*literals 2017-05-15 17:37:48 +00:00