aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
AgeCommit message (Collapse)AuthorFilesLines
2025-09-14[clang-tidy][NFC] Switch to new file header style (#158497)Victor Chernyakin1-1/+1
As decided in #118553 and following up #153942. `rename_check.py` has small logic changes, everything else is a mechanical replacement.
2025-09-08[clang-tidy][NFC] Enable `readability-container-contains` check in ↵flovent1-1/+1
clang-tidy config and apply fix-its (#157123) Closes #156157
2025-06-10[clang-tidy][NFC] fix 'misc-use-internal-linkage' check warnings (#143482)Baranov Victor1-3/+3
Run misc-use-internal-linkage check over clang-tidy code. Also fixed a couple of other clang-tidy warnings. Apart from issues in header files, all '.cpp' in `clang-tools-extra/clang-tidy` must be clang-tidy clear now.
2025-05-25[clang-tidy] Remove unused includes (NFC) (#141420)Kazu Hirata1-2/+0
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2024-09-18[clang-tidy][NFC] fix typo in ↵Congcong Cai1-3/+3
clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
2024-05-12Use StringRef::operator== instead of StringRef::equals (NFC) (#91864)Kazu Hirata1-1/+1
I'm planning to remove StringRef::equals in favor of StringRef::operator==. - StringRef::operator==/!= outnumber StringRef::equals by a factor of 276 under llvm-project/ in terms of their usage. - The elimination of StringRef::equals brings StringRef closer to std::string_view, which has operator== but not equals. - S == "foo" is more readable than S.equals("foo"), especially for !Long.Expression.equals("str") vs Long.Expression != "str".
2024-03-31Revert "[clang-tidy][NFC] Remove duplicated code"Piotr Zegar1-2/+2
This reverts commit b6f6be4b500ff64c23a5103ac3311cb74519542f.
2024-03-31[clang-tidy][NFC] Remove duplicated codePiotr Zegar1-2/+2
Remove duplicated matchers by moving some of them to utils/Matchers.h. Add some anonymous namespaces and renamed some code to avoid ODR issues.
2024-02-18[clang-tidy] Keep parentheses when replacing index access in `sizeof` calls ↵Danny Mösch1-3/+7
(#82166) Fixes #56021.
2024-01-20[clang-tidy] Fix crash in modernize-loop-convert when int is used as ↵Piotr Zegar1-4/+8
iterator (#78796) Fix crash when built-in type (like int) is used as iterator, or when call to begin() return integer. Closes #78381
2023-10-16[clang-tidy][modernize-loop-convert]check isDependentSizedArrayType (#69062)Congcong Cai1-0/+1
2023-08-30[clang-tidy][NFC] Fix llvm-else-after-return findingsPiotr Zegar1-2/+2
Fix issues found by clang-tidy in clang-tidy source directory.
2023-08-27[clang-tidy][NFC] Fix cppcoreguidelines-init-variables findingsPiotr Zegar1-2/+2
Fix issues found by clang-tidy in clang-tidy source directory.
2023-08-27[clang-tidy][NFC] Fix llvm-else-after-return findingsPiotr Zegar1-7/+7
Fix issues found by clang-tidy in clang-tidy source directory.
2023-08-27[clang-tidy][NFC] Fix modernize-return-braced-init-list findingsPiotr Zegar1-3/+3
Fix issues found by clang-tidy in clang-tidy source directory.
2023-08-07[clang-tidy] Remove 'const' qualifiers on return types that do nothingDmitri Gribenko1-3/+3
2023-08-05[clang-tidy] Support begin/end free functions in modernize-loop-convertChris Cotter1-44/+149
The modernize-loop-convert check will now match iterator based loops that call the free functions 'begin'/'end', as well as matching the free function 'size' on containers. Test plan: Added unit test cases matching free function calls on containers, and a single negative test case for length() which is not supported. Reviewed By: PiotrZSL Differential Revision: https://reviews.llvm.org/D140760
2023-06-14[clang-tidy] Fix wrong code generation for `modernize-loop-convert` with ↵AMS211-21/+40
structured bindings. Fixes llvm#62951 Reviewed By: PiotrZSL Differential Revision: https://reviews.llvm.org/D152852
2023-05-12[clang-tidy] Modernize RangeDescriptor (NFC)Kazu Hirata1-4/+0
2023-01-14[clang-tidy][NFC] Use C++17 nested namespaces in the clang-tidy folderCarlos Galvez1-4/+2
Fix applied by running: run-clang-tidy.py -checks=-*,modernize-concat-nested-namespaces Differential Revision: https://reviews.llvm.org/D141770
2023-01-10[clang-tidy] Match derived types in in modernize-loop-convertChris Cotter1-9/+10
This patch allows clang-tidy to replace traditional for-loops where the container type inherits its `begin`/`end` methods from a base class. Test plan: Added unit test cases that confirm the tool replaces the new pattern. Reviewed By: carlosgalvezp Differential Revision: https://reviews.llvm.org/D140307
2023-01-10Move from llvm::makeArrayRef to ArrayRef deduction guides - last partserge-sans-paille1-2/+2
This is a follow-up to https://reviews.llvm.org/D140896, split into several parts as it touches a lot of files. Differential Revision: https://reviews.llvm.org/D141298
2023-01-07[clang-tools-extra] Use std::optional instead of llvm::Optional (NFC)Kazu Hirata1-1/+1
This patch replaces (llvm::|)Optional< with std::optional<. I'll post a separate patch to clean up the "using" declarations, #include "llvm/ADT/Optional.h", etc. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-07[clang-tools-extra] Add #include <optional> (NFC)Kazu Hirata1-0/+1
This patch adds #include <optional> to those files containing llvm::Optional<...> or Optional<...>. I'll post a separate patch to actually replace llvm::Optional with std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-14Don't include StringSwitch (NFC)Kazu Hirata1-1/+0
These files do not use llvm::StringSwitch.
2022-07-27[clang] Implement ElaboratedType sugaring for types written bareMatheus Izvekov1-1/+1
Without this patch, clang will not wrap in an ElaboratedType node types written without a keyword and nested name qualifier, which goes against the intent that we should produce an AST which retains enough details to recover how things are written. The lack of this sugar is incompatible with the intent of the type printer default policy, which is to print types as written, but to fall back and print them fully qualified when they are desugared. An ElaboratedTypeLoc without keyword / NNS uses no storage by itself, but still requires pointer alignment due to pre-existing bug in the TypeLoc buffer handling. --- Troubleshooting list to deal with any breakage seen with this patch: 1) The most likely effect one would see by this patch is a change in how a type is printed. The type printer will, by design and default, print types as written. There are customization options there, but not that many, and they mainly apply to how to print a type that we somehow failed to track how it was written. This patch fixes a problem where we failed to distinguish between a type that was written without any elaborated-type qualifiers, such as a 'struct'/'class' tags and name spacifiers such as 'std::', and one that has been stripped of any 'metadata' that identifies such, the so called canonical types. Example: ``` namespace foo { struct A {}; A a; }; ``` If one were to print the type of `foo::a`, prior to this patch, this would result in `foo::A`. This is how the type printer would have, by default, printed the canonical type of A as well. As soon as you add any name qualifiers to A, the type printer would suddenly start accurately printing the type as written. This patch will make it print it accurately even when written without qualifiers, so we will just print `A` for the initial example, as the user did not really write that `foo::` namespace qualifier. 2) This patch could expose a bug in some AST matcher. Matching types is harder to get right when there is sugar involved. For example, if you want to match a type against being a pointer to some type A, then you have to account for getting a type that is sugar for a pointer to A, or being a pointer to sugar to A, or both! Usually you would get the second part wrong, and this would work for a very simple test where you don't use any name qualifiers, but you would discover is broken when you do. The usual fix is to either use the matcher which strips sugar, which is annoying to use as for example if you match an N level pointer, you have to put N+1 such matchers in there, beginning to end and between all those levels. But in a lot of cases, if the property you want to match is present in the canonical type, it's easier and faster to just match on that... This goes with what is said in 1), if you want to match against the name of a type, and you want the name string to be something stable, perhaps matching on the name of the canonical type is the better choice. 3) This patch could expose a bug in how you get the source range of some TypeLoc. For some reason, a lot of code is using getLocalSourceRange(), which only looks at the given TypeLoc node. This patch introduces a new, and more common TypeLoc node which contains no source locations on itself. This is not an inovation here, and some other, more rare TypeLoc nodes could also have this property, but if you use getLocalSourceRange on them, it's not going to return any valid locations, because it doesn't have any. The right fix here is to always use getSourceRange() or getBeginLoc/getEndLoc which will dive into the inner TypeLoc to get the source range if it doesn't find it on the top level one. You can use getLocalSourceRange if you are really into micro-optimizations and you have some outside knowledge that the TypeLocs you are dealing with will always include some source location. 4) Exposed a bug somewhere in the use of the normal clang type class API, where you have some type, you want to see if that type is some particular kind, you try a `dyn_cast` such as `dyn_cast<TypedefType>` and that fails because now you have an ElaboratedType which has a TypeDefType inside of it, which is what you wanted to match. Again, like 2), this would usually have been tested poorly with some simple tests with no qualifications, and would have been broken had there been any other kind of type sugar, be it an ElaboratedType or a TemplateSpecializationType or a SubstTemplateParmType. The usual fix here is to use `getAs` instead of `dyn_cast`, which will look deeper into the type. Or use `getAsAdjusted` when dealing with TypeLocs. For some reason the API is inconsistent there and on TypeLocs getAs behaves like a dyn_cast. 5) It could be a bug in this patch perhaps. Let me know if you need any help! Signed-off-by: Matheus Izvekov <mizvekov@gmail.com> Differential Revision: https://reviews.llvm.org/D112374
2022-07-14Revert "[clang] Implement ElaboratedType sugaring for types written bare"Jonas Devlieghere1-1/+1
This reverts commit 7c51f02effdbd0d5e12bfd26f9c3b2ab5687c93f because it stills breaks the LLDB tests. This was re-landed without addressing the issue or even agreement on how to address the issue. More details and discussion in https://reviews.llvm.org/D112374.
2022-07-15[clang] Implement ElaboratedType sugaring for types written bareMatheus Izvekov1-1/+1
Without this patch, clang will not wrap in an ElaboratedType node types written without a keyword and nested name qualifier, which goes against the intent that we should produce an AST which retains enough details to recover how things are written. The lack of this sugar is incompatible with the intent of the type printer default policy, which is to print types as written, but to fall back and print them fully qualified when they are desugared. An ElaboratedTypeLoc without keyword / NNS uses no storage by itself, but still requires pointer alignment due to pre-existing bug in the TypeLoc buffer handling. --- Troubleshooting list to deal with any breakage seen with this patch: 1) The most likely effect one would see by this patch is a change in how a type is printed. The type printer will, by design and default, print types as written. There are customization options there, but not that many, and they mainly apply to how to print a type that we somehow failed to track how it was written. This patch fixes a problem where we failed to distinguish between a type that was written without any elaborated-type qualifiers, such as a 'struct'/'class' tags and name spacifiers such as 'std::', and one that has been stripped of any 'metadata' that identifies such, the so called canonical types. Example: ``` namespace foo { struct A {}; A a; }; ``` If one were to print the type of `foo::a`, prior to this patch, this would result in `foo::A`. This is how the type printer would have, by default, printed the canonical type of A as well. As soon as you add any name qualifiers to A, the type printer would suddenly start accurately printing the type as written. This patch will make it print it accurately even when written without qualifiers, so we will just print `A` for the initial example, as the user did not really write that `foo::` namespace qualifier. 2) This patch could expose a bug in some AST matcher. Matching types is harder to get right when there is sugar involved. For example, if you want to match a type against being a pointer to some type A, then you have to account for getting a type that is sugar for a pointer to A, or being a pointer to sugar to A, or both! Usually you would get the second part wrong, and this would work for a very simple test where you don't use any name qualifiers, but you would discover is broken when you do. The usual fix is to either use the matcher which strips sugar, which is annoying to use as for example if you match an N level pointer, you have to put N+1 such matchers in there, beginning to end and between all those levels. But in a lot of cases, if the property you want to match is present in the canonical type, it's easier and faster to just match on that... This goes with what is said in 1), if you want to match against the name of a type, and you want the name string to be something stable, perhaps matching on the name of the canonical type is the better choice. 3) This patch could exposed a bug in how you get the source range of some TypeLoc. For some reason, a lot of code is using getLocalSourceRange(), which only looks at the given TypeLoc node. This patch introduces a new, and more common TypeLoc node which contains no source locations on itself. This is not an inovation here, and some other, more rare TypeLoc nodes could also have this property, but if you use getLocalSourceRange on them, it's not going to return any valid locations, because it doesn't have any. The right fix here is to always use getSourceRange() or getBeginLoc/getEndLoc which will dive into the inner TypeLoc to get the source range if it doesn't find it on the top level one. You can use getLocalSourceRange if you are really into micro-optimizations and you have some outside knowledge that the TypeLocs you are dealing with will always include some source location. 4) Exposed a bug somewhere in the use of the normal clang type class API, where you have some type, you want to see if that type is some particular kind, you try a `dyn_cast` such as `dyn_cast<TypedefType>` and that fails because now you have an ElaboratedType which has a TypeDefType inside of it, which is what you wanted to match. Again, like 2), this would usually have been tested poorly with some simple tests with no qualifications, and would have been broken had there been any other kind of type sugar, be it an ElaboratedType or a TemplateSpecializationType or a SubstTemplateParmType. The usual fix here is to use `getAs` instead of `dyn_cast`, which will look deeper into the type. Or use `getAsAdjusted` when dealing with TypeLocs. For some reason the API is inconsistent there and on TypeLocs getAs behaves like a dyn_cast. 5) It could be a bug in this patch perhaps. Let me know if you need any help! Signed-off-by: Matheus Izvekov <mizvekov@gmail.com> Differential Revision: https://reviews.llvm.org/D112374
2022-07-13Revert "[clang] Implement ElaboratedType sugaring for types written bare"Jonas Devlieghere1-1/+1
This reverts commit bdc6974f92304f4ed542241b9b89ba58ba6b20aa because it breaks all the LLDB tests that import the std module. import-std-module/array.TestArrayFromStdModule.py import-std-module/deque-basic.TestDequeFromStdModule.py import-std-module/deque-dbg-info-content.TestDbgInfoContentDequeFromStdModule.py import-std-module/forward_list.TestForwardListFromStdModule.py import-std-module/forward_list-dbg-info-content.TestDbgInfoContentForwardListFromStdModule.py import-std-module/list.TestListFromStdModule.py import-std-module/list-dbg-info-content.TestDbgInfoContentListFromStdModule.py import-std-module/queue.TestQueueFromStdModule.py import-std-module/stack.TestStackFromStdModule.py import-std-module/vector.TestVectorFromStdModule.py import-std-module/vector-bool.TestVectorBoolFromStdModule.py import-std-module/vector-dbg-info-content.TestDbgInfoContentVectorFromStdModule.py import-std-module/vector-of-vectors.TestVectorOfVectorsFromStdModule.py https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/45301/
2022-07-13[clang] Implement ElaboratedType sugaring for types written bareMatheus Izvekov1-1/+1
Without this patch, clang will not wrap in an ElaboratedType node types written without a keyword and nested name qualifier, which goes against the intent that we should produce an AST which retains enough details to recover how things are written. The lack of this sugar is incompatible with the intent of the type printer default policy, which is to print types as written, but to fall back and print them fully qualified when they are desugared. An ElaboratedTypeLoc without keyword / NNS uses no storage by itself, but still requires pointer alignment due to pre-existing bug in the TypeLoc buffer handling. Signed-off-by: Matheus Izvekov <mizvekov@gmail.com> Differential Revision: https://reviews.llvm.org/D112374
2022-04-16[clang-tidy] Add a Standalone diagnostics mode to clang-tidyNathan James1-4/+8
Adds a flag to `ClangTidyContext` that is used to indicate to checks that fixes will only be applied one at a time. This is to indicate to checks that each fix emitted should not depend on any other fixes emitted across the translation unit. I've currently implemented the `IncludeInserter`, `LoopConvertCheck` and `PreferMemberInitializerCheck` to use these support these modes. Reasoning behind this is in use cases like `clangd` it's only possible to apply one fix at a time. For include inserter checks, the include is only added once for the first diagnostic that requires it, this will result in subsequent fixes not having the included needed. A similar issue is seen in the `PreferMemberInitializerCheck` where the `:` will only be added for the first member that needs fixing. Fixes emitted in `StandaloneDiagsMode` will likely result in malformed code if they are applied all together, conversely fixes currently emitted may result in malformed code if they are applied one at a time. For this reason invoking `clang-tidy` from the binary will always with `StandaloneDiagsMode` disabled, However using it as a library its possible to select the mode you wish to use, `clangd` always selects `StandaloneDiagsMode`. This is an example of the current behaviour failing ```lang=c++ struct Foo { int A, B; Foo(int D, int E) { A = D; B = E; // Fix Here } }; ``` Incorrectly transformed to: ```lang=c++ struct Foo { int A, B; Foo(int D, int E), B(E) { A = D; // Fix Here } }; ``` In `StandaloneDiagsMode`, it gets transformed to: ```lang=c++ struct Foo { int A, B; Foo(int D, int E) : B(E) { A = D; // Fix Here } }; ``` Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D97121
2021-12-24Use isa instead of dyn_cast (NFC)Kazu Hirata1-1/+1
2021-11-15[clang-tidy] Fix a crash in modernize-loop-convert around conversion operatorsKristóf Umann1-2/+2
modernize-loop-convert checks and fixes when a loop that iterates over the elements of a container can be rewritten from a for(...; ...; ...) style into the "new" C++11 for-range format. For that, it needs to parse the elements of that loop, like its init-statement, such as ItType it = cont.begin(). modernize-loop-convert checks whether the loop variable is initialized by a begin() member function. When an iterator is initialized with a conversion operator (e.g. for (const_iterator it = non_const_container.begin(); ...), attempts to retrieve the name of the initializer expression resulted in an assert, as conversion operators don't have a valid IdentifierInfo. I fixed this by making digThroughConstructors dig through conversion operators as well. Differential Revision: https://reviews.llvm.org/D113201
2021-06-09[clang] NFC: Rename rvalue to prvalueMatheus Izvekov1-1/+1
This renames the expression value categories from rvalue to prvalue, keeping nomenclature consistent with C++11 onwards. C++ has the most complicated taxonomy here, and every other language only uses a subset of it, so it's less confusing to use the C++ names consistently, and mentally remap to the C names when working on that context (prvalue -> rvalue, no xvalues, etc). Renames: * VK_RValue -> VK_PRValue * Expr::isRValue -> Expr::isPRValue * SK_QualificationConversionRValue -> SK_QualificationConversionPRValue * JSON AST Dumper Expression nodes value category: "rvalue" -> "prvalue" Signed-off-by: Matheus Izvekov <mizvekov@gmail.com> Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D103720
2021-03-04[clang-tidy] Extend LoopConvert on array with `!=` comparisonNathan James1-28/+27
Enables transforming loops of the form: ``` for (int i = 0; I != container.size(); ++I) { container[I]...; } for (int i = 0; I != N; ++I) { FixedArrSizeN[I]...; } ``` Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D97940
2021-03-03[clang-tidy][NFC] Use equalsBoundNode matchers to simplify LoopConvertCheckNathan James1-47/+17
Make use of the `equalsBoundNode` matcher to ensure Init, Conditon and Increment variables all refer to the same variable during matching. Reviewed By: steveire Differential Revision: https://reviews.llvm.org/D97639
2021-02-07[clang-tidy] fix modernize-loop-convert to retain needed array-like operator[]poelmanc1-3/+4
`modernize-loop-convert` handles //array-like// objects like vectors fairly well, but strips slightly too much information from the iteration expression by converting: ``` Vector<Vector<int>> X; for (int J = 0; J < X[5].size(); ++J) copyArg(X[5][J]); ``` to ``` Vector<Vector<int>> X; for (int J : X) // should be for (int J : X[5]) copyArg(J); ``` The `[5]` is a call to `operator[]` and gets stripped by `LoopConvertCheck::getContainerString`. This patch fixes that and adds several test cases. Reviewed By: njames93 Differential Revision: https://reviews.llvm.org/D95771
2021-02-03[clang-tidy] Use new mapping matchersStephen Kelly1-13/+3
Use mapAnyOf() and matchers based on it. Use of binaryOperation() means that modernize-loop-convert and readability-container-size-empty can now be used with rewritten binary operators. Differential Revision: https://reviews.llvm.org/D94131
2021-01-29[clang-tidy] Applied clang-tidy fixes. NFCAlexander Kornienko1-16/+18
Applied fixes enabled by the LLVM's .clang-tidy configs. Reverted files where fixes introduced compile errors: clang-tools-extra/clang-tidy/hicpp/NoAssemblerCheck.cpp clang-tools-extra/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp $ clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -fix clang-tools-extra/clang-tidy/ Enabled checks: llvm-else-after-return llvm-header-guard llvm-include-order llvm-namespace-comment llvm-prefer-isa-or-dyn-cast-in-conditionals llvm-prefer-register-over-unsigned llvm-qualified-auto llvm-twine-local misc-definitions-in-headers misc-misplaced-const misc-new-delete-overloads misc-no-recursion misc-non-copyable-objects misc-redundant-expression misc-static-assert misc-throw-by-value-catch-by-reference misc-unconventional-assign-operator misc-uniqueptr-reset-release misc-unused-alias-decls misc-unused-using-decls readability-identifier-naming Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D95614
2020-12-11Remove references to the ast_type_traits namespaceAlexander Kornienko1-10/+5
Follow up to cd62511496938e33c061c90796dd23a5288ff843 / https://reviews.llvm.org/D74499 Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D92994
2020-12-08[clang-tidy] Add support for diagnostics with no locationNathan James1-5/+4
Add methods for emitting diagnostics with no location as well as a special diagnostic for configuration errors. These show up in the errors as [clang-tidy-config]. The reason to use a custom name rather than the check name is to distinguish the error isn't the same category as the check that reported it. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D91885
2020-10-16[clang-tidy] modernize-loop-convert reverse iteration supportNathan James1-29/+110
Enables support for transforming loops of the form ``` for (auto I = Cont.rbegin(), E = Cont.rend(); I != E;++I) ``` This is done automatically in C++20 mode using `std::ranges::reverse_view` but there are options to specify a different function to reverse iterator over a container. This is the first step, down the line I'd like to possibly extend this support for array based loops ``` for (unsigned I = Arr.size() - 1;I >=0;--I) Arr[I]... ``` Currently if you pass a reversing function with no header in the options it will just assume that the function exists, however as we have the ASTContext it may be as wise to check before applying, or at least lower the confidence level if we can't find it. Reviewed By: alexfh Differential Revision: https://reviews.llvm.org/D82089
2020-07-11[clang-tidy] Reworked enum options handling(again)Nathan James1-25/+29
Reland b9306fd after fixing the issue causing mac builds to fail unittests. Following on from D77085, I was never happy with the passing a mapping to the option get/store functions. This patch addresses this by using explicit specializations to handle the serializing and deserializing of enum options. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D82188
2020-07-07[NFC] Use hasAnyName matcher in place of anyOf(hasName()...)Nathan James1-7/+4
2020-06-29Revert "[clang-tidy] relanding b9306fd"Nathan James1-29/+25
This reverts commit 37cc4fa2eaa3d03ca8cd4947eb0d4c60e3c9b45c. More investigation needed
2020-06-29[clang-tidy] relanding b9306fdNathan James1-25/+29
Added some sanity checks to figure out the cause of a (seemingly unrelated) test failure on mac. These can be removed should no issues arise on that platform again.
2020-06-28Revert "[clang-tidy] Reworked enum options handling(again)"Nico Weber1-29/+25
This reverts commit b9306fd042ce1c11d84f05d2124dfdc65b8331fe and follow-up 42a51587c79a673045aec3586f4070630e5e7af3. It seems to build check-clang-tools on macOS, see comments on https://reviews.llvm.org/D82188
2020-06-28[clang-tidy] Reworked enum options handling(again)Nathan James1-25/+29
Following on from D77085, I was never happy with the passing a mapping to the option get/store functions. This patch addresses this by using explicit specializations to handle the serializing and deserializing of enum options. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D82188
2020-06-21[clang-tidy] Implement storeOptions for checks missing it.Nathan James1-1/+1
Just adds the storeOptions for Checks that weren't already storing their options. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D82223
2020-06-04[clang-tidy][modernize-loop-convert] Make loop var type human readableZinovy Nis1-0/+1
Differential Revision: https://reviews.llvm.org/D80536