[PATCH] D25316: [clang-tidy] Enhance modernize-use-auto to casts

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 10 12:53:45 PDT 2016


alexfh added inline comments.


================
Comment at: clang-tidy/modernize/UseAutoCheck.cpp:252-254
+                      anyOf(hasType(autoType()),
+                            hasType(pointerType(pointee(autoType()))),
+                            hasType(referenceType(pointee(autoType())))))))))
----------------
This seems to be repeated almost verbatim three times already. It might make sense to merge the three matchers to avoid redundant computation.


================
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
----------------
Prazek wrote:
> malcolm.parsons wrote:
> > Prazek wrote:
> > > 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.
> > I could remove the duplicated tests, but the expected fixes are different so I'd like to test with and without star removal.
> so I think the best thing to do here, is to merge 2 files together, add second RUN: with different -check-prefix and use this prefix in the tests. At least this is how the tests in LLVM works, not sure if this is implemented in check_clang_tidy. 
Custom -check-prefixes should be supported by the check_clang_tidy.py in order for this to work. It seems out of the scope of this patch.


https://reviews.llvm.org/D25316





More information about the cfe-commits mailing list