summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tidy] Cosmetic fixZinovy Nis2019-03-201-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D57662 llvm-svn: 356548
* [clang-tidy] Parallelize clang-tidy-diff.pyZinovy Nis2019-03-201-25/+146
| | | | | | | | | | | This patch has 2 rationales: - large patches lead to long command lines and often cause max command line length restrictions imposed by OS; - clang-tidy runs on modified files are independent and can be done in parallel, the same as done for run-clang-tidy. Differential Revision: https://reviews.llvm.org/D57662 llvm-svn: 356547
* Fixed global constant/variable naming check on C++ class for ObjC++ files.Yan Zhang2019-03-151-0/+4
| | | | | | | | | | Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59283 llvm-svn: 356220
* [clang-tidy] Add additional patterns to the ↵Hyrum Wright2019-03-141-6/+30
| | | | | | | | abseil-duration-unnecessary-conversion check. Differential Revision: https://reviews.llvm.org/D59183 llvm-svn: 356141
* [clang-tidy] NOLINT support for "clang-diagnostic-*".Haojian Wu2019-03-122-10/+8
| | | | | | | | | | | | | | Reviewers: alexfh, aaron.ballman Reviewed By: alexfh Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59255 llvm-svn: 355934
* [clang-tidy] Add the abseil-time-compare checkHyrum Wright2019-03-116-8/+114
| | | | | | | | | This is an analog of the abseil-duration-comparison check, but for the absl::Time domain. It has a similar implementation and tests. Differential Revision: https://reviews.llvm.org/D58977 llvm-svn: 355835
* [clang-tidy] NFC: Negate the name and semantics of the isNotInMacro function.Hyrum Wright2019-03-085-10/+9
| | | | | | | This function is always used in a context where its result was also negated, which made for confusing naming and code. llvm-svn: 355702
* [clang-tidy] Fix bugprone-string-constructor crashAlexander Kornienko2019-03-051-1/+2
| | | | llvm-svn: 355401
* [build] Rename clang-headers to clang-resource-headersShoaib Meenai2019-03-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The current install-clang-headers target installs clang's resource directory headers. This is different from the install-llvm-headers target, which installs LLVM's API headers. We want to introduce the corresponding target to clang, and the natural name for that new target would be install-clang-headers. Rename the existing target to install-clang-resource-headers to free up the install-clang-headers name for the new target, following the discussion on cfe-dev [1]. I didn't find any bots on zorg referencing install-clang-headers. I'll send out another PSA to cfe-dev to accompany this rename. [1] http://lists.llvm.org/pipermail/cfe-dev/2019-February/061365.html Reviewers: beanz, phosek, tstellar, rnk, dim, serge-sans-paille Subscribers: mgorny, javed.absar, jdoerfert, #sanitizers, openmp-commits, lldb-commits, cfe-commits, llvm-commits Tags: #clang, #sanitizers, #lldb, #openmp, #llvm Differential Revision: https://reviews.llvm.org/D58791 llvm-svn: 355340
* Fix file headers. NFCFangrui Song2019-03-019-9/+9
| | | | llvm-svn: 355188
* [clang-tidy] add OverrideMacro to modernize-use-override checkPaul Hoad2019-02-282-20/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The usefulness of **modernize-use-override** can be reduced if you have to live in an environment where you support multiple compilers, some of which sadly are not yet fully C++11 compliant some codebases have to use override as a macro OVERRIDE e.g. ``` // GCC 4.7 supports explicit virtual overrides when C++11 support is enabled. ``` This allows code to be compiled with C++11 compliant compilers and get warnings and errors that clang, MSVC,gcc can give, while still allowing other legacy pre C++11 compilers to compile the code. This can be an important step towards modernizing C++ code whilst living in a legacy codebase. When it comes to clang tidy, the use of the **modernize-use-override** is one of the most useful checks, but the messages reported are inaccurate for that codebase if the standard approach is to use the macros OVERRIDE and/or FINAL. When combined with fix-its that introduce the C++11 override keyword, they become fatal, resulting in the modernize-use-override check being turned off to prevent the introduction of such errors. This revision, allows the possibility for the replacement **override **to be a macro instead, Allowing the clang-tidy check to be run on both pre and post C++11 code, and allowing fix-its to be applied. Reviewers: alexfh, JonasToth, hokein, Eugene.Zelenko, aaron.ballman Reviewed By: alexfh, JonasToth Subscribers: lewmpk, malcolm.parsons, jdoerfert, xazax.hun, cfe-commits, llvm-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D57087 llvm-svn: 355132
* [clang-tidy] added cppcoreguidelines-explicit-virtual-functionsJonas Toth2019-02-283-2/+24
| | | | | | | | | | | | Addresses the bugzilla bug #30397. (https://bugs.llvm.org/show_bug.cgi?id=30397) modernize-use-override suggests that destructors require the override specifier and the CPP core guidelines do not recommend this. Patch by lewmpk. Differential Revision: https://reviews.llvm.org/D58731 llvm-svn: 355093
* [clang-tidy] bugprone-string-integer-assignment: Reduce false positives.Clement Courbet2019-02-281-0/+29
| | | | | | | | | | | | | | Summary: Detect a few expressions as likely character expressions, see PR27723. Reviewers: xazax.hun, alexfh Subscribers: rnkovacs, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58609 llvm-svn: 355089
* [clang-tidy] misc-string-integer-assignment: fix false positiveClement Courbet2019-02-281-2/+7
| | | | | | | | | | | | | | | | | | | | Summary: using CodePoint = uint32_t; CodePoint cp; basic_string<CodePoint> s; s += cp; See PR27723. Reviewers: xazax.hun, alexfh Subscribers: rnkovacs, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58606 llvm-svn: 355076
* [clang-tidy] Add the abseil-time-subtraction checkHyrum Wright2019-02-276-0/+285
| | | | | | Differential Revision: https://reviews.llvm.org/D58137 llvm-svn: 355024
* [clang-tidy] undo bitfields in ExceptionAnalyzerJonas Toth2019-02-261-4/+2
| | | | | | | Scoped enums do induce some problems with some MSVC and GCC versions if used as bitfields. Therefor this is deactivated for now. llvm-svn: 354903
* [clang-tidy] misc-string-integer-assignment: ignore toupper/tolowerClement Courbet2019-02-251-4/+9
| | | | | | | | | | | | | | Summary: Tis represents ~20% of false positives. See PR27723. Reviewers: xazax.hun, alexfh Subscribers: rnkovacs, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58604 llvm-svn: 354780
* Attempt to fix VS2015 build breakage from r354517. NFCI.Douglas Yung2019-02-211-1/+1
| | | | llvm-svn: 354545
* [clang-tidy] Make google-objc-function-naming ignore implicit functions 🙈Stephane Moore2019-02-211-3/+7
| | | | | | | | | | | | | | | | | | | | | | Summary: Implicit functions are outside the control of source authors and should be exempt from style restrictions. Tested via running clang tools tests. This is an amended followup to https://reviews.llvm.org/D57207 Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: jdoerfert, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58095 llvm-svn: 354534
* [clang-tidy] refactor ExceptionAnalyzer further to give ternary answerJonas Toth2019-02-203-83/+271
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The analsis on the throwing behvaiour on functions and statements gave only a binary answer whether an exception could occur and if yes which types are thrown. This refactoring allows keeping track if there is a unknown factor, because the code calls to some functions with unavailable source code with no `noexcept` information. This 'potential Unknown' information is propagated properly and can be queried separately. Reviewers: lebedev.ri, aaron.ballman, baloghadamsoftware, alexfh Reviewed By: lebedev.ri, baloghadamsoftware Subscribers: xazax.hun, rnkovacs, a.sidorin, Szelethus, donat.nagy, dkrupp, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57883 llvm-svn: 354517
* Update property prefix regex to allow numbers.Yan Zhang2019-02-201-10/+9
| | | | | | | | Subscribers: jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D56896 llvm-svn: 354485
* [clang-tidy][NFCI] DanglingHandleCheck: Remove a superflous IgnoreParenImpCastsBruno Ricci2019-02-171-3/+2
| | | | | | | | | | | | ExprWithCleanups is currently not skipped by IgnoreParenImpCasts, but is skipped by IgnoreImpCasts. In view of fixing this inconsistency in D57267, remove the IgnoreParenImpCasts between the ReturnStmt and the ExprWithCleanups which is not needed since ExprWithCleanups is always created as a direct child of ReturnStmt (by inspection of each ReturnStmt::Create in Sema/SemaStmt.cpp). NFC intended. llvm-svn: 354228
* [clang-tidy] Delete obsolete objc-property-declaration options ✂️Stephane Moore2019-02-162-23/+2
| | | | | | | | | | | | | | | | | | | | | | Summary: The Acronyms and IncludeDefaultAcronyms options were deprecated in https://reviews.llvm.org/D51832. These options can be removed. Tested by running the clang-tidy tests. This is an amended resubmission of https://reviews.llvm.org/D56945. Reviewers: Eugene.Zelenko, aaron.ballman Reviewed By: aaron.ballman Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57080 llvm-svn: 354195
* [clang-tidy] Don't use assignment for value-initialized enumsMalcolm Parsons2019-02-081-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The modernize-use-default-member-init check crashes when trying to create an assignment value for a value-initialized enum because it isn't a BuiltinType. An enum cannot be initialized by assigning 0 to it unless a cast is added. It could be initialized with an enumerator with the value 0, but there might not be one. Avoid these issues by ignoring the UseAssignment setting for value-initialized enums. Fixes PR35050. Reviewers: aaron.ballman, alexfh, JonasToth Reviewed By: JonasToth Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57852 llvm-svn: 353554
* [clang-tidy] Add options to bugprone-argument-comment to add missing ↵Paul Hoad2019-02-082-12/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | argument comments to literals bugprone-argument-comment only supports identifying those comments which do not match the function parameter name This revision add 3 options to adding missing argument comments to literals (granularity on type is added to control verbosity of fixit) ``` CheckOptions: - key: bugprone-argument-comment.CommentBoolLiterals value: '1' - key: bugprone-argument-comment.CommentFloatLiterals value: '1' - key: bugprone-argument-comment.CommentIntegerLiterals value: '1' - key: bugprone-argument-comment.CommentStringLiterals value: '1' - key: bugprone-argument-comment.CommentCharacterLiterals value: '1' - key: bugprone-argument-comment.CommentUserDefinedLiterals value: '1' - key: bugprone-argument-comment.CommentNullPtrs value: '1' ``` After applying these options, literal arguments will be preceded with /*ParameterName=*/ Reviewers: JonasToth, Eugene.Zelenko, alexfh, hokein, aaron.ballman Reviewed By: aaron.ballman, Eugene.Zelenko Differential Revision: https://reviews.llvm.org/D57674 llvm-svn: 353535
* [clang-tidy][NFC] Fix typo.Yitzhak Mandelbaum2019-02-081-1/+1
| | | | | | Fix placement of comma from previous (test) commit. llvm-svn: 353525
* [clang-tidy][NFC] Test commit. Add missing comma.Yitzhak Mandelbaum2019-02-081-2/+2
| | | | llvm-svn: 353523
* [clang-tidy] Fixed a std::bind() transformationJonas Toth2019-02-071-1/+1
| | | | | | | | There was an extra semicolon that was somehow working in some contexts. Patch by oleg.smolsky. llvm-svn: 353389
* [clang-tidy] modernize-avoid-c-arrays: avoid main function (PR40604)Roman Lebedev2019-02-061-1/+8
| | | | | | | | | | | | | | | | | | | | | Summary: The check should ignore the main function, the program entry point. It is not possible to use `std::array<>` for the `argv`. The alternative is to use `char** argv`. Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=40604 | PR40604 ]] Reviewers: JonasToth, aaron.ballman Reviewed By: aaron.ballman Subscribers: xazax.hun, hans, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D57787 llvm-svn: 353327
* [clang-tidy] Handle unions with existing default-member-initMalcolm Parsons2019-02-041-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: clang-tidy's modernize-use-default-member-init was crashing for unions with an existing default member initializer. Fixes PR40492 Reviewers: aaron.ballman, alexfh, JonasToth Reviewed By: JonasToth Subscribers: JonasToth, riccibruno, xazax.hun, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D57665 llvm-svn: 353092
* [clang-tidy] Add the abseil-duration-unnecessary-conversion checkHyrum Wright2019-02-044-0/+97
| | | | | | Differential Revision: https://reviews.llvm.org/D57353 llvm-svn: 353079
* Revert rCTE352968 due to compilation failures 💥Stephane Moore2019-02-021-7/+3
| | | | llvm-svn: 352969
* [clang-tidy] Make google-objc-function-naming ignore implicit functions 🙈Stephane Moore2019-02-021-3/+7
| | | | | | | | | | | | | | | | | | Summary: Implicit functions are outside the control of source authors and should be exempt from style restrictions. Tested via running clang tools tests. Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D57207 llvm-svn: 352968
* [clang-tidy] Rename time lookup functions; NFCHyrum Wright2019-02-023-7/+7
| | | | llvm-svn: 352964
* [clang-tidy] refactor bugprone-exception-escape analysis into classJonas Toth2019-01-315-151/+223
| | | | | | | | | | | | | | | | | | | | | | Summary: The check `bugprone-exception-escape` does an AST-based analysis to determine if a function might throw an exception and warns based on that information. The analysis part is refactored into a standalone class similiar to `ExprMutAnalyzer` that is generally useful. I intent to use that class in a new check to automatically introduce `noexcept` if possible. Reviewers: aaron.ballman, alexfh, hokein, baloghadamsoftware, lebedev.ri Reviewed By: baloghadamsoftware, lebedev.ri Subscribers: lebedev.ri, mgorny, xazax.hun, rnkovacs, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D57100 llvm-svn: 352741
* [clang-tidy] Fix a build error.Haojian Wu2019-01-281-1/+1
| | | | llvm-svn: 352364
* [clang-tidy] Add the abseil-duration-addition checkHyrum Wright2019-01-286-0/+162
| | | | | | Differential Revision: https://reviews.llvm.org/D57185 llvm-svn: 352362
* [clang-tidy] Add check for underscores in googletest names.Haojian Wu2019-01-254-0/+127
| | | | | | | | | | | | | | | | | | 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
* [clang-tidy] Rename the absl duration helper functions; NFCHyrum Wright2019-01-246-15/+17
| | | | llvm-svn: 352088
* Revert rCTE351921 to fix documentation geneeration.Stephane Moore2019-01-232-2/+23
| | | | | | Original review: https://reviews.llvm.org/D56945 llvm-svn: 351922
* [clang-tidy] Delete obsolete objc-property-declaration options ✂️Stephane Moore2019-01-232-23/+2
| | | | | | | | | | | | | | | | | | | | Summary: The `Acronyms` and `IncludeDefaultAcronyms` options were deprecated in https://reviews.llvm.org/D51832. These options can be removed. Tested by running the clang-tidy tests. Reviewers: benhamilton, aaron.ballman Reviewed By: aaron.ballman Subscribers: Eugene.Zelenko, xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D56945 llvm-svn: 351921
* [clang-tidy] Work around http://llvm.org/PR40392Alexander Kornienko2019-01-211-4/+10
| | | | | | | | | The readability-else-after-return check should be smarter about cases where the variable defined in the condition is used in the `else` branch. This patch makes it just ignore such cases, but alternative solutions may be better (added a FIXME). llvm-svn: 351751
* [clang-tidy] Use getStripPluginsAdjusterKadir Cetinkaya2019-01-211-17/+1
| | | | | | | | | | | | Summary: See rC351531 for the introduction of getStripPluginsAdjuster. Reviewers: alexfh Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D56902 llvm-svn: 351738
* [clang-tidy] misc-non-private-member-variables-in-classes: ignore implicit ↵Miklos Vajna2019-01-201-5/+6
| | | | | | | | | | methods Otherwise we don't warn on a struct containing a single public int, but we warn on a struct containing a single public std::string, which is inconsistent. llvm-svn: 351686
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-19510-2047/+1536
| | | | | | | | | | | | | | | | | 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
* Convert two more files that were using Windows line endings and removeChandler Carruth2019-01-191-58/+58
| | | | | | | a stray single '\r' from one file. These are the last line ending issues I can find in the files containing parts of LLVM's file headers. llvm-svn: 351634
* Install new LLVM license structure and new developer policy.Chandler Carruth2019-01-192-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This installs the new developer policy and moves all of the license files across all LLVM projects in the monorepo to the new license structure. The remaining projects will be moved independently. Note that I've left odd formatting and other idiosyncracies of the legacy license structure text alone to make the diff easier to read. Critically, note that we do not in any case *remove* the old license notice or terms, as that remains necessary until we finish the relicensing process. I've updated a few license files that refer to the LLVM license to instead simply refer generically to whatever license the LLVM project is under, basically trying to minimize confusion. This is really the culmination of so many people. Chris led the community discussions, drafted the policy update and organized the multi-year string of meeting between lawyers across the community to figure out the strategy. Numerous lawyers at companies in the community spent their time figuring out initial answers, and then the Foundation's lawyer Heather Meeker has done *so* much to help refine and get us ready here. I could keep going on, but I just want to make sure everyone realizes what a huge community effort this has been from the begining. Differential Revision: https://reviews.llvm.org/D56897 llvm-svn: 351631
* [clang-tidy] Add abseil-duration-conversion-cast checkHyrum Wright2019-01-174-0/+125
| | | | | | Differential Revision: https://reviews.llvm.org/D56532 llvm-svn: 351473
* [clang-tidy] Move the macro helper function to a common location; NFCHyrum Wright2019-01-163-22/+24
| | | | | | This is useful for multiple checks. llvm-svn: 351348
* [clang-tidy] bugprone-string-constructor: Catch string from nullptr.Clement Courbet2019-01-161-0/+16
| | | | | | | | | | Summary: Context: https://twitter.com/willkirkby/status/1084219580799741953 Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D56657 llvm-svn: 351308
OpenPOWER on IntegriCloud