[PATCH] D15121: A new clang-tidy module to find calls to `std::swap`, and change them to use ADL

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 2 10:01:48 PST 2015


mclow.lists added inline comments.

================
Comment at: clang-tidy/misc/StdSwapCheck.cpp:68
@@ +67,3 @@
+    callee(expr(ignoringParenImpCasts(declRefExpr(has(nestedNameSpecifierLoc().bind("namespace"))))))).bind("swap"),
+    this);
+}
----------------
I believe that if you do that, you lose the arguments as well.

    std::swap(x,y);  -> { using ::std::swap; swap; }


================
Comment at: clang-tidy/misc/StdSwapCheck.h:19
@@ +18,3 @@
+/// A checker that finds ns-qualified calls to std::swap, and replaces them
+///    with calls that use ADL instead.
+///
----------------
aaron.ballman wrote:
> Strange indentation on the second line of the comment.
I like that indentation :-) 
It indicates that this is a continuation of the previous line.


http://reviews.llvm.org/D15121





More information about the cfe-commits mailing list