summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/readability-identifier-naming.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [ClangTidy] Separate tests for infrastructure and checkersDmitri Gribenko2019-10-111-529/+0
| | | | | | | | | | | | | | | | | | | | Summary: This change moves tests for checkers and infrastructure into separate directories, making it easier to find infrastructure tests. Tests for checkers are already easy to find because they are named after the checker. Tests for infrastructure were difficult to find because they were outnumbered by tests for checkers. Now they are in a separate directory. Reviewers: jfb, jdoerfert, lebedev.ri Subscribers: srhines, nemanjai, aheejin, kbarton, christof, mgrang, arphaman, jfb, lebedev.ri, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68807 llvm-svn: 374540
* [clang-tidy] readability-identifier-naming shouldn't complain about CRTP ↵Sam McCall2019-08-281-0/+26
| | | | | | | | | | | | | | pseudo-overrides Reviewers: ilya-biryukov Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66864 llvm-svn: 370193
* Run ClangTidy tests in all C++ language modesDmitri Gribenko2019-05-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Summary: I inspected every test and did one of the following: - changed the test to run in all language modes, - added a comment explaining why the test is only applicable in a certain mode, - limited the test to language modes where it passes and added a FIXME to fix the checker or the test. Reviewers: alexfh, lebedev.ri Subscribers: nemanjai, kbarton, arphaman, jdoerfert, lebedev.ri, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62125 llvm-svn: 361131
* [clang-tidy] Added pointer types to clang-tidy readability-identifier-naming ↵Jonas Toth2018-10-041-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | check. Summary: Option to check for different naming conventions on the following types: - GlobalConstantPointer - GlobalPointer - LocalConstantPointer - LocalPointer - PointerParameter - ConstantPointerParameter When not specified, the conventions for the non pointer types will be applied (GlobalConstant, GlobalVariable, LocalConstant, ...). Patch by ffigueras! Reviewers: alexfh, kbobyrev Reviewed By: alexfh Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D52882 llvm-svn: 343788
* [clang-tidy] Correctly classify constant arrays and constant strings as ↵Alexander Kornienko2017-12-111-0/+53
| | | | | | | | | | | | | | | | | | | | constants when checking identifiers naming Summary: They are not locally const qualified so they weren't classified as constants by the readability-identifier-naming check. Reviewers: alexfh Reviewed By: alexfh Subscribers: klimek, cfe-commits, xazax.hun Patch by Beren Minor! Differential Revision: https://reviews.llvm.org/D39363 llvm-svn: 320406
* [clang-tidy] Update IdentifierNamingCheck to remove extra leading/trailing ↵Alexander Kornienko2017-04-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | underscores Summary: The goal of this change is to fix the following suboptimal replacements currently suggested by clang-tidy: ``` // with MemberPrefix == "_" int __foo; // accepted without complaint ``` ``` // with MemberPrefix == "m_" int _foo; ^~~~~~ m__foo ``` I fixed this by - updating `matchesStyle()` to reject names which have a leading underscore after a prefix has already been stripped, or a trailing underscore if a suffix has already been stripped; - updating `fixupWithStyle()` to strip leading & trailing underscores before adding the user-defined prefix and suffix. The replacements are now: ``` // MemberPrefix == "_" int __foo; ^~~~~~ _foo ``` ``` // MemberPrefix == "m_" int _foo; ^~~~~ m_foo ``` Future improvements might elect to add .clang-tidy flags to improve what is being stripped. For instance, stripping `m_` could allow `m_foo` to be automatically replaced with `_foo`. Reviewers: alexfh Reviewed By: alexfh Subscribers: cfe-commits Patch by Jacob Bandes-Storch! Differential Revision: https://reviews.llvm.org/D32333 llvm-svn: 301431
* [powerpc] deactivate readability-identifier-naming.cpp test on powerpc64leBill Seurer2016-12-131-0/+3
| | | | | | | | | The test case clang-tidy/readability-identifier-naming.cpp segfaults on powerpc64 little endian (starting with r288563) when a bootstrap build/test is done. To get the buildbot running again deactivate the test. When the issue is resolved reactivate it. llvm-svn: 289581
* [clang-tidy] Fix identifier naming for initializer list member initializers.Eric Fiselier2016-11-161-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds handling for member initializers in a constructors initializer list. Previously we only handled base-class and delegating initializers, which are transformed by the `TypeLoc` matcher. For Example: ``` // Style options: All identifiers should start with an upper case letter. struct base { ... }; struct der : base { int field; // FIXES: int Field; der() : der(42) {} // FIXES: Der() : Der(42) {} der(int X) : base(), field(X) {} // FIXES: Der(int X) : Base(), field(X) // Note that `field` doesn't get replaced }; ``` Reviewers: alexfh, hokein, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26744 llvm-svn: 287153
* [clang-tidy] Ignore forward declarations without definitions in the same ↵Jonathan Coe2016-11-031-0/+5
| | | | | | | | | | | | | | translation unit in readability-identifier-naming Summary: This change ensures that forward declarations of classes are not considered for identifier naming checks within a translation unit. Reviewers: alexfh, aaron.ballman Subscribers: mgehre Differential Revision: https://reviews.llvm.org/D22571 llvm-svn: 285907
* [clang-tidy] Fix identifier naming in macro args.Jason Henline2016-10-241-4/+31
| | | | | | | | | | | | | | | | | | | | | | Summary: clang-tidy should fix identifier naming even when the identifier is referenced inside a macro expansion, provided that the identifier enters the macro expansion completely within a macro argument. For example, this will allow fixes to the naming of the identifier 'global' when it is declared and used as follows: int global; #define USE_IN_MACRO(m) auto use_##m = m USE_IN_MACRO(global); Reviewers: alexfh Subscribers: jlebar, cfe-commits Differential Revision: https://reviews.llvm.org/D25450 llvm-svn: 284992
* [clang-tidy] readability-identifier-naming - support for other case typesKirill Bobyrev2016-07-201-5/+5
| | | | | | | | | | | | | | | | | | | Added Camel_Snake_Case and camel_Snake_Back class Camel_Snake_Case_Class_Name { void private_Camel_Snake_Back_Method_Name(); } Patch by James Reynolds! Reviewers: alexfh Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D21472 llvm-svn: 276110
* clang-tidy/readability-identifier-naming: crash on ↵Matthias Gehre2016-07-091-0/+6
| | | | | | | | | | | | | | | | DependentTemplateSpecializationType Summary: Previously, the added test cases crashed because the passed a null Decl to addUsage(). Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D22188 llvm-svn: 274985
* [clang-tidy] readability-identifier-naming - Support for MacrosAlexander Kornienko2016-06-171-0/+13
| | | | | | | | | | | | | | | | | | | | | Summary: Added support for macro definitions. -- 1. Added a pre-processor callback to catch macro definitions 2. Changed the type of the failure map so that macros and declarations can share the same map 3. Added extra tests to ensure fix-ups work using the new map 4. Added fix-ups for type aliases in variable and function declarations as part of adding the new tests Reviewers: alexfh Subscribers: Eugene.Zelenko, cfe-commits Patch by James Reynolds! Differential Revision: http://reviews.llvm.org/D21020 llvm-svn: 272993
* [clang-tidy] readability-identifier-naming - Support for Type AliasesAlexander Kornienko2016-06-071-2/+13
| | | | | | | | | | | | | | Summary: Added support for Type Alias declarations. Reviewers: alexfh Subscribers: cfe-commits Patch by James Reynolds! Differential Revision: http://reviews.llvm.org/D20856 llvm-svn: 271992
* clang-tidy readability identifiers: better diagnostic locationMike Aizatsky2015-12-041-49/+49
| | | | | | | | | | | | Summary: With this change the error reported is on the identifier location itself. It was declaration location before. Reviewers: alexfh Differential Revision: http://reviews.llvm.org/D15203 llvm-svn: 254766
* Switch check_clang_tidy to argparse and add a -resource-dir argument.Manuel Klimek2015-10-221-1/+1
| | | | | | | -resource-dir can be used to inject non-standard resource dirs via the lit site config. llvm-svn: 251021
* Add %check_clang_tidy and %clang_tidy_diff.Manuel Klimek2015-10-221-1/+1
| | | | | | | | | | With this, site specific lit configs can inject parameters into the test scripts if they need site specific parameters. Next up: enable check_clang_tidy to take a resource dir to enable non-standard locations for builtin includes. llvm-svn: 251010
* [clang-tidy] Implement FixitHints for identifier references in ↵Alexander Kornienko2015-10-011-19/+74
| | | | | | | | | | | | | | IdentifierNamingCheck This diff requires http://reviews.llvm.org/D13079 to be applied first. I wasn't sure about how to make patch series in Phabricator, and I wanted to keep the two separate for clarity. It looks like that most cases can be supported with this patch. I'm not totally sure about the actual coverage though. I think that the matchers are very generic, but I'm still not totally fluent with the AST. Patch by Beren Minor! Differential revision: http://reviews.llvm.org/D13081 llvm-svn: 248996
* [clang-tidy] Code factorization and cleanup in IdentifierNamingCheckAlexander Kornienko2015-09-281-0/+2
| | | | | | | | | | | | | | | This is to level the ground a little bit, in preparation for the changes in http://reviews.llvm.org/D13081. Code factorization replaces all insertions to NamingCheckFailures map with a unique addUsage function that does the job. There is also no more difference between the declaration and the references to a given identifier, both cases are treated as ranges in the Usage vector. There is also a check to avoid duplicated ranges to be inserted, which sometimes triggered erroneous replacements. References can now also be added before the declaration of the identifier is actually found; this looks to be the case for example when a templated class uses its parameters to specialize its templated base class. Patch by Beren Minor! Differential revision: http://reviews.llvm.org/D13079 llvm-svn: 248700
* [clang-tidy] Use a python script instead of a shell script to run clang-tidy ↵Alexander Kornienko2015-08-201-2/+1
| | | | | | | | | | | | | | | | | | | tests. Summary: Add check_clang_tidy.py script that is functionally identical to the check_clang_tidy.py, but should also be functional on windows. I've verified that the script works on linux. Would be nice if folks using Windows could test the patch before I break windows bots ;) Reviewers: chapuni, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D12180 llvm-svn: 245583
* clang-tools-extra/test/clang-tidy/readability-identifier-naming.cpp: Appease ↵NAKAMURA Takumi2015-08-191-1/+1
| | | | | | targeting msvc. llvm-svn: 245435
* [clang-tidy] Add new IdentifierNaming checkAlexander Kornienko2015-08-191-0/+266
This check will try to enforce coding guidelines on the identifiers naming. It supports lower_case, UPPER_CASE, camelBack and CamelCase casing and tries to convert from one to another if a mismatch is detected. It also supports a fixed prefix and suffix that will be prepended or appended to the identifiers, regardless of the casing. Many configuration options are available, in order to be able to create different rules for different kind of identifier. In general, the rules are falling back to a more generic rule if the specific case is not configured. http://reviews.llvm.org/D10933 Patch by Beren Minor! llvm-svn: 245429
OpenPOWER on IntegriCloud