[PATCH] D16922: [clang-tidy] Added check-fixes for misc-virtual-near-miss.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 5 06:42:37 PST 2016


alexfh added inline comments.

================
Comment at: clang-tidy/misc/VirtualNearMissCheck.cpp:252
@@ -251,1 +251,3 @@
             // A "virtual near miss" is found.
+            auto Range = CharSourceRange::getTokenRange(SourceRange(
+                DerivedMD->getLocation(), DerivedMD->getLocation()));
----------------
There are two ways to make it shorter:
  * use the `getTokenRange` overload for `SourceLocation`s: `CharSourceRange::getTokenRange(DerivedMD->getLocation(), DerivedMD->getLocation());`;
  * use the `SourceRange` constructor accepting a single location: `CharSourceRange::getTokenRange(SourceRange(DerivedMD->getLocation()));`.

Choose whatever you like more ;)

================
Comment at: test/clang-tidy/misc-virtual-near-miss.cpp:1
@@ -1,2 +1,2 @@
 // RUN: %check_clang_tidy %s misc-virtual-near-miss %t
 
----------------
Please add a test ensuring replacements are applied correctly in templates with multiple instantiations and in macros.


http://reviews.llvm.org/D16922





More information about the cfe-commits mailing list