| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
Introduce a new check to upgrade user code based on API changes in Googletest.
The check finds uses of old Googletest APIs with "case" in their name and replaces them with the new APIs named with "suite".
Patch by Alex Strelnikov (strel@google.com)
Reviewed as D62977.
llvm-svn: 367263
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Google's Objective-C style guide forbids calling or overriding +new to instantiate objects. This check warns on violations.
Style guide reference: https://google.github.io/styleguide/objcguide.html#do-not-use-new
Patch by Michael Wyman.
Reviewers: benhamilton, aaron.ballman, JonasToth, gribozavr, ilya-biryukov, stephanemoore, mwyman
Reviewed By: aaron.ballman, gribozavr, stephanemoore, mwyman
Subscribers: stephanemoore, xazax.hun, Eugene.Zelenko, mgorny, cfe-commits
Tags: #clang, #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D61350
llvm-svn: 361487
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Adds a clang-tidy warning for underscores in googletest names.
Patch by Kar Epker!
Reviewers: hokein, alexfh, aaron.ballman
Reviewed By: hokein
Subscribers: Eugene.Zelenko, JonasToth, MyDeveloperDay, lebedev.ri, xazax.hun, mgorny, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D56424
llvm-svn: 352183
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to reflect the new license.
We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.
Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.
llvm-svn: 351636
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Objective-C function naming conventions 📜
Summary:
§1 Description
This check finds function names in function declarations in Objective-C files that do not follow the naming pattern described in the Google Objective-C Style Guide. Function names should be in UpperCamelCase and functions that are not of static storage class should have an appropriate prefix as described in the Google Objective-C Style Guide. The function `main` is a notable exception. Function declarations in expansions in system headers are ignored.
Example conforming function definitions:
```
static bool IsPositive(int i) { return i > 0; }
static bool ABIsPositive(int i) { return i > 0; }
bool ABIsNegative(int i) { return i < 0; }
```
A fixit hint is generated for functions of static storage class but otherwise the check does not generate a fixit hint because an appropriate prefix for the function cannot be determined.
§2 Test Notes
* Verified clang-tidy tests pass successfully.
* Used check_clang_tidy.py to verify expected output of processing google-objc-function-naming.m
Reviewers: benhamilton, hokein, Wizard, aaron.ballman
Reviewed By: benhamilton
Subscribers: Eugene.Zelenko, mgorny, xazax.hun, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D51575
llvm-svn: 347132
|
|
|
|
|
|
|
|
| |
I don't remember why I added it, but it's definitely not needed, since the check
doesn't have any options and the check doesn't have any special relation to the
Google C++ style.
llvm-svn: 335252
|
|
|
|
|
|
|
|
|
|
| |
This is triggering on a pattern that's both too broad (const
std::string& members can be used safely) and too narrow (std::string is
not the only class with this problem). It has a very low true positive
rate, just remove it until we find a better solution for dangling string
references.
llvm-svn: 329292
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This is a small check to avoid throwing objc exceptions.
In specific it will detect the usage of @throw statement and throw warning.
Reviewers: hokein, benhamilton
Reviewed By: hokein, benhamilton
Subscribers: cfe-commits, mgorny
Differential Revision: https://reviews.llvm.org/D40058
llvm-svn: 318366
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
variables follow the naming convention of Google Objective-C Style Guide
Summary:
This is a new checker for objc files in clang-tidy.
The new check finds global variable declarations in Objective-C files that are not follow the pattern of variable names in Google's Objective-C Style Guide.
All the global variables should follow the pattern of "g[A-Z].*" (variables) or "k[A-Z].*" (constants). The check will suggest a variable name that follows the pattern
if it can be inferred from the original name.
Patch by Yan Zhang!
Reviewers: benhamilton, hokein, alexfh
Reviewed By: hokein
Subscribers: Eugene.Zelenko, mgorny
Differential Revision: https://reviews.llvm.org/D39391
llvm-svn: 317552
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Created new module bugprone and placed the check in that.
Finds memset() calls with potential mistakes in their arguments.
Replaces and extends the existing google-runtime-memset-zero-length check.
Cases covered:
* Fill value is a character '0'. Integer 0 might have been intended.
* Fill value is out of char range and gets truncated.
* Byte count is zero. Potentially swapped with the fill value argument.
Patch by: Reka Nikolett Kovacs
Differential Revision: https://reviews.llvm.org/D32700
llvm-svn: 308020
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Ran clang-format on all .c/.cpp/.h files in clang-tools-extra.
Excluded the test, unittests, clang-reorder-fields, include-fixer, modularize and pptrace directories.
Reviewers: klimek, alexfh
Subscribers: nemanjai
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D26329
llvm-svn: 286221
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
To check the google style guide rule here:
https://google.github.io/styleguide/cppguide.html#Default_Arguments
Patch by Clement Courbet!
Reviewers: hokein
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D19534
llvm-svn: 268919
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: This is implemented originally by Alexander Kornienko.
Reviewers: alexfh
Subscribers: cfe-commits
Patch by Haojian Wu!
Differential Revision: http://reviews.llvm.org/D16717
llvm-svn: 259530
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
readability-named-parameter.
Summary: The relevant style rule is going to be removed, thus the check is no longer needed in the Google module. Leaving the check in readability/ in case someone needs it.
Reviewers: djasper
Reviewed By: djasper
Subscribers: curdeius, cfe-commits
Differential Revision: http://reviews.llvm.org/D8261
llvm-svn: 232431
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to follow naming conventions
Classes are named WhateverCheck, files are WhateverCheck.cpp and`
WhateverCheck.h`
http://reviews.llvm.org/D8144
Patch by Richard Thomson!
llvm-svn: 231650
|
|
|
|
|
|
|
|
|
|
| |
clang::tidy::google
http://reviews.llvm.org/D7994
Patch by Richard Thomson!
llvm-svn: 231364
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
google-global-names-in-headers flags global namespace pollution in header files.
Right now it only triggers on using declarations and directives.
Reviewers: alexfh
Subscribers: curdeius
Differential Revision: http://reviews.llvm.org/D7563
llvm-svn: 228875
|
|
|
|
|
|
|
| |
No functionality changed, this is just a mechanical cleanup to keep the
order of #include lines consistent across the project.
llvm-svn: 225976
|
|
|
|
|
|
| |
This value is used in cpplint, so we'd better be consistent.
llvm-svn: 222431
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Register readability checks in a separate module. Renamed the checks
and test file names accordingly.
Reviewers: djasper, klimek
Reviewed By: klimek
Subscribers: curdeius, cfe-commits
Differential Revision: http://reviews.llvm.org/D5936
llvm-svn: 220631
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This patch allows modules to specify default options for the checks
defined in them. This way a sufficiently configurable check can be registered in
multiple modules with different default options. E.g. the SpacesBeforeComments
option may be set to 1 for the "llvm-namespace-comments" check and to 2 for the
"google-readability-namespace-comment" check without modifying or extending the
check code.
This patch also registers the google-readability-braces-around-statements check
with suitable defaults.
Reviewers: djasper
Reviewed By: djasper
Subscribers: curdeius, cfe-commits
Differential Revision: http://reviews.llvm.org/D5798
llvm-svn: 219923
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This uses a bit hacky way to set the defaults for the spaces before
comments, but it's also one of the simplest ways. Fixed a bug with how the
SpacesBeforeComments option was used.
Reviewers: djasper
Reviewed By: djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5410
llvm-svn: 218240
|
|
|
|
|
|
|
|
|
| |
It also suggests a fix-it, taking the name from $USER. This will be made
configurable eventually.
Differential Revision: http://reviews.llvm.org/D5393
llvm-svn: 218049
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
addCheckFactory: registerCheck.
Reviewers: djasper
Reviewed By: djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5288
llvm-svn: 217489
|
|
|
|
|
|
|
|
| |
fixed-size types.
Differential Revision: http://reviews.llvm.org/D5119
llvm-svn: 216726
|
|
|
|
|
|
|
|
|
|
|
|
| |
If there's memset(x, y, 0) in the code it's most likely a mistake. The
checker suggests a fix-it to swap 'y' and '0'.
I think this has the potential to be promoted into a general clang warning
after some testing in clang-tidy.
Differential Revision: http://reviews.llvm.org/D4535
llvm-svn: 213155
|
|
|
|
|
|
|
|
|
|
| |
This change contains of two checkers that warn about
1. anonymous namespaces in header files.
2. 'using namespace' directives everywhere.
Differential Revision: http://reviews.llvm.org/D4523
llvm-svn: 213153
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Those are considered unsafe and should be replaced with simple pointers or
full copies. It recognizes both std::string and ::string.
Reviewers: alexfh, djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4522
llvm-svn: 213133
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
We still allow the escape hatch foo(int /*x*/) and also suggest this
in a fixit. This is more powerful than the corresponding cpplint.py check
it also flags functions with multiple arguments as naming all arguments is
recommended by the google style guide.
Reviewers: alexfh, djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4518
llvm-svn: 213075
|
|
|
|
|
|
|
|
|
|
| |
operator&
This handles both methods and freestanding overloads.
Differential Revision: http://reviews.llvm.org/D4498
llvm-svn: 213067
|
|
|
|
|
|
|
|
|
|
|
| |
Those may be incompatible with C++11 and are unnecessary. We suggest
removing the template arguments when they match the types of the make_pair
arguments or replace it with std::pair and explicit template arguments when
not.
Differential Revision: http://reviews.llvm.org/D4497
llvm-svn: 213058
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The first version failed the SubstNonTypeTempateParmExpr-related test
on some buildbots. This one uses the new substNonTypeTempateParmExpr matcher to
filter out implicit C-style casts.
This patch depends on D4327.
Reviewers: djasper
Reviewed By: djasper
Subscribers: aemerson, cfe-commits
Differential Revision: http://reviews.llvm.org/D4328
llvm-svn: 212002
|
|
|
|
|
|
| |
http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/13505/steps/check-all/logs/Clang%20Tools%3A%3Ac-style-casts.cpp
llvm-svn: 211708
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Add a check to flag the usage of C-style casts, as per Google Style
Guide:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Casting#Casting
Reviewers: djasper
Reviewed By: djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4189
llvm-svn: 211702
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: No functional changes.
Reviewers: djasper
Reviewed By: djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4188
llvm-svn: 211154
|
|
|
|
| |
llvm-svn: 209062
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
defined in a macro.
Summary:
We shouldn't suggest replacements in macros anyway, as we can't see all
usages of the macro and ensure the replacement is safe for all of them.
Reviewers: klimek
Reviewed By: klimek
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D3611
llvm-svn: 207987
|
|
|
|
|
|
| |
Make the tests for removal of 'explicit' more diverse.
llvm-svn: 207534
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The Google C++ Style Guide doesn't require copy constructors to be
declared explicit, but some people do this by mistake. Make this check detect
and fix such cases.
Reviewers: djasper
Reviewed By: djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D3541
llvm-svn: 207531
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Explicit_Constructors
"The exception is copy constructors, which, in the rare cases when we allow
them, should probably not be explicit."
Reviewers: klimek
Reviewed By: klimek
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D3122
llvm-svn: 204322
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: klimek
Reviewed By: klimek
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D3116
llvm-svn: 204226
|
|
|
|
| |
llvm-svn: 202969
|
|
|
|
| |
llvm-svn: 202632
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: klimek
Reviewed By: klimek
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2894
llvm-svn: 202392
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
I'm not absolutely sure this is 100% correct solution, but it seems to
do what I expect.
Reviewers: djasper, klimek
Reviewed By: djasper
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2756
llvm-svn: 201308
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Pass check names all the way from ClangTidyModule through
ClangTidyCheck and ClangTidyContext to ClangTidyError, and output it in
handleErrors. This allows to find mis-behaving check and disable it easily.
Reviewers: djasper, klimek
Reviewed By: djasper
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2534
llvm-svn: 199094
|
|
|
|
|
|
|
|
|
|
| |
always produce as pretty of results as it does in LLVM and Clang, but
I don't mind and the value of having a single canonical ordering is very
high IMO.
Let me know if you spot really serious problems here.
llvm-svn: 198703
|
|
This is the first version of a possible clang-tidy architecture. The
purpose of clang-tidy is to detect errors in adhering to common coding
patterns, e.g. described in the LLVM Coding Standards.
This is still heavily in flux.
Review: http://llvm-reviews.chandlerc.com/D884
llvm-svn: 187345
|