[PATCH] D25316: [clang-tidy] Fix PR25499: Enhance modernize-use-auto to casts
Piotr Padlewski via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 8 08:45:25 PDT 2016
Prazek added a comment.
Awesome to see this patch. After this one will make it to upstream, it will be much easier for me to do same with template functions.
================
Comment at: test/clang-tidy/modernize-use-auto-cast-remove-stars.cpp:2
+// RUN: %check_clang_tidy %s modernize-use-auto %t -- \
+// RUN: -config="{CheckOptions: [{key: modernize-use-auto.RemoveStars, value: '1'}]}" \
+// RUN: -- -std=c++11
----------------
What is the difference between this test, and next test?
The name indicate that it removes star, but I see a lot of test that doesn't use star
and that seem to be duplicated with the next one.
================
Comment at: test/clang-tidy/modernize-use-auto-cast-remove-stars.cpp:25
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+ // CHECK-FIXES: auto ll = static_cast<long long>(l);
+ unsigned long long ull = static_cast<unsigned long long>(l);
----------------
Is it possible to simply fix the double spaces?
================
Comment at: test/clang-tidy/modernize-use-auto-cast.cpp:14
+ long l = 1;
+ int i1 = static_cast<int>(l);
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
----------------
How do you handle cases like
long l = static_cast<int>(i1);
I would expect it to produce warning, but not produce fixit (because it might change the behavior of program), but I still would like to get information about it because it seems like a bug.
https://reviews.llvm.org/D25316
More information about the cfe-commits
mailing list