llvm-project/clang-tools-extra/clang-tidy
Matthias Gehre 056237a457 clang-tidy modernize-loop-convert: preserve type of alias declaration (bug 28341)
Summary:
Previoly, the added test failed with the fillowing fixit:

     char v[5];

-    for(size_t i = 0; i < 5; ++i)
+    for(char value : v)
     {
-        unsigned char value = v[i];
         if (value > 127)

i.e. the variable 'value' changes from unsigned char to signed char. And
thus the following 'if' does not work anymore.

With this commit, the fixit is changed to:
     char v[5];

-    for(size_t i = 0; i < 5; ++i)
+    for(unsigned char value : v)
     {
-        unsigned char value = v[i];
         if (value > 127)

Reviewers: alexfh, klimek

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D22069

llvm-svn: 276111
2016-07-20 12:32:06 +00:00
..
boost [clang-tidy] boost-use-to-string arg expr location bugfix 2016-06-28 08:16:20 +00:00
cert [ASTMatchers] Added ignoringParenImpCasts to has matchers 2016-05-31 15:26:56 +00:00
cppcoreguidelines cppcoreguidelines-pro-bounds-constant-array-index: ignore implicit constructor 2016-07-19 17:02:54 +00:00
google Apply performance-unnecessary-value-param to clang-tidy. 2016-06-15 15:46:10 +00:00
llvm Fix clang-tidy patterns to adapt to newly added ExprWithCleanups nodes. 2016-06-21 20:11:20 +00:00
misc [clang-tidy] Fix misc-definitions-in-headers misplaced fixing to fully templated function. 2016-07-13 13:55:29 +00:00
modernize clang-tidy modernize-loop-convert: preserve type of alias declaration (bug 28341) 2016-07-20 12:32:06 +00:00
performance [clang-tidy] UnnecessaryValueParamCheck - only warn for virtual methods 2016-07-05 14:40:44 +00:00
plugin Add boost-use-to-string 2016-04-29 17:58:29 +00:00
readability [clang-tidy] readability-identifier-naming - support for other case types 2016-07-20 12:28:38 +00:00
tool [clang-tidy] Pass absolute path to OptionsProvider::getOptions/getRawOptions. 2016-07-11 07:47:04 +00:00
utils [clang-tidy] UnnecessaryValueParamCheck - suggest std::move() if non-const value parameter can be moved. 2016-07-01 20:12:15 +00:00
CMakeLists.txt Add boost-use-to-string 2016-04-29 17:58:29 +00:00
ClangTidy.cpp Unbreak extra tools build post r275882. 2016-07-18 19:21:22 +00:00
ClangTidy.h [clang-tidy] Fix doxygen errors. NFC. 2016-06-17 11:43:33 +00:00
ClangTidyDiagnosticConsumer.cpp [clang-tidy] Switch to a more common way of customizing check behavior. 2016-05-20 13:42:40 +00:00
ClangTidyDiagnosticConsumer.h [clang-tidy] Switch to a more common way of customizing check behavior. 2016-05-20 13:42:40 +00:00
ClangTidyModule.cpp Apply performance-unnecessary-value-param to clang-tidy. 2016-06-15 15:46:10 +00:00
ClangTidyModule.h Revert "Apply modernize-use-default to clang-tools-extra." 2015-10-20 21:45:52 +00:00
ClangTidyModuleRegistry.h [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC. 2015-03-09 16:52:33 +00:00
ClangTidyOptions.cpp [clang-tidy] Pass absolute path to OptionsProvider::getOptions/getRawOptions. 2016-07-11 07:47:04 +00:00
ClangTidyOptions.h [ClangTidy] Add an 'explain-checks' option to diagnose where each checks comes from. 2016-04-27 09:15:01 +00:00
add_new_check.py [clang-tidy] Remove redundant quote in add_new_check script 2016-05-30 15:42:08 +00:00
rename_check.py [clang-tidy] Python script for easy check rename 2015-10-11 07:58:34 +00:00